Cleanup syncengine after the new option not to ask confirmation when everything is...
authorOlivier Goffart <ogoffart@woboq.com>
Mon, 22 Feb 2016 15:14:22 +0000 (16:14 +0100)
committerOlivier Goffart <ogoffart@woboq.com>
Mon, 22 Feb 2016 15:14:22 +0000 (16:14 +0100)
Cleanup after pull reuqest  #4389

Do not make the SyncEngine depends on the ConfigFile

src/gui/folder.cpp
src/libsync/syncengine.cpp

index 04e134e699cd7827effa07e20e81cb83141118e0..0110394313ee003ad430287959f138ef7fe6413f 100644 (file)
@@ -1175,6 +1175,10 @@ void Folder::slotNewBigFolderDiscovered(const QString &newF)
 
 void Folder::slotAboutToRemoveAllFiles(SyncFileItem::Direction, bool *cancel)
 {
+    ConfigFile cfgFile;
+    if (!cfgFile.promptDeleteFiles())
+        return;
+
     QString msg =
         tr("This sync would remove all the files in the sync folder '%1'.\n"
            "This might be because the folder was silently reconfigured, or that all "
index 8f4f2c03cd376a93ec38f19417a9d7ea4cfca9d5..ac3b3ea086e57f2449c5c6601ec528c493ebbc7e 100644 (file)
@@ -23,7 +23,6 @@
 #include "syncfilestatus.h"
 #include "csync_private.h"
 #include "filesystem.h"
-#include "configfile.h"
 
 #ifdef Q_OS_WIN
 #include <windows.h>
@@ -842,9 +841,7 @@ void SyncEngine::slotDiscoveryJobFinished(int discoveryResult)
         }
     }
 
-    // Check the config file before displaying prompt in case it is disabled.
-    ConfigFile cfgFile;
-    if (!_hasNoneFiles && _hasRemoveFile && cfgFile.promptDeleteFiles()) {
+    if (!_hasNoneFiles && _hasRemoveFile) {
         qDebug() << Q_FUNC_INFO << "All the files are going to be changed, asking the user";
         bool cancel = false;
         emit aboutToRemoveAllFiles(_syncedItems.first()->_direction, &cancel);