From 23dc03f734b11c901172d849c390e3b119500095 Mon Sep 17 00:00:00 2001 From: Marco Martin Date: Tue, 15 Jan 2019 15:07:11 +0100 Subject: [PATCH] support decorations from lookandfeel Summary: the Lookand Feel kcm already applies decorations to kwin, allow to read them as defaults for the case of distribution customization where a different lnf with a different deco is wanted Test Plan: tested to start kwin with a different lnf which loads an aurorae decoration Reviewers: #plasma, #kwin, davidedmundson Reviewed By: #plasma, #kwin, davidedmundson Subscribers: davidedmundson, kwin Tags: #kwin Differential Revision: https://phabricator.kde.org/D18261 --- decorations/decorationbridge.cpp | 17 ++++++++++++++--- decorations/decorationbridge.h | 4 ++++ 2 files changed, 18 insertions(+), 3 deletions(-) diff --git a/decorations/decorationbridge.cpp b/decorations/decorationbridge.cpp index 5afdbdfbf4..e1a00f9434 100644 --- a/decorations/decorationbridge.cpp +++ b/decorations/decorationbridge.cpp @@ -68,6 +68,11 @@ DecorationBridge::DecorationBridge(QObject *parent) , m_settings() , m_noPlugin(false) { + KConfigGroup cg(KSharedConfig::openConfig(), "KDE"); + + // try to extract the proper defaults file from a lookandfeel package + const QString looknfeel = cg.readEntry(QStringLiteral("LookAndFeelPackage"), "org.kde.breeze.desktop"); + m_lnfConfig = KSharedConfig::openConfig(QStandardPaths::locate(QStandardPaths::GenericDataLocation, QStringLiteral("plasma/look-and-feel/") + looknfeel + QStringLiteral("/contents/defaults"))); } DecorationBridge::~DecorationBridge() @@ -75,9 +80,12 @@ DecorationBridge::~DecorationBridge() s_self = nullptr; } -static QString readPlugin() +QString DecorationBridge::readPlugin() { - return kwinApp()->config()->group(s_pluginName).readEntry("library", s_defaultPlugin); + //Try to get a default from look and feel + KConfigGroup cg(m_lnfConfig, "kwinrc"); + cg = KConfigGroup(&cg, "org.kde.kdecoration2"); + return kwinApp()->config()->group(s_pluginName).readEntry("library", cg.readEntry("library", s_defaultPlugin)); } static bool readNoPlugin() @@ -87,7 +95,10 @@ static bool readNoPlugin() QString DecorationBridge::readTheme() const { - return kwinApp()->config()->group(s_pluginName).readEntry("theme", m_defaultTheme); + //Try to get a default from look and feel + KConfigGroup cg(m_lnfConfig, "kwinrc"); + cg = KConfigGroup(&cg, "org.kde.kdecoration2"); + return kwinApp()->config()->group(s_pluginName).readEntry("theme", cg.readEntry("theme", m_defaultTheme)); } void DecorationBridge::init() diff --git a/decorations/decorationbridge.h b/decorations/decorationbridge.h index e729528fd5..db0d7940df 100644 --- a/decorations/decorationbridge.h +++ b/decorations/decorationbridge.h @@ -24,6 +24,8 @@ along with this program. If not, see . #include +#include + #include #include @@ -68,11 +70,13 @@ public: QString supportInformation() const; private: + QString readPlugin(); void loadMetaData(const QJsonObject &object); void findTheme(const QVariantMap &map); void initPlugin(); QString readTheme() const; KPluginFactory *m_factory; + KSharedConfig::Ptr m_lnfConfig; bool m_blur; QString m_plugin; QString m_defaultTheme;