From e275ad3866de98c1e302ef62ba5a2e5488493c04 Mon Sep 17 00:00:00 2001 From: Klaas Freitag Date: Tue, 27 May 2014 11:33:08 +0200 Subject: [PATCH] Emit the sync finished signal a bit delayed. This allows folder watcher events comnig in before the sync is marked finished. This avoids "endless syncing" as described in bug #1808 --- src/mirall/folder.cpp | 15 +++++++++++++++ src/mirall/folder.h | 2 ++ 2 files changed, 17 insertions(+) diff --git a/src/mirall/folder.cpp b/src/mirall/folder.cpp index 6ba5abfa8..bc0a0c406 100644 --- a/src/mirall/folder.cpp +++ b/src/mirall/folder.cpp @@ -655,9 +655,24 @@ void Folder::slotSyncFinished() } emit syncStateChange(); + + // The syncFinished result that is to be triggered here makes the folderman + // clearing the current running sync folder marker. + // Lets wait a bit to do that because, as long as this marker is not cleared, + // file system change notifications are ignored for that folder. And it takes + // some time under certain conditions to make the file system notifications + // all come in. + QTimer::singleShot(200, this, SLOT(slotEmitFinishedDelayed() )); + +} + +void Folder::slotEmitFinishedDelayed() +{ emit syncFinished( _syncResult ); } + + // the progress comes without a folder and the valid path set. Add that here // and hand the result over to the progress dispatcher. void Folder::slotTransmissionProgress(const Progress::Info &pi) diff --git a/src/mirall/folder.h b/src/mirall/folder.h index 85fea6207..90f47a926 100644 --- a/src/mirall/folder.h +++ b/src/mirall/folder.h @@ -181,6 +181,8 @@ private slots: void slotThreadTreeWalkResult(const SyncFileItemVector& ); + void slotEmitFinishedDelayed(); + private: bool init();