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
This commit is contained in:
parent
7c15bc7765
commit
23dc03f734
2 changed files with 18 additions and 3 deletions
|
@ -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()
|
||||
|
|
|
@ -24,6 +24,8 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||
|
||||
#include <KDecoration2/Private/DecorationBridge>
|
||||
|
||||
#include <KSharedConfig>
|
||||
|
||||
#include <QObject>
|
||||
#include <QSharedPointer>
|
||||
|
||||
|
@ -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;
|
||||
|
|
Loading…
Reference in a new issue