diff options
author | Kitsune Ral <Kitsune-Ral@users.sf.net> | 2019-09-29 17:50:28 +0900 |
---|---|---|
committer | Kitsune Ral <Kitsune-Ral@users.sf.net> | 2019-09-29 17:51:20 +0900 |
commit | be53652eb30edd6e096c172a97609070d1e74746 (patch) | |
tree | 43c50381ad2bc851fd1351bb321ed5d1b8e170d1 /lib/settings.cpp | |
parent | 8f1bfa5c5764e399259c13b260661647363cf5d9 (diff) | |
download | libquotient-be53652eb30edd6e096c172a97609070d1e74746.tar.gz libquotient-be53652eb30edd6e096c172a97609070d1e74746.zip |
Settings: childGroups() should merge legacy and current groups; QMC->QTNT in macros
Because otherwise migrating one group to the current location leads to all other groups suddenly disappearing from Settings view.
Diffstat (limited to 'lib/settings.cpp')
-rw-r--r-- | lib/settings.cpp | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/lib/settings.cpp b/lib/settings.cpp index 3bf61605..0349e699 100644 --- a/lib/settings.cpp +++ b/lib/settings.cpp @@ -49,7 +49,10 @@ bool Settings::contains(const QString& key) const QStringList Settings::childGroups() const { auto l = QSettings::childGroups(); - return !l.isEmpty() ? l : legacySettings.childGroups(); + for (const auto& g: legacySettings.childGroups()) + if (!l.contains(g)) + l.push_back(g); + return l; } void SettingsGroup::setValue(const QString& key, const QVariant& value) @@ -88,11 +91,11 @@ void SettingsGroup::remove(const QString& key) Settings::remove(fullKey); } -QMC_DEFINE_SETTING(AccountSettings, QString, deviceId, "device_id", {}, +QTNT_DEFINE_SETTING(AccountSettings, QString, deviceId, "device_id", {}, setDeviceId) -QMC_DEFINE_SETTING(AccountSettings, QString, deviceName, "device_name", {}, +QTNT_DEFINE_SETTING(AccountSettings, QString, deviceName, "device_name", {}, setDeviceName) -QMC_DEFINE_SETTING(AccountSettings, bool, keepLoggedIn, "keep_logged_in", false, +QTNT_DEFINE_SETTING(AccountSettings, bool, keepLoggedIn, "keep_logged_in", false, setKeepLoggedIn) static const auto HomeserverKey = QStringLiteral("homeserver"); |