From 43ed8423e5014081bb4b04ca47cb7c80e2d2ea98 Mon Sep 17 00:00:00 2001 From: Marco Hald Date: Fri, 12 Feb 2021 12:23:40 +0100 Subject: [PATCH] Configuration Options for Windows Registry Added the configuration options confirmExternalStorage crashReporter newBigFolderSizeLimit useNewBigFolderSizeLimit to the Windows registry Signed-off-by: Marco Hald --- src/libsync/configfile.cpp | 17 +++++++++++++---- src/libsync/configfile.h | 1 + 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/src/libsync/configfile.cpp b/src/libsync/configfile.cpp index 571c76ccc233a..9eb0014af4ff9 100644 --- a/src/libsync/configfile.cpp +++ b/src/libsync/configfile.cpp @@ -850,8 +850,9 @@ void ConfigFile::setDownloadLimit(int kbytes) QPair ConfigFile::newBigFolderSizeLimit() const { auto defaultValue = Theme::instance()->newBigFolderSizeLimit(); - qint64 value = getValue(newBigFolderSizeLimitC, QString(), defaultValue).toLongLong(); - bool use = value >= 0 && getValue(useNewBigFolderSizeLimitC, QString(), true).toBool(); + const auto fallback = getValue(newBigFolderSizeLimitC, QString(), defaultValue).toLongLong(); + const auto value = getPolicySetting(QLatin1String(newBigFolderSizeLimitC), fallback).toLongLong(); + const bool use = value >= 0 && useNewBigFolderSizeLimit(); return qMakePair(use, qMax(0, value)); } @@ -863,7 +864,14 @@ void ConfigFile::setNewBigFolderSizeLimit(bool isChecked, qint64 mbytes) bool ConfigFile::confirmExternalStorage() const { - return getValue(confirmExternalStorageC, QString(), true).toBool(); + const auto fallback = getValue(confirmExternalStorageC, QString(), true); + return getPolicySetting(QLatin1String(confirmExternalStorageC), fallback).toBool(); +} + +bool ConfigFile::useNewBigFolderSizeLimit() const +{ + const auto fallback = getValue(useNewBigFolderSizeLimitC, QString(), true); + return getPolicySetting(QLatin1String(useNewBigFolderSizeLimitC), fallback).toBool(); } void ConfigFile::setConfirmExternalStorage(bool isChecked) @@ -913,7 +921,8 @@ void ConfigFile::setMonoIcons(bool useMonoIcons) bool ConfigFile::crashReporter() const { QSettings settings(configFile(), QSettings::IniFormat); - return settings.value(QLatin1String(crashReporterC), true).toBool(); + const auto fallback = settings.value(QLatin1String(crashReporterC), true); + return getPolicySetting(QLatin1String(crashReporterC), fallback).toBool(); } void ConfigFile::setCrashReporter(bool enabled) diff --git a/src/libsync/configfile.h b/src/libsync/configfile.h index 043e5342cd11a..cf33d42b43440 100644 --- a/src/libsync/configfile.h +++ b/src/libsync/configfile.h @@ -137,6 +137,7 @@ class OWNCLOUDSYNC_EXPORT ConfigFile /** [checked, size in MB] **/ QPair newBigFolderSizeLimit() const; void setNewBigFolderSizeLimit(bool isChecked, qint64 mbytes); + bool useNewBigFolderSizeLimit() const; bool confirmExternalStorage() const; void setConfirmExternalStorage(bool);