Merge pull request #4389 from Bottswana/deleteprompt

Add option to disable the delete all files prompt
This commit is contained in:
Markus Goetz 2016-02-22 15:44:50 +01:00
commit a76ba06817
3 changed files with 20 additions and 1 deletions

View file

@ -43,6 +43,7 @@ namespace OCC {
static const char remotePollIntervalC[] = "remotePollInterval";
static const char forceSyncIntervalC[] = "forceSyncInterval";
static const char monoIconsC[] = "monoIcons";
static const char promptDeleteC[] = "promptDeleteAllFiles";
static const char crashReporterC[] = "crashReporter";
static const char optionalDesktopNoficationsC[] = "optionalDesktopNotifications";
static const char skipUpdateCheckC[] = "skipUpdateCheck";
@ -590,6 +591,18 @@ void ConfigFile::setNewBigFolderSizeLimit(bool isChecked, quint64 mbytes)
setValue(useNewBigFolderSizeLimitC, isChecked);
}
bool ConfigFile::promptDeleteFiles() const
{
QSettings settings(configFile(), QSettings::IniFormat);
return settings.value(QLatin1String(promptDeleteC), true).toBool();
}
void ConfigFile::setPromptDeleteFiles(bool promptDeleteFiles)
{
QSettings settings(configFile(), QSettings::IniFormat);
settings.setValue(QLatin1String(promptDeleteC), promptDeleteFiles);
}
bool ConfigFile::monoIcons() const
{
QSettings settings(configFile(), QSettings::IniFormat);

View file

@ -69,6 +69,9 @@ public:
bool monoIcons() const;
void setMonoIcons(bool);
bool promptDeleteFiles() const;
void setPromptDeleteFiles(bool promptDeleteFiles);
bool crashReporter() const;
void setCrashReporter(bool enabled);

View file

@ -23,6 +23,7 @@
#include "syncfilestatus.h"
#include "csync_private.h"
#include "filesystem.h"
#include "configfile.h"
#ifdef Q_OS_WIN
#include <windows.h>
@ -841,7 +842,9 @@ void SyncEngine::slotDiscoveryJobFinished(int discoveryResult)
}
}
if (!_hasNoneFiles && _hasRemoveFile) {
// Check the config file before displaying prompt in case it is disabled.
ConfigFile cfgFile;
if (!_hasNoneFiles && _hasRemoveFile && cfgFile.promptDeleteFiles()) {
qDebug() << Q_FUNC_INFO << "All the files are going to be changed, asking the user";
bool cancel = false;
emit aboutToRemoveAllFiles(_syncedItems.first()->_direction, &cancel);