Git commit d55b5f0a39b32ff243c5d7c32f2b27df0f58cb25 by Andras Mantia. Committed on 17/11/2013 at 10:22. Pushed by amantia into branch 'master'. Improve maildir by several factors: we can get dirty signals from the FS ev= en if we stop the dir scan prior making changes, so detect if the signal wa= s for a mail file we have just changed and ignore it. Also add some more error handling cases (that should not happen, but could = help to avoid data losses). M +20 -4 resources/maildir/maildirresource.cpp M +3 -1 resources/maildir/maildirresource.h http://commits.kde.org/kdepim-runtime/d55b5f0a39b32ff243c5d7c32f2b27df0f58c= b25 diff --git a/resources/maildir/maildirresource.cpp b/resources/maildir/mail= dirresource.cpp index 9265352..3cfee66 100644 --- a/resources/maildir/maildirresource.cpp +++ b/resources/maildir/maildirresource.cpp @@ -281,6 +281,7 @@ void MaildirResource::itemAdded( const Akonadi::Item & = item, const Akonadi::Coll stopMaildirScan( dir ); = const QString rid =3D dir.addEntry( mail->encodedContent() ); + mChangedFiles.insert( rid ); = if ( rid.isEmpty() ) { restartMaildirScan( dir ); @@ -352,6 +353,11 @@ void MaildirResource::itemChanged( const Akonadi::Item= & item, const QSethead(); mail->setContent( currentData ); mail->setHead( newHead ); @@ -363,6 +369,11 @@ void MaildirResource::itemChanged( const Akonadi::Item= & item, const QSet #include = +class QFileInfo; class KDirWatch; namespace Akonadi_Maildir_Resource { @@ -71,7 +72,7 @@ class MaildirResource : public Akonadi::ResourceBase, pub= lic Akonadi::AgentBase: void configurationChanged(); void slotItemsRetrievalResult(KJob* job); void slotDirChanged( const QString &dir ); - void slotFileChanged( const QString &fileName ); + void slotFileChanged( const QFileInfo &fileInfo ); void fsWatchDirFetchResult( KJob* job ); void fsWatchFileFetchResult( KJob* job ); void fsWatchFileModifyResult( KJob* job ); @@ -95,6 +96,7 @@ private: Akonadi_Maildir_Resource::MaildirSettings *mSettings; KDirWatch *mFsWatcher; QHash mMaildirsForCollection; + QSet mChangedFiles; //files changed by the resource and that = should be ignored in slotFileChanged = }; =20