X-Git-Url: https://git.quassel-irc.org/?p=quassel.git;a=blobdiff_plain;f=src%2Fcommon%2Fsettings.cpp;h=2d79ffe3767bf0c269f8665fc8b5e2847e211d17;hp=c3713d9c1a17d8eae31d0af0f6b5262a8c97af52;hb=aec9c711900a443bfa7860fa86c6e9c86b81a3e7;hpb=424eddc71def51d22ec9f19d6a57c06af0d25295 diff --git a/src/common/settings.cpp b/src/common/settings.cpp index c3713d9c..2d79ffe3 100644 --- a/src/common/settings.cpp +++ b/src/common/settings.cpp @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2005-2016 by the Quassel Project * + * Copyright (C) 2005-2018 by the Quassel Project * * devel@quassel-irc.org * * * * This program is free software; you can redistribute it and/or modify * @@ -120,11 +120,25 @@ void Settings::setVersionMinor(const uint versionMinor) s.setValue("Config/VersionMinor", versionMinor); } + +bool Settings::sync() { + create_qsettings; + s.sync(); + switch (s.status()) { + case QSettings::NoError: + return true; + default: + return false; + } +} + + bool Settings::isWritable() { create_qsettings; return s.isWritable(); } + QStringList Settings::allLocalKeys() { create_qsettings; @@ -189,6 +203,7 @@ const QVariant &Settings::localValue(const QString &key, const QVariant &def) return cacheValue(normKey); } + bool Settings::localKeyExists(const QString &key) { QString normKey = normalizedKey(group, key); @@ -207,6 +222,10 @@ void Settings::removeLocalKey(const QString &key) s.remove(key); s.endGroup(); QString normKey = normalizedKey(group, key); - if (isCached(normKey)) + if (isCached(normKey)) { settingsCache.remove(normKey); + } + if (hasNotifier(normKey)) { + emit notifier(normKey)->valueChanged({}); + } }