[Pkg-owncloud-commits] [owncloud-client] 208/484: SyncEngine: Don't whipe the white list if the sync was aborted

Sandro Knauß hefee-guest at moszumanska.debian.org
Wed Dec 16 00:37:43 UTC 2015


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 c3cf6aef7dbafb9133903b52c5919eccd4821a25
Author: Olivier Goffart <ogoffart at woboq.com>
Date:   Thu Oct 29 16:43:30 2015 +0100

    SyncEngine:  Don't whipe the white list if the sync was aborted
    
    Issue #4018
---
 src/cmd/cmd.cpp            |  2 +-
 src/gui/folder.cpp         |  6 +++---
 src/gui/folder.h           |  2 +-
 src/libsync/syncengine.cpp | 20 ++++++++++----------
 src/libsync/syncengine.h   |  4 ++--
 5 files changed, 17 insertions(+), 17 deletions(-)

diff --git a/src/cmd/cmd.cpp b/src/cmd/cmd.cpp
index 98a8165..0ac5138 100644
--- a/src/cmd/cmd.cpp
+++ b/src/cmd/cmd.cpp
@@ -447,7 +447,7 @@ restart_sync:
     }
 
     SyncEngine engine(account, _csync_ctx, options.source_dir, QUrl(options.target_url).path(), folder, &db);
-    QObject::connect(&engine, SIGNAL(finished()), &app, SLOT(quit()));
+    QObject::connect(&engine, SIGNAL(finished(bool)), &app, SLOT(quit()));
     QObject::connect(&engine, SIGNAL(transmissionProgress(ProgressInfo)), &cmd, SLOT(transmissionProgressSlot()));
 
     // Have to be done async, else, an error before exec() does not terminate the event loop.
diff --git a/src/gui/folder.cpp b/src/gui/folder.cpp
index 75d635f..72ab2ea 100644
--- a/src/gui/folder.cpp
+++ b/src/gui/folder.cpp
@@ -887,7 +887,7 @@ void Folder::startSync(const QStringList &pathList)
               this, SLOT(slotAboutToPropagate(SyncFileItemVector&)));
 
     connect(_engine.data(), SIGNAL(started()),  SLOT(slotSyncStarted()), Qt::QueuedConnection);
-    connect(_engine.data(), SIGNAL(finished()), SLOT(slotSyncFinished()), Qt::QueuedConnection);
+    connect(_engine.data(), SIGNAL(finished(bool)), SLOT(slotSyncFinished(bool)), Qt::QueuedConnection);
     connect(_engine.data(), SIGNAL(csyncError(QString)), SLOT(slotSyncError(QString)), Qt::QueuedConnection);
     connect(_engine.data(), SIGNAL(csyncUnavailable()), SLOT(slotCsyncUnavailable()), Qt::QueuedConnection);
 
@@ -959,7 +959,7 @@ void Folder::slotCsyncUnavailable()
     _csyncUnavail = true;
 }
 
-void Folder::slotSyncFinished()
+void Folder::slotSyncFinished(bool success)
 {
     qDebug() << " - client version" << qPrintable(Theme::instance()->version())
              <<  " Qt" << qVersion()
@@ -1017,7 +1017,7 @@ void Folder::slotSyncFinished()
         qDebug() << "the last" << _consecutiveFailingSyncs << "syncs failed";
     }
 
-    if (_syncResult.status() == SyncResult::Success) {
+    if (_syncResult.status() == SyncResult::Success && success) {
         // Clear the white list as all the folders that should be on that list are sync-ed
         journalDb()->setSelectiveSyncList(SyncJournalDb::SelectiveSyncWhiteList, QStringList());
     }
diff --git a/src/gui/folder.h b/src/gui/folder.h
index 2734603..edc27d3 100644
--- a/src/gui/folder.h
+++ b/src/gui/folder.h
@@ -251,7 +251,7 @@ private slots:
     void slotSyncStarted();
     void slotSyncError(const QString& );
     void slotCsyncUnavailable();
-    void slotSyncFinished();
+    void slotSyncFinished(bool);
 
     void slotFolderDiscovered(bool local, QString folderName);
     void slotTransmissionProgress(const ProgressInfo& pi);
diff --git a/src/libsync/syncengine.cpp b/src/libsync/syncengine.cpp
index 2a56173..9bdf2cf 100644
--- a/src/libsync/syncengine.cpp
+++ b/src/libsync/syncengine.cpp
@@ -572,7 +572,7 @@ void SyncEngine::handleSyncError(CSYNC *ctx, const char *state) {
     } else {
         emit csyncError(errStr);
     }
-    finalize();
+    finalize(false);
 }
 
 void SyncEngine::startSync()
@@ -598,7 +598,7 @@ void SyncEngine::startSync()
     if (!QDir(_localPath).exists()) {
         // No _tr, it should only occur in non-mirall
         emit csyncError("Unable to find local sync folder.");
-        finalize();
+        finalize(false);
         return;
     }
 
@@ -612,7 +612,7 @@ void SyncEngine::startSync()
             emit csyncError(tr("Only %1 are available, need at least %2 to start").arg(
                                 Utility::octetsToString(freeBytes),
                                 Utility::octetsToString(minFree)));
-            finalize();
+            finalize(false);
             return;
         }
     } else {
@@ -643,7 +643,7 @@ void SyncEngine::startSync()
     if( fileRecordCount == -1 ) {
         qDebug() << "No way to create a sync journal!";
         emit csyncError(tr("Unable to initialize a sync journal."));
-        finalize();
+        finalize(false);
         return;
         // database creation error!
     }
@@ -721,7 +721,7 @@ void SyncEngine::slotDiscoveryJobFinished(int discoveryResult)
     if (!_journal->isConnected()) {
         qDebug() << "Bailing out, DB failure";
         emit csyncError(tr("Cannot open the sync journal"));
-        finalize();
+        finalize(false);
         return;
     } else {
         // Commits a possibly existing (should not though) transaction and starts a new one for the propagate phase
@@ -785,7 +785,7 @@ void SyncEngine::slotDiscoveryJobFinished(int discoveryResult)
         emit aboutToRemoveAllFiles(_syncedItems.first()->_direction, &cancel);
         if (cancel) {
             qDebug() << Q_FUNC_INFO << "Abort sync";
-            finalize();
+            finalize(false);
             return;
         }
     }
@@ -833,7 +833,7 @@ void SyncEngine::slotDiscoveryJobFinished(int discoveryResult)
 void SyncEngine::slotCleanPollsJobAborted(const QString &error)
 {
     csyncError(error);
-    finalize();
+    finalize(false);
 }
 
 void SyncEngine::setNetworkLimits(int upload, int download)
@@ -888,10 +888,10 @@ void SyncEngine::slotFinished()
 
     _journal->commit("All Finished.", false);
     emit treeWalkResult(_syncedItems);
-    finalize();
+    finalize(true); // FIXME: should it be true if there was errors?
 }
 
-void SyncEngine::finalize()
+void SyncEngine::finalize(bool success)
 {
     _thread.quit();
     _thread.wait();
@@ -902,7 +902,7 @@ void SyncEngine::finalize()
     _stopWatch.stop();
 
     _syncRunning = false;
-    emit finished();
+    emit finished(success);
 
     // Delete the propagator only after emitting the signal.
     _propagator.clear();
diff --git a/src/libsync/syncengine.h b/src/libsync/syncengine.h
index 5ba371b..e0f40b5 100644
--- a/src/libsync/syncengine.h
+++ b/src/libsync/syncengine.h
@@ -109,7 +109,7 @@ signals:
 
     void transmissionProgress( const ProgressInfo& progress );
 
-    void finished();
+    void finished(bool success);
     void started();
 
     void aboutToRemoveAllFiles(SyncFileItem::Direction direction, bool *cancel);
@@ -144,7 +144,7 @@ private:
     void deleteStaleErrorBlacklistEntries();
 
     // cleanup and emit the finished signal
-    void finalize();
+    void finalize(bool success);
 
     static bool _syncRunning; //true when one sync is running somewhere (for debugging)
 

-- 
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