From 691019c6b5150a19bf4fdd20829c2e97f143b383 Mon Sep 17 00:00:00 2001 From: Jamie Newbon Date: Thu, 27 Feb 2020 00:40:58 +0000 Subject: [PATCH] #6538 Fixed missing setting and added function to remove repetitions --- src/gui/src/AppConfig.cpp | 14 +++++++++----- src/gui/src/AppConfig.h | 2 ++ 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/src/gui/src/AppConfig.cpp b/src/gui/src/AppConfig.cpp index 0203c8c56..5aceca0f5 100644 --- a/src/gui/src/AppConfig.cpp +++ b/src/gui/src/AppConfig.cpp @@ -61,11 +61,10 @@ const char* AppConfig::m_SynergySettingsName[] = { "lastExpiringWarningTime", "activationHasRun", "minimizeToTray", + "ActivateEmail", "loadFromSystemScope" }; - - static const char* logLevelNames[] = { "INFO", @@ -251,6 +250,7 @@ void AppConfig::saveSettings() setSetting(LastExpireWarningTime, m_LastExpiringWarningTime); setSetting(ActivationHasRun, m_ActivationHasRun); setSetting(MinimizeToTray, m_MinimizeToTray); + setSetting(LoadSystemSettings, m_LoadFromSystemScope); settings().sync(); } @@ -383,7 +383,7 @@ QVariant AppConfig::loadSetting(AppConfig::Setting name, const QVariant& default } AppConfig::SaveChoice AppConfig::checkGlobalSave() { - if (settings().scope() == QSettings::Scope::SystemScope) { + if (isSystemScoped()) { QMessageBox query; query.setWindowTitle(tr("Save global settings.")); @@ -423,14 +423,14 @@ void AppConfig::switchToGlobal(bool global) { } void AppConfig::setLoadFromSystemScope(bool value) { - if (value && settings().scope() == QSettings::UserScope) + if (value && !isSystemScoped()) { m_LoadFromSystemScope = value; saveSettings(); //Save user prefs switchToGlobal(); //Switch the the System Scope loadSettings(); //Load the settings. } - else if (!value && settings().scope() == QSettings::SystemScope) + else if (!value && isSystemScoped()) { switchToGlobal(false); // Switch to UserScope loadSettings(true); // Load user settings ignoring System scope setting @@ -438,3 +438,7 @@ void AppConfig::setLoadFromSystemScope(bool value) { saveSettings(); // Save user prefs } } + +bool AppConfig::isSystemScoped() const { + return m_pSettings->scope() == QSettings::SystemScope; +} diff --git a/src/gui/src/AppConfig.h b/src/gui/src/AppConfig.h index 3adf7169e..83e02fa97 100644 --- a/src/gui/src/AppConfig.h +++ b/src/gui/src/AppConfig.h @@ -75,6 +75,8 @@ class AppConfig: public QObject /// @return The scoped setting currently selected QSettings& settings(); + bool isSystemScoped() const; + const QString& screenName() const; int port() const; const QString& networkInterface() const;