浏览代码

Merge pull request #1201 from nextcloud/bugfix/popup-empty-folder

Uses configuraion to determine if it should show empty folder popup.
Camila Ayres 6 年之前
父节点
当前提交
ac6ef500cc
共有 3 个文件被更改,包括 8 次插入2 次删除
  1. 1 1
      src/libsync/configfile.cpp
  2. 4 1
      src/libsync/syncengine.cpp
  3. 3 0
      test/testallfilesdeleted.cpp

+ 1 - 1
src/libsync/configfile.cpp

@@ -750,7 +750,7 @@ void ConfigFile::setMoveToTrash(bool isChecked)
 bool ConfigFile::promptDeleteFiles() const
 {
     QSettings settings(configFile(), QSettings::IniFormat);
-    return settings.value(QLatin1String(promptDeleteC), true).toBool();
+    return settings.value(QLatin1String(promptDeleteC), false).toBool();
 }
 
 void ConfigFile::setPromptDeleteFiles(bool promptDeleteFiles)

+ 4 - 1
src/libsync/syncengine.cpp

@@ -26,6 +26,8 @@
 #include "propagateremotedelete.h"
 #include "propagatedownload.h"
 #include "common/asserts.h"
+#include "configfile.h"
+
 
 #ifdef Q_OS_WIN
 #include <windows.h>
@@ -1035,7 +1037,8 @@ void SyncEngine::slotDiscoveryJobFinished(int discoveryResult)
         }
     }
 
-    if (!_hasNoneFiles && _hasRemoveFile) {
+    ConfigFile cfgFile;
+    if (!_hasNoneFiles && _hasRemoveFile && cfgFile.promptDeleteFiles()) {
         qCInfo(lcEngine) << "All the files are going to be changed, asking the user";
         bool cancel = false;
         emit aboutToRemoveAllFiles(syncItems.first()->_direction, &cancel);

+ 3 - 0
test/testallfilesdeleted.cpp

@@ -8,6 +8,7 @@
 #include <QtTest>
 #include "syncenginetestutils.h"
 #include <syncengine.h>
+#include <configfile.h>
 
 using namespace OCC;
 
@@ -48,6 +49,8 @@ private slots:
     {
         QFETCH(bool, deleteOnRemote);
         FakeFolder fakeFolder{FileInfo::A12_B12_C12_S12()};
+        ConfigFile config;
+        config.setPromptDeleteFiles(true);
 
         //Just set a blacklist so we can check it is still there. This directory does not exists but
         // that does not matter for our purposes.