Skip to content

Commit

Permalink
Configuration Options for Windows Registry
Browse files Browse the repository at this point in the history
Added the configuration  options
        confirmExternalStorage
        crashReporter
        newBigFolderSizeLimit
        useNewBigFolderSizeLimit
    to the Windows registry

Signed-off-by: Marco Hald <marcohald@users.noreply.github.com>
  • Loading branch information
marcohald committed Feb 12, 2021
1 parent 6be88c6 commit 43ed842
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 4 deletions.
17 changes: 13 additions & 4 deletions src/libsync/configfile.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -850,8 +850,9 @@ void ConfigFile::setDownloadLimit(int kbytes)
QPair<bool, qint64> 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<qint64>(0, value));
}

Expand All @@ -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)
Expand Down Expand Up @@ -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)
Expand Down
1 change: 1 addition & 0 deletions src/libsync/configfile.h
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,7 @@ class OWNCLOUDSYNC_EXPORT ConfigFile
/** [checked, size in MB] **/
QPair<bool, qint64> newBigFolderSizeLimit() const;
void setNewBigFolderSizeLimit(bool isChecked, qint64 mbytes);
bool useNewBigFolderSizeLimit() const;
bool confirmExternalStorage() const;
void setConfirmExternalStorage(bool);

Expand Down

0 comments on commit 43ed842

Please sign in to comment.