[Pkg-owncloud-commits] [owncloud-client] 440/470: Fix the root item sync status #4682

Sandro Knauß hefee-guest at moszumanska.debian.org
Thu May 12 16:25:40 UTC 2016


This is an automated email from the git hooks/post-receive script.

hefee-guest pushed a commit to branch master
in repository owncloud-client.

commit 32b3023a8e140d5a202e2ef23961e2ab616b092e
Author: Jocelyn Turcotte <jturcotte at woboq.com>
Date:   Thu Apr 28 19:03:13 2016 +0200

    Fix the root item sync status #4682
    
    Make sure that we push the new status when the status of the SyncEngine
    changed. SyncEngine::started comes a bit late, only when the propagation
    starts, although it's better in this case since child folders will
    only switch to Sync in aboutToPropagate.
    
    Also fix an issue with SyncEngine::findSyncItem when using an empty
    fileName; this would match and return the wrong item, even though
    not currently happening with the code since fileStatus won't call
    it with an empty fileName anymore.
---
 src/libsync/syncengine.cpp            |  2 +-
 src/libsync/syncfilestatustracker.cpp | 14 ++++++++++----
 src/libsync/syncfilestatustracker.h   |  1 +
 3 files changed, 12 insertions(+), 5 deletions(-)

diff --git a/src/libsync/syncengine.cpp b/src/libsync/syncengine.cpp
index fdb9de4..66425cb 100644
--- a/src/libsync/syncengine.cpp
+++ b/src/libsync/syncengine.cpp
@@ -1342,7 +1342,7 @@ SyncFileItem* SyncEngine::findSyncItem(const QString &fileName) const
 {
     Q_FOREACH(const SyncFileItemPtr &item, _syncedItems) {
         // Directories will appear in this list as well, and will get their status set once all children have been propagated
-        if ((item->_file == fileName || item->_renameTarget == fileName))
+        if ((item->_file == fileName || (!item->_renameTarget.isEmpty() && item->_renameTarget == fileName)))
             return item.data();
     }
     return 0;
diff --git a/src/libsync/syncfilestatustracker.cpp b/src/libsync/syncfilestatustracker.cpp
index 6776db5..b9fe454 100644
--- a/src/libsync/syncfilestatustracker.cpp
+++ b/src/libsync/syncfilestatustracker.cpp
@@ -72,11 +72,12 @@ SyncFileStatusTracker::SyncFileStatusTracker(SyncEngine *syncEngine)
     : _syncEngine(syncEngine)
 {
     connect(syncEngine, SIGNAL(aboutToPropagate(SyncFileItemVector&)),
-              this, SLOT(slotAboutToPropagate(SyncFileItemVector&)));
+            SLOT(slotAboutToPropagate(SyncFileItemVector&)));
     connect(syncEngine, SIGNAL(itemCompleted(const SyncFileItem&, const PropagatorJob&)),
-            this, SLOT(slotItemCompleted(const SyncFileItem&)));
-    connect(syncEngine, SIGNAL(started()),
-            SLOT(slotClearDirtyPaths()));
+            SLOT(slotItemCompleted(const SyncFileItem&)));
+    connect(syncEngine, SIGNAL(started()), SLOT(slotClearDirtyPaths()));
+    connect(syncEngine, SIGNAL(started()), SLOT(slotSyncEngineRunningChanged()));
+    connect(syncEngine, SIGNAL(finished(bool)), SLOT(slotSyncEngineRunningChanged()));
 }
 
 SyncFileStatus SyncFileStatusTracker::rootStatus()
@@ -213,6 +214,11 @@ void SyncFileStatusTracker::slotItemCompleted(const SyncFileItem &item)
     emit fileStatusChanged(getSystemDestination(item), fileStatus(item));
 }
 
+void SyncFileStatusTracker::slotSyncEngineRunningChanged()
+{
+    emit fileStatusChanged(_syncEngine->localPath(), rootStatus());
+}
+
 void SyncFileStatusTracker::slotClearDirtyPaths()
 {
     // We just assume that during a sync all dirty statuses will be resolved
diff --git a/src/libsync/syncfilestatustracker.h b/src/libsync/syncfilestatustracker.h
index 7aa4617..6819794 100644
--- a/src/libsync/syncfilestatustracker.h
+++ b/src/libsync/syncfilestatustracker.h
@@ -46,6 +46,7 @@ signals:
 private slots:
     void slotAboutToPropagate(SyncFileItemVector& items);
     void slotItemCompleted(const SyncFileItem& item);
+    void slotSyncEngineRunningChanged();
     void slotClearDirtyPaths();
 
 private:

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-owncloud/owncloud-client.git



More information about the Pkg-owncloud-commits mailing list