From d14534ba12367df89fb90e7f5d0bb2d853ddf451 Mon Sep 17 00:00:00 2001 From: "Aaron J. Seigo" Date: Mon, 12 May 2008 04:53:13 +0000 Subject: [PATCH] allow using the global theme svn path=/trunk/KDE/kdebase/workspace/libs/plasma/; revision=806696 --- theme.cpp | 31 +++++++++++++++++++++++-------- theme.h | 14 ++++++++++++++ 2 files changed, 37 insertions(+), 8 deletions(-) diff --git a/theme.cpp b/theme.cpp index 49be47e6e..516780385 100644 --- a/theme.cpp +++ b/theme.cpp @@ -47,7 +47,8 @@ public: : q(theme), locolor(false), compositingActive(KWindowSystem::compositingActive()), - isDefault(false) + isDefault(false), + useGlobal(true) { generalFont = QApplication::font(); } @@ -56,11 +57,14 @@ public: { if (!cfg.isValid()) { QString groupName = "Theme"; - QString app = KGlobal::mainComponent().componentName(); - if (!app.isEmpty() && app != "plasma") { - kDebug() << "using theme for app" << app; - groupName.append("-").append(app); + if (!useGlobal) { + QString app = KGlobal::mainComponent().componentName(); + + if (!app.isEmpty() && app != "plasma") { + kDebug() << "using theme for app" << app; + groupName.append("-").append(app); + } } cfg = KConfigGroup(KSharedConfig::openConfig("plasmarc"), groupName); @@ -80,12 +84,13 @@ public: KSharedConfigPtr colors; KConfigGroup cfg; QFont generalFont; - bool locolor; - bool compositingActive; - bool isDefault; #ifdef Q_WS_X11 KSelectionWatcher *compositeWatch; #endif + bool locolor : 1; + bool compositingActive : 1; + bool isDefault : 1; + bool useGlobal : 1; }; PackageStructure::Ptr Theme::Private::packageStructure(0); @@ -299,6 +304,16 @@ bool Theme::windowTranslucencyEnabled() const return d->compositingActive; } +void Theme::setUseGlobalSettings(bool useGlobal) +{ + d->useGlobal = useGlobal; +} + +bool Theme::useGlobalSettings() const +{ + return d->useGlobal; +} + } #include diff --git a/theme.h b/theme.h index dd3e3dfc7..7562e10c1 100644 --- a/theme.h +++ b/theme.h @@ -139,6 +139,20 @@ class PLASMA_EXPORT Theme : public QObject */ Q_INVOKABLE bool windowTranslucencyEnabled() const; + /** + * Tells the theme whether to follow the global settings or use application + * specific settings + * + * @arg useGlobal pass in true to follow the global settings + */ + void setUseGlobalSettings(bool useGlobal); + + /** + * @return true if the global settings are followed, false if application + * specific settings are used. + */ + bool useGlobalSettings() const; + Q_SIGNALS: /** * Emitted when the user changes the theme. SVGs should be reloaded at