summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorElvis Angelaccio <elvis.angelaccio@kde.org>2017-02-13 10:22:03 (GMT)
committerElvis Angelaccio <elvis.angelaccio@kde.org>2017-02-13 10:28:55 (GMT)
commit0a7fafc7e2f455a1c4f7ae9a104abce007374572 (patch)
tree6cbdbbfa4de2a4f6ce5712212466a26bae0963d5
parent4a06c4d34f2dd8859058618b1dbe9dbd6df9e9b8 (diff)
Don't break compatibility with old configs
Summary: Commit 4a06c4d34f doesn't take into account old config files where the value of the key is 'true', breaking the getter for the warps property. Test Plan: Add `gtk-primary-button-warps-slider=true` both in `~/.gtkrc-2.0` and `~/.config/gtk-3.0/settings.ini`; open gtk-config kcm, warps checkbox is now checked as expected. Reviewers: apol Subscribers: plasma-devel Tags: #plasma Differential Revision: https://phabricator.kde.org/D4594
-rw-r--r--src/abstractappearance.cpp7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/abstractappearance.cpp b/src/abstractappearance.cpp
index d67252c..1086729 100644
--- a/src/abstractappearance.cpp
+++ b/src/abstractappearance.cpp
@@ -24,6 +24,11 @@
#include <QDir>
#include <QDebug>
+static bool isTrue(const QString& value)
+{
+ return value == "1" || value == "true";
+}
+
//SETTERS
void AbstractAppearance::setTheme(const QString& name) { m_settings["theme"] = name;}
void AbstractAppearance::setCursor(const QString& cur) { m_settings["cursor"] = cur;}
@@ -45,7 +50,7 @@ QString AbstractAppearance::getThemeGtk3() const { return m_settings["themegtk3"
QString AbstractAppearance::getToolbarStyle() const { return m_settings["toolbar_style"]; }
bool AbstractAppearance::getShowIconsInButtons() const { return m_settings["show_icons_buttons"]=="1"; }
bool AbstractAppearance::getShowIconsInMenus() const { return m_settings["show_icons_menus"]=="1"; }
-bool AbstractAppearance::getPrimaryButtonWarpsSlider() const { return m_settings["primary_button_warps_slider"] == "1"; }
+bool AbstractAppearance::getPrimaryButtonWarpsSlider() const { return isTrue(m_settings["primary_button_warps_slider"]); }
QRegExp valueRx(" *([a-zA-Z\\-_]+) *= *\"?([^\"\\n]+)\"?", Qt::CaseSensitive, QRegExp::RegExp2);
QMap<QString,QString> AbstractAppearance::readSettingsTuples(QIODevice* device)