Jump to content

PIM/MS Windows/SQLite Folder Indices/merge: Difference between revisions

From KDE Community Wiki
Jstaniek (talk | contribs)
No edit summary
Jstaniek (talk | contribs)
No edit summary
Line 17: Line 17:
**QString FolderStorage::sortedLocation() const - added to avoid constructing paths using ''indexLocation() + ".sorted"'' code
**QString FolderStorage::sortedLocation() const - added to avoid constructing paths using ''indexLocation() + ".sorted"'' code
**QString FolderStorage::idsLocation() const - added to avoid constructing paths using ''indexLocation() + ".ids"'' code
**QString FolderStorage::idsLocation() const - added to avoid constructing paths using ''indexLocation() + ".ids"'' code
 
**int FolderStorage::rename( const QString &newName, KMFolderDir *newParent ):
***sortedLocation() is used instead of adding indexLocation()+".sorted" - OK
***result of KDE_rename( oldIndexLoc, newIndexLoc ) is checked and we return immediately on failure - OK
***result of KDE_rename( oldSortedLoc, newSortedLoc ) is checked and we return immediately on failure - OK
***result of KDE_rename( oldIdsLoc, newIdsLoc ) is checked and we return immediately on failure - OK


*kmailicalifaceimpl.cpp - OK
*kmailicalifaceimpl.cpp - OK

Revision as of 11:05, 8 May 2008

Validation of the SQLite folder indices merge into kdepim trunk (805075).

jstaniek 11:38, 8 May 2008 (CEST)

Notes

  • "OK" means files or methods inspected in every detail.
  • We do not mention changes that only add/remove kDebug(), etc.

Results

  • compactionjob.cpp - OK
    • void MboxCompactionJob::done( int rc ): the only addition: result of KDE_rename() is checked, return immediately on failure
  • folderstorage.cpp, folderstorage.h
    • QString FolderStorage::indexLocation() const - implemented here to return "*.index" name for mmap mode ("*.index.db" for sqlite mode). Previously it was abstract and implemented in KMFolderIndex. KMFolderSearch reimplements it to return "*.index.search" name - see kmfoldersearch.cpp for details.
    • added virtual QString FolderStorage::location(const QString& suffix) const helper, used in various *location() methods of in KMail, to avoid code duplication; returns full path to .index, .index.ids or .index.sorted file (depending on suffix); the former path (in case of mmap-based implementation) is returned when the suffix is empty.
    • QString FolderStorage::sortedLocation() const - added to avoid constructing paths using indexLocation() + ".sorted" code
    • QString FolderStorage::idsLocation() const - added to avoid constructing paths using indexLocation() + ".ids" code
    • int FolderStorage::rename( const QString &newName, KMFolderDir *newParent ):
      • sortedLocation() is used instead of adding indexLocation()+".sorted" - OK
      • result of KDE_rename( oldIndexLoc, newIndexLoc ) is checked and we return immediately on failure - OK
      • result of KDE_rename( oldSortedLoc, newSortedLoc ) is checked and we return immediately on failure - OK
      • result of KDE_rename( oldIdsLoc, newIdsLoc ) is checked and we return immediately on failure - OK
  • kmailicalifaceimpl.cpp - OK

void KMailICalIfaceImpl::readConfig() - added sanity check: if ( !mCalendar || !mTasks || !mJournals || !mContacts || !mNotes )

 return;

KMFolder* KMailICalIfaceImpl::initFolder( KMail::FolderContentsType contentsType ) - added check for result of open():if ( 0 != folder->open( "ifacefolder" ) ) { ....

  • kmfolder.cpp, kmfolder.h
    • QString KMFolder::indexLocation() const - made virtual but implementation is unaffected.
    • QString KMFolder::sortedLocation() const - calls FolderStorage::idsLocation() if storage is presents, else returns empty string; added as a helper for KMHeaders so we don't need to call mFolder->indexLocation() + ".sorted"; gives effectively the same result - OK
    • QString KMFolder::idsLocation() const - like above but for ".ids" names - OK
  • kmfolderdir.cpp - OK
    • bool KMFolderDir::reload(void): no changes, as .index.db files are only ignored for sqlite mode - OK


  • kmfolderindex.cpp, kmfolderindex.h
  • kmfoldermaildir.cpp
  • kmfoldermbox.cpp
  • kmfoldersearch.cpp - OK
    • QString KMFolderSearch::indexLocation() const now just calls FolderStorage::location( "search" ) utility function what has the same effect
    • int KMFolderSearch::writeIndex( bool ): at the very end final, result of KDE_rename() from temp name to the indexLocation() name is checked; on faulure the method fails, what cause that "mDirty = false; mUnlinked = false;" code is not executed. - OK
  • kmheaders.cpp, kmheaders.h - OK
    • #define KMAIL_SORT_FILE(x) x->indexLocation() + ".sorted" replaced by #define KMAIL_SORT_FILE(x) x->sortedLocation() - uses a new utility FolderStorage::sortedLocation() method having basically the same source code - OK
    • void KMHeaders::setNestedOverride( bool override ) - like above - OK
    • void KMHeaders::setSubjectThreading( bool aSubjThreading ) - like above - OK
    • void KMHeaders::writeFolderConfig (void): minor optimization: mFolder->getMsgBase( current->msgId() ) is called once instead of twice - OK
    • bool KMHeaders::writeSortOrder() - the only addition: result of KDE_rename() is checked, return immediately on failure
    • QList< Q_UINT32 > KMHeaders::selectedSernums() - sanity check added in case when KMMsgBase *msgBase = mFolder->getMsgBase( item->msgId() ); returns null result; this shouldn't happen - OK
    • QList< Q_UINT32 > KMHeaders::selectedVisibleSernums() - like above
  • kmkernel.cpp - OK
    • void KMKernel::slotRunBackgroundTasks(): added sanity checks for null pointers: the_folderMgr, the_imapFolderMgr, the_dimapFolderMgr; this is neutral change
  • kmmsgbase.cpp
  • kmmsgbase.h
  • kmmsgdict.cpp - OK
    • QString KMMsgDict::getFolderIdsLocation( const FolderStorage &storage ): the new FolderStorage::idsLocation() is called which provides the same code as the original impl. of KMMsgDict::getFolderIdsLocation(). - OK
  • kmmsginfo.cpp
  • kmmsginfo.h
  • messageproperty.cpp - OK
    • minor optimizations only added, for example 1. instead of 2.:
      1. QMap<quint32, QPointer<KMFolder> >::ConstIterator it = sFolders.constFind( serNum );
        return it == sFolders.constEnd() ? 0 : (*it).operator->();
      2. if (sFolders.contains(serNum))
          return sFolders[serNum].operator->();
        return 0;
    • Affected methods:
      • KMFolder* MessageProperty::filterFolder( quint32 serNum ) - Status: OK
      • ActionScheduler* MessageProperty::filterHandler( quint32 serNum ) - Status: OK
      • bool MessageProperty::transferInProgress( quint32 serNum ) - Status: OK
      • void MessageProperty::setTransferInProgress( quint32 serNum, bool transfer, bool force ) - Status: OK
      • quint32 MessageProperty::serialCache( const KMMsgBase *msgBase ) - Status: OK