From c9122283cc652b953cbfc2cdea47902b9f20eea2 Mon Sep 17 00:00:00 2001 From: jan Iversen Date: Wed, 12 Sep 2018 13:50:24 +0200 Subject: [PATCH] mobile-widgets: replace qmlprefs::theme with qPrefDisplay::theme Shortcut and use qPrefDisplay::theme() direct Signed-off-by: Jan Iversen --- mobile-widgets/qml/Settings.qml | 9 +++------ mobile-widgets/qml/main.qml | 2 +- mobile-widgets/qmlprefs.cpp | 13 ------------- mobile-widgets/qmlprefs.h | 8 -------- 4 files changed, 4 insertions(+), 28 deletions(-) diff --git a/mobile-widgets/qml/Settings.qml b/mobile-widgets/qml/Settings.qml index 68562a871..9f6f1f8cb 100644 --- a/mobile-widgets/qml/Settings.qml +++ b/mobile-widgets/qml/Settings.qml @@ -139,8 +139,7 @@ Kirigami.ScrollablePage { enabled: subsurfaceTheme.currentTheme !== "Blue" onClicked: { blueTheme() - prefs.theme = subsurfaceTheme.currentTheme - manager.savePreferences() + PrefDisplay.theme = subsurfaceTheme.currentTheme } } @@ -192,8 +191,7 @@ Kirigami.ScrollablePage { enabled: subsurfaceTheme.currentTheme !== "Pink" onClicked: { pinkTheme() - prefs.theme = subsurfaceTheme.currentTheme - manager.savePreferences() + PrefDisplay.theme = subsurfaceTheme.currentTheme } } @@ -244,8 +242,7 @@ Kirigami.ScrollablePage { enabled: subsurfaceTheme.currentTheme !== "Dark" onClicked: { darkTheme() - prefs.theme = subsurfaceTheme.currentTheme - manager.savePreferences() + PrefDisplay.theme = subsurfaceTheme.currentTheme } } } diff --git a/mobile-widgets/qml/main.qml b/mobile-widgets/qml/main.qml index bdd3335e3..b20ff4d2b 100644 --- a/mobile-widgets/qml/main.qml +++ b/mobile-widgets/qml/main.qml @@ -506,7 +506,7 @@ if you have network connectivity and want to sync your data to cloud storage."), property int columnWidth: Math.round(rootItem.width/(Kirigami.Units.gridUnit*28)) > 0 ? Math.round(rootItem.width / Math.round(rootItem.width/(Kirigami.Units.gridUnit*28))) : rootItem.width Component.onCompleted: { // this needs to pick the theme from persistent preference settings - var theme = prefs.theme + var theme = PrefDisplay.theme if (theme == "Blue") blueTheme() else if (theme == "Pink") diff --git a/mobile-widgets/qmlprefs.cpp b/mobile-widgets/qmlprefs.cpp index 3d5a10f4e..1f30f7a7e 100644 --- a/mobile-widgets/qmlprefs.cpp +++ b/mobile-widgets/qmlprefs.cpp @@ -108,19 +108,6 @@ void QMLPrefs::setShowPin(bool enable) emit showPinChanged(); } -const QString QMLPrefs::theme() const -{ - return qPrefDisplay::theme(); -} - -void QMLPrefs::setTheme(QString theme) -{ - qPrefDisplay::set_theme(theme); - emit themeChanged(); -} - - - /*** public slot functions ***/ void QMLPrefs::cancelCredentialsPinSetup() { diff --git a/mobile-widgets/qmlprefs.h b/mobile-widgets/qmlprefs.h index f1d6dea50..99819fd7c 100644 --- a/mobile-widgets/qmlprefs.h +++ b/mobile-widgets/qmlprefs.h @@ -33,10 +33,6 @@ class QMLPrefs : public QObject { MEMBER m_oldStatus WRITE setOldStatus NOTIFY oldStatusChanged) - Q_PROPERTY(QString theme - READ theme - WRITE setTheme - NOTIFY themeChanged) public: QMLPrefs(); ~QMLPrefs(); @@ -61,9 +57,6 @@ public: bool showPin() const; void setShowPin(bool enable); - const QString theme() const; - void setTheme(QString theme); - public slots: void cancelCredentialsPinSetup(); void clearCredentials(); @@ -84,7 +77,6 @@ signals: void credentialStatusChanged(); void oldStatusChanged(); void showPinChanged(); - void themeChanged(); }; #endif