Commit 34e2541b authored by Dominic Hayes's avatar Dominic Hayes Committed by Nate Graham
Browse files

kcms/lookandfeel: allow users to choose what part of a Global Theme to apply

Now when you click on a Global Theme, it will display a Kirigami sheet for
choosing what is applied. The user can choose individual appearance elements,
and apply the theme's desktop layout, or not.

BUG: 409015
BUG: 437037
FIXED-IN: 5.25
parent 5da3d758
Pipeline #165550 passed with stage
in 6 minutes and 46 seconds
......@@ -3,6 +3,7 @@
SPDX-FileCopyrightText: 2014 Vishesh Handa <me@vhanda.in>
SPDX-FileCopyrightText: 2019 Cyril Rossi <cyril.rossi@enioka.com>
SPDX-FileCopyrightText: 2021 Benjamin Port <benjamin.port@enioka.com>
SPDX-FileCopyrightText: 2022 Dominic Hayes <ferenosdev@outlook.com>
SPDX-License-Identifier: LGPL-2.0-only
*/
......@@ -60,11 +61,13 @@ KCMLookandFeel::KCMLookandFeel(QObject *parent, const KPluginMetaData &data, con
: KQuickAddons::ManagedConfigModule(parent, data, args)
, m_lnf(new LookAndFeelManager(this))
{
constexpr char uri[] = "org.kde.private.kcms.lookandfeel";
qmlRegisterAnonymousType<LookAndFeelSettings>("", 1);
qmlRegisterAnonymousType<QStandardItemModel>("", 1);
qmlRegisterAnonymousType<KCMLookandFeel>("", 1);
qmlRegisterUncreatableType<KCMLookandFeel>(uri, 1, 0, "KCMLookandFeel", "Can't create KCMLookandFeel");
qmlRegisterUncreatableType<LookAndFeelManager>(uri, 1, 0, "LookandFeelManager", "Can't create LookandFeelManager");
setButtons(Apply | Default);
setButtons(Default);
m_model = new QStandardItemModel(this);
QHash<int, QByteArray> roles = m_model->roleNames();
......@@ -76,7 +79,8 @@ KCMLookandFeel::KCMLookandFeel(QObject *parent, const KPluginMetaData &data, con
roles[HasLockScreenRole] = "hasLockScreen";
roles[HasRunCommandRole] = "hasRunCommand";
roles[HasLogoutRole] = "hasLogout";
roles[HasGlobalThemeRole] = "hasGlobalTheme"; //For the Global Theme global checkbox
roles[HasDesktopLayoutRole] = "hasDesktopLayout"; //For the Desktop Layout checkbox in More Options
roles[HasColorsRole] = "hasColors";
roles[HasWidgetStyleRole] = "hasWidgetStyle";
roles[HasIconsRole] = "hasIcons";
......@@ -84,12 +88,14 @@ KCMLookandFeel::KCMLookandFeel(QObject *parent, const KPluginMetaData &data, con
roles[HasCursorsRole] = "hasCursors";
roles[HasWindowSwitcherRole] = "hasWindowSwitcher";
roles[HasDesktopSwitcherRole] = "hasDesktopSwitcher";
roles[HasWindowDecorationRole] = "hasWindowDecoration";
roles[HasFontsRole] = "hasFonts";
m_model->setItemRoleNames(roles);
loadModel();
connect(m_lnf, &LookAndFeelManager::resetDefaultLayoutChanged, this, [this] {
Q_EMIT resetDefaultLayoutChanged();
settingsChanged();
});
connect(m_lnf, &LookAndFeelManager::appearanceToApplyChanged, this, &KCMLookandFeel::appearanceToApplyChanged);
connect(m_lnf, &LookAndFeelManager::layoutToApplyChanged, this, &KCMLookandFeel::layoutToApplyChanged);
connect(m_lnf, &LookAndFeelManager::refreshServices, this, [](const QStringList &toStop, const QList<KService::Ptr> &toStart) {
for (const auto &serviceName : toStop) {
......@@ -238,6 +244,8 @@ void KCMLookandFeel::addKPackageToModel(const KPackage::Package &pkg)
row->setData(pkg.filePath("fullscreenpreview"), FullScreenPreviewRole);
// What the package provides
row->setData(!pkg.filePath("defaults").isEmpty(), HasGlobalThemeRole);
row->setData(!pkg.filePath("layouts").isEmpty(), HasDesktopLayoutRole);
row->setData(!pkg.filePath("splashmainscript").isEmpty(), HasSplashRole);
row->setData(!pkg.filePath("lockscreenmainscript").isEmpty(), HasLockScreenRole);
row->setData(!pkg.filePath("runcommandmainscript").isEmpty(), HasRunCommandRole);
......@@ -252,13 +260,16 @@ void KCMLookandFeel::addKPackageToModel(const KPackage::Package &pkg)
hasColors = !pkg.filePath("colors").isEmpty();
}
row->setData(hasColors, HasColorsRole);
cg = KConfigGroup(conf, "kdeglobals");
cg = KConfigGroup(&cg, "KDE");
row->setData(!cg.readEntry("widgetStyle", QString()).isEmpty(), HasWidgetStyleRole);
cg = KConfigGroup(conf, "kdeglobals");
cg = KConfigGroup(&cg, "Icons");
row->setData(!cg.readEntry("Theme", QString()).isEmpty(), HasIconsRole);
cg = KConfigGroup(conf, "kdeglobals");
cg = KConfigGroup(conf, "plasmarc");
cg = KConfigGroup(&cg, "Theme");
row->setData(!cg.readEntry("name", QString()).isEmpty(), HasPlasmaThemeRole);
......@@ -273,6 +284,29 @@ void KCMLookandFeel::addKPackageToModel(const KPackage::Package &pkg)
cg = KConfigGroup(conf, "kwinrc");
cg = KConfigGroup(&cg, "DesktopSwitcher");
row->setData(!cg.readEntry("LayoutName", QString()).isEmpty(), HasDesktopSwitcherRole);
cg = KConfigGroup(conf, "kwinrc");
cg = KConfigGroup(&cg, "org.kde.kdecoration2");
row->setData(!cg.readEntry("library", QString()).isEmpty(), HasWindowDecorationRole);
cg = KConfigGroup(conf, "kdeglobals");
KConfigGroup cg2(&cg, "WM"); //for checking activeFont
cg = KConfigGroup(&cg, "General");
row->setData((!cg.readEntry("font", QString()).isEmpty() || !cg.readEntry("fixed", QString()).isEmpty() ||
!cg.readEntry("smallestReadableFont", QString()).isEmpty() ||
!cg.readEntry("toolBarFont", QString()).isEmpty() || !cg.readEntry("menuFont", QString()).isEmpty() ||
!cg2.readEntry("activeFont", QString()).isEmpty()), HasFontsRole);
} else {
//This fallback is needed since the sheet 'breaks' without it
row->setData(false, HasColorsRole);
row->setData(false, HasWidgetStyleRole);
row->setData(false, HasIconsRole);
row->setData(false, HasPlasmaThemeRole);
row->setData(false, HasCursorsRole);
row->setData(false, HasWindowSwitcherRole);
row->setData(false, HasDesktopSwitcherRole);
row->setData(false, HasWindowDecorationRole);
row->setData(false, HasFontsRole);
}
m_model->appendRow(row);
......@@ -280,7 +314,7 @@ void KCMLookandFeel::addKPackageToModel(const KPackage::Package &pkg)
bool KCMLookandFeel::isSaveNeeded() const
{
return m_lnf->resetDefaultLayout() || lookAndFeelSettings()->isSaveNeeded();
return lookAndFeelSettings()->isSaveNeeded();
}
void KCMLookandFeel::load()
......@@ -288,7 +322,6 @@ void KCMLookandFeel::load()
ManagedConfigModule::load();
m_package = KPackage::PackageLoader::self()->loadPackage(QStringLiteral("Plasma/LookAndFeel"), lookAndFeelSettings()->lookAndFeelPackage());
m_lnf->setResetDefaultLayout(false);
}
void KCMLookandFeel::save()
......@@ -301,36 +334,101 @@ void KCMLookandFeel::save()
return;
}
{
const int index = pluginIndex(lookAndFeelSettings()->lookAndFeelPackage());
auto applyFlags = m_lnf->appearanceToApply();
// Disable unavailable flags to prevent unintentional applies
// TODO: Also do for LayoutSettings once layout options get added besides just Desktop Layout
constexpr std::array appearancePairs {
std::make_pair(LookAndFeelManager::Colors, HasColorsRole),
std::make_pair(LookAndFeelManager::WindowDecoration, HasWindowDecorationRole),
std::make_pair(LookAndFeelManager::Icons, HasIconsRole),
std::make_pair(LookAndFeelManager::PlasmaTheme, HasPlasmaThemeRole),
std::make_pair(LookAndFeelManager::Cursors, HasCursorsRole),
std::make_pair(LookAndFeelManager::Fonts, HasFontsRole),
std::make_pair(LookAndFeelManager::WindowSwitcher, HasWindowSwitcherRole),
std::make_pair(LookAndFeelManager::SplashScreen, HasSplashRole),
std::make_pair(LookAndFeelManager::LockScreen, HasLockScreenRole),
};
for (const auto &pair : appearancePairs) {
if ( m_lnf->appearanceToApply().testFlag(pair.first) ) {
applyFlags.setFlag(pair.first, m_model->data(m_model->index(index, 0), pair.second).toBool());
}
}
if ( m_lnf->appearanceToApply().testFlag(LookAndFeelManager::WidgetStyle) ) {
// Some global themes use styles that may not be installed.
// Test if style can be installed before updating the config.
KSharedConfigPtr conf = KSharedConfig::openConfig(package.filePath("defaults"));
KConfigGroup cg(conf, "kdeglobals");
QScopedPointer<QStyle> newStyle(QStyleFactory::create(cg.readEntry("widgetStyle", QString())));
m_lnf->setApplyWidgetStyle(!newStyle.isNull());
applyFlags.setFlag(LookAndFeelManager::WidgetStyle, (!newStyle.isNull() &&
m_model->data(m_model->index(index, 0), HasWidgetStyleRole).toBool())); //Widget Style isn't in
// the loop above since it has all of this extra checking too for it
}
m_lnf->setAppearanceToApply(applyFlags);
ManagedConfigModule::save();
m_lnf->save(package, m_package);
m_package.setPath(newLnfPackage);
runRdb(KRdbExportQtColors | KRdbExportGtkTheme | KRdbExportColors | KRdbExportQtSettings | KRdbExportXftSettings);
setResetDefaultLayout(false);
}
void KCMLookandFeel::defaults()
{
m_lnf->setResetDefaultLayout(false);
ManagedConfigModule::defaults();
Q_EMIT showConfirmation();
}
LookAndFeelManager::AppearanceToApply KCMLookandFeel::appearanceToApply() const
{
return m_lnf->appearanceToApply();
}
void KCMLookandFeel::setAppearanceToApply(LookAndFeelManager::AppearanceToApply items)
{
m_lnf->setAppearanceToApply(items);
}
void KCMLookandFeel::resetAppearanceToApply()
{
const int index = pluginIndex(lookAndFeelSettings()->lookAndFeelPackage());
auto applyFlags = appearanceToApply();
applyFlags.setFlag(LookAndFeelManager::AppearanceSettings, m_model->data(m_model->index(index, 0), HasGlobalThemeRole).toBool());
m_lnf->setAppearanceToApply(applyFlags); //emits over in lookandfeelmananager
}
void KCMLookandFeel::setResetDefaultLayout(bool reset)
LookAndFeelManager::LayoutToApply KCMLookandFeel::layoutToApply() const
{
m_lnf->setResetDefaultLayout(reset);
return m_lnf->layoutToApply();
}
bool KCMLookandFeel::resetDefaultLayout() const
void KCMLookandFeel::setLayoutToApply(LookAndFeelManager::LayoutToApply items)
{
return m_lnf->resetDefaultLayout();
m_lnf->setLayoutToApply(items);
}
void KCMLookandFeel::resetLayoutToApply()
{
const int index = pluginIndex(lookAndFeelSettings()->lookAndFeelPackage());
auto applyFlags = layoutToApply();
if (m_model->data(m_model->index(index, 0), HasGlobalThemeRole).toBool()) {
m_lnf->setLayoutToApply({}); // Don't enable by default if Global Theme is available
return;
}
constexpr std::array layoutPairs {
std::make_pair(LookAndFeelManager::DesktopLayout, HasDesktopLayoutRole),
std::make_pair(LookAndFeelManager::WindowPlacement, HasDesktopLayoutRole),
std::make_pair(LookAndFeelManager::ShellPackage, HasDesktopLayoutRole),
std::make_pair(LookAndFeelManager::DesktopSwitcher, HasDesktopLayoutRole),
}; //NOTE: Items that have their own Has...Role instead will be added soon
for (const auto &pair : layoutPairs) {
applyFlags.setFlag(pair.first, m_model->data(m_model->index(index, 0), pair.second).toBool());
}
m_lnf->setLayoutToApply(applyFlags); //emits over in lookandfeelmananager
}
QDir KCMLookandFeel::cursorThemeDir(const QString &theme, const int depth)
......
......@@ -3,6 +3,7 @@
SPDX-FileCopyrightText: 2014 Vishesh Handa <me@vhanda.in>
SPDX-FileCopyrightText: 2019 Cyril Rossi <cyril.rossi@enioka.com>
SPDX-FileCopyrightText: 2021 Benjamin Port <benjamin.port@enioka.com>
SPDX-FileCopyrightText: 2022 Dominic Hayes <ferenosdev@outlook.com>
SPDX-License-Identifier: LGPL-2.0-only
*/
......@@ -21,6 +22,7 @@
#include <KQuickAddons/ManagedConfigModule>
#include "lookandfeelsettings.h"
#include "lookandfeelmanager.h"
class QQuickItem;
class LookAndFeelManager;
......@@ -30,7 +32,8 @@ class KCMLookandFeel : public KQuickAddons::ManagedConfigModule
Q_OBJECT
Q_PROPERTY(LookAndFeelSettings *lookAndFeelSettings READ lookAndFeelSettings CONSTANT)
Q_PROPERTY(QStandardItemModel *lookAndFeelModel READ lookAndFeelModel CONSTANT)
Q_PROPERTY(bool resetDefaultLayout READ resetDefaultLayout WRITE setResetDefaultLayout NOTIFY resetDefaultLayoutChanged)
Q_PROPERTY(LookAndFeelManager::AppearanceToApply appearanceToApply READ appearanceToApply WRITE setAppearanceToApply NOTIFY appearanceToApplyChanged RESET resetAppearanceToApply)
Q_PROPERTY(LookAndFeelManager::LayoutToApply layoutToApply READ layoutToApply WRITE setLayoutToApply NOTIFY layoutToApplyChanged RESET resetLayoutToApply)
public:
enum Roles {
......@@ -42,6 +45,8 @@ public:
HasLockScreenRole,
HasRunCommandRole,
HasLogoutRole,
HasGlobalThemeRole,
HasDesktopLayoutRole,
HasColorsRole,
HasWidgetStyleRole,
HasIconsRole,
......@@ -49,7 +54,10 @@ public:
HasCursorsRole,
HasWindowSwitcherRole,
HasDesktopSwitcherRole,
HasWindowDecorationRole,
HasFontsRole,
};
Q_ENUM(Roles)
KCMLookandFeel(QObject *parent, const KPluginMetaData &data, const QVariantList &args);
~KCMLookandFeel() override;
......@@ -71,8 +79,13 @@ public:
void addKPackageToModel(const KPackage::Package &pkg);
bool isSaveNeeded() const override;
bool resetDefaultLayout() const;
void setResetDefaultLayout(bool reset);
LookAndFeelManager::AppearanceToApply appearanceToApply() const;
void setAppearanceToApply(LookAndFeelManager::AppearanceToApply items);
void resetAppearanceToApply();
LookAndFeelManager::LayoutToApply layoutToApply() const;
void setLayoutToApply(LookAndFeelManager::LayoutToApply items);
void resetLayoutToApply();
public Q_SLOTS:
void load() override;
......@@ -80,7 +93,9 @@ public Q_SLOTS:
void defaults() override;
Q_SIGNALS:
void resetDefaultLayoutChanged();
void showConfirmation();
void appearanceToApplyChanged();
void layoutToApplyChanged();
private:
// List only packages which provide at least one of the components
......
/*
SPDX-FileCopyrightText: 2017 Marco MArtin <mart@kde.org>
SPDX-FileCopyrightText: 2022 Dominic Hayes <ferenosdev@outlook.com>
SPDX-License-Identifier: GPL-2.0-or-later
*/
......@@ -94,7 +95,12 @@ int main(int argc, char **argv)
KCMLookandFeel *kcm = new KCMLookandFeel(nullptr, KPluginMetaData(), QVariantList());
kcm->load();
kcm->setResetDefaultLayout(parser.isSet(_resetLayout));
if (parser.isSet(_resetLayout)) {
kcm->setLayoutToApply(LookAndFeelManager::LayoutToApply(LookAndFeelManager::LayoutSettings));
} else {
kcm->setLayoutToApply({});
}
kcm->setAppearanceToApply(LookAndFeelManager::AppearanceToApply(LookAndFeelManager::AppearanceSettings));
kcm->lookAndFeelSettings()->setLookAndFeelPackage(requestedTheme);
// Save manually as we aren't in an event loop
kcm->lookAndFeelSettings()->save();
......
......@@ -3,6 +3,7 @@
SPDX-FileCopyrightText: 2014 Vishesh Handa <me@vhanda.in>
SPDX-FileCopyrightText: 2019 Cyril Rossi <cyril.rossi@enioka.com>
SPDX-FileCopyrightText: 2021 Benjamin Port <benjamin.port@enioka.com>
SPDX-FileCopyrightText: 2022 Dominic Hayes <ferenosdev@outlook.com>
SPDX-License-Identifier: LGPL-2.0-only
*/
......@@ -27,18 +28,8 @@
LookAndFeelManager::LookAndFeelManager(QObject *parent)
: QObject(parent)
, m_data(new LookAndFeelData(this))
, m_applyColors(true)
, m_applyWidgetStyle(true)
, m_applyIcons(true)
, m_applyPlasmaTheme(true)
, m_applyCursors(true)
, m_applyWindowSwitcher(true)
, m_applyDesktopSwitcher(true)
, m_applyWindowPlacement(true)
, m_applyShellPackage(true)
, m_resetDefaultLayout(false)
, m_applyLatteLayout(false)
, m_applyWindowDecoration(true)
, m_appearanceToApply(LookAndFeelManager::AppearanceToApply(LookAndFeelManager::AppearanceSettings))
, m_layoutToApply(LookAndFeelManager::LayoutToApply(LookAndFeelManager::LayoutSettings))
, m_plasmashellChanged(false)
, m_fontsChanged(false)
{
......@@ -50,6 +41,34 @@ LookAndFeelSettings *LookAndFeelManager::settings() const
return m_data->settings();
}
void LookAndFeelManager::setAppearanceToApply(AppearanceToApply items)
{
if (m_appearanceToApply == items) {
return;
}
m_appearanceToApply = items;
Q_EMIT appearanceToApplyChanged();
}
LookAndFeelManager::AppearanceToApply LookAndFeelManager::appearanceToApply() const
{
return m_appearanceToApply;
}
void LookAndFeelManager::setLayoutToApply(LayoutToApply items)
{
if (m_layoutToApply == items) {
return;
}
m_layoutToApply = items;
Q_EMIT layoutToApplyChanged();
}
LookAndFeelManager::LayoutToApply LookAndFeelManager::layoutToApply() const
{
return m_layoutToApply;
}
void LookAndFeelManager::setSplashScreen(const QString &theme)
{
if (theme.isEmpty()) {
......@@ -262,20 +281,6 @@ void LookAndFeelManager::setWindowTitleFont(const QString &font)
m_fontsChanged = true;
}
void LookAndFeelManager::setResetDefaultLayout(bool reset)
{
if (m_resetDefaultLayout == reset) {
return;
}
m_resetDefaultLayout = reset;
Q_EMIT resetDefaultLayoutChanged();
}
bool LookAndFeelManager::resetDefaultLayout() const
{
return m_resetDefaultLayout;
}
void LookAndFeelManager::writeNewDefaults(const QString &filename,
const QString &group,
const QString &key,
......@@ -354,7 +359,7 @@ QString LookAndFeelManager::colorSchemeFile(const QString &schemeName) const
void LookAndFeelManager::save(const KPackage::Package &package, const KPackage::Package &previousPackage)
{
if (m_resetDefaultLayout && m_mode == Mode::Apply) {
if (m_layoutToApply.testFlag(LookAndFeelManager::DesktopLayout) && m_mode == Mode::Apply) {
QDBusMessage message = QDBusMessage::createMethodCall(QStringLiteral("org.kde.plasmashell"),
QStringLiteral("/PlasmaShell"),
QStringLiteral("org.kde.PlasmaShell"),
......@@ -376,106 +381,121 @@ void LookAndFeelManager::save(const KPackage::Package &package, const KPackage::
KSharedConfigPtr conf = KSharedConfig::openConfig(package.filePath("defaults"));
KConfigGroup group(conf, "kdeglobals");
group = KConfigGroup(&group, "KDE");
if (m_applyWidgetStyle) {
QString widgetStyle = group.readEntry("widgetStyle", QString());
// Some global themes refer to breeze's widgetStyle with a lowercase b.
if (widgetStyle == QStringLiteral("breeze")) {
widgetStyle = QStringLiteral("Breeze");
}
setWidgetStyle(widgetStyle);
}
if (m_mode == Mode::Apply) {
if (m_appearanceToApply.testFlag(LookAndFeelManager::WidgetStyle)) {
QString widgetStyle = group.readEntry("widgetStyle", QString());
// Some global themes refer to breeze's widgetStyle with a lowercase b.
if (widgetStyle == QStringLiteral("breeze")) {
widgetStyle = QStringLiteral("Breeze");
}
if (m_applyColors) {
QString colorsFile = package.filePath("colors");
KConfigGroup group(conf, "kdeglobals");
group = KConfigGroup(&group, "General");
QString colorScheme = group.readEntry("ColorScheme", QString());
setWidgetStyle(widgetStyle);
}
if (!colorsFile.isEmpty()) {
if (!colorScheme.isEmpty()) {
setColors(colorScheme, colorsFile);
} else {
setColors(package.metadata().name(), colorsFile);
}
} else if (!colorScheme.isEmpty()) {
QString path = colorSchemeFile(colorScheme);
if (!path.isEmpty()) {
setColors(colorScheme, path);
if (m_appearanceToApply.testFlag(LookAndFeelManager::Colors)) {
QString colorsFile = package.filePath("colors");
KConfigGroup group(conf, "kdeglobals");
group = KConfigGroup(&group, "General");
QString colorScheme = group.readEntry("ColorScheme", QString());
if (!colorsFile.isEmpty()) {
if (!colorScheme.isEmpty()) {
setColors(colorScheme, colorsFile);
} else {
setColors(package.metadata().name(), colorsFile);
}
} else if (!colorScheme.isEmpty()) {
QString path = colorSchemeFile(colorScheme);
if (!path.isEmpty()) {
setColors(colorScheme, path);
}
}
}
}
if (m_applyIcons) {
group = KConfigGroup(conf, "kdeglobals");
group = KConfigGroup(&group, "Icons");
setIcons(group.readEntry("Theme", QString()));
}
if (m_appearanceToApply.testFlag(LookAndFeelManager::Icons)) {
group = KConfigGroup(conf, "kdeglobals");
group = KConfigGroup(&group, "Icons");
setIcons(group.readEntry("Theme", QString()));
}
if (m_applyPlasmaTheme) {
group = KConfigGroup(conf, "plasmarc");
group = KConfigGroup(&group, "Theme");
setPlasmaTheme(group.readEntry("name", QString()));
}
if (m_appearanceToApply.testFlag(LookAndFeelManager::PlasmaTheme)) {
group = KConfigGroup(conf, "plasmarc");
group = KConfigGroup(&group, "Theme");
setPlasmaTheme(group.readEntry("name", QString()));
}
if (m_applyCursors) {
group = KConfigGroup(conf, "kcminputrc");
group = KConfigGroup(&group, "Mouse");
setCursorTheme(group.readEntry("cursorTheme", QString()));
}
if (m_appearanceToApply.testFlag(LookAndFeelManager::Cursors)) {
group = KConfigGroup(conf, "kcminputrc");
group = KConfigGroup(&group, "Mouse");
setCursorTheme(group.readEntry("cursorTheme", QString()));
}
if (m_applyWindowSwitcher) {
group = KConfigGroup(conf, "kwinrc");
group = KConfigGroup(&group, "WindowSwitcher");
setWindowSwitcher(group.readEntry("LayoutName", QString()));
}
if (m_appearanceToApply.testFlag(LookAndFeelManager::WindowSwitcher)) {
group = KConfigGroup(conf, "kwinrc");
group = KConfigGroup(&group, "WindowSwitcher");
setWindowSwitcher(group.readEntry("LayoutName", QString()));
}
if (m_applyDesktopSwitcher) {
group = KConfigGroup(conf, "kwinrc");
group = KConfigGroup(&group, "DesktopSwitcher");
setDesktopSwitcher(group.readEntry("LayoutName", QString()));
}
if (m_layoutToApply.testFlag(LookAndFeelManager::DesktopSwitcher)) {
group = KConfigGroup(conf, "kwinrc");
group = KConfigGroup(&group, "DesktopSwitcher");
setDesktopSwitcher(group.readEntry("LayoutName", QString()));
}
if (m_applyWindowPlacement) {
group = KConfigGroup(conf, "kwinrc");
group = KConfigGroup(&group, "Windows");
setWindowPlacement(group.readEntry("Placement", QStringLiteral("Centered")));
}
if (m_layoutToApply.testFlag(LookAndFeelManager::WindowPlacement)) {
group = KConfigGroup(conf, "kwinrc");
group = KConfigGroup(&group, "Windows");
setWindowPlacement(group.readEntry("Placement", QStringLiteral("Centered")));
}
if (m_applyShellPackage) {
group = KConfigGroup(conf, "plasmashellrc");
group = KConfigGroup(&group, "Shell");
setShellPackage(group.readEntry("ShellPackage", QString()));
}
if (m_layoutToApply.testFlag(LookAndFeelManager::ShellPackage)) {
group = KConfigGroup(conf, "plasmashellrc");
group = KConfigGroup(&group, "Shell");
setShellPackage(group.readEntry("ShellPackage", QString()));
}
if (m_applyWindowDecoration) {
group = KConfigGroup(conf, "kwinrc");
group = KConfigGroup(&group, "org.kde.kdecoration2");
if (m_appearanceToApply.testFlag(LookAndFeelManager::WindowDecoration)) {
group = KConfigGroup(conf, "kwinrc");
group = KConfigGroup(&group, "org.kde.kdecoration2");
#ifdef HAVE_BREEZE_DECO
setWindowDecoration(group.readEntry("library", QStringLiteral(BREEZE_KDECORATION_PLUGIN_ID)), group.readEntry("theme", QStringLiteral("Breeze")));
setWindowDecoration(group.readEntry("library", QStringLiteral(BREEZE_KDECORATION_PLUGIN_ID)), group.readEntry("theme", QStringLiteral("Breeze")));
#else
setWindowDecoration(group.readEntry("library", QStringLiteral("org.kde.kwin.aurorae")),
group.readEntry("theme", QStringLiteral("kwin4_decoration_qml_plastik")));
setWindowDecoration(group.readEntry("library", QStringLiteral("org.kde.kwin.aurorae")),
group.readEntry("theme", QStringLiteral("kwin4_decoration_qml_plastik")));
#endif
}
}
group = KConfigGroup(conf, "kdeglobals");
group = KConfigGroup(&group, "General");
setGeneralFont(group.readEntry("font", QString()));
setFixedFont(group.readEntry("fixed", QString()));
setSmallestReadableFont(group.readEntry("smallestReadableFont", QString()));
setToolbarFont(group.readEntry("toolBarFont", QString()));
setMenuFont(group.readEntry("menuFont", QString()));
group = KConfigGroup(conf, "kdeglobals");
group = KConfigGroup(&group, "WM");
setWindowTitleFont(group.readEntry("activeFont"));
if (m_fontsChanged) {
Q_EMIT fontsChanged();
m_fontsChanged = false;
}
if (m_appearanceToApply.testFlag(LookAndFeelManager::Fonts)) {
group = KConfigGroup(conf, "kdeglobals");
group = KConfigGroup(&group, "General");
setGeneralFont(group.readEntry("font", QString()));
setFixedFont(group.readEntry("fixed", QString()));
setSmallestReadableFont(group.readEntry("smallestReadableFont", QString()));
setToolbarFont(group.readEntry("toolBarFont", QString()));
setMenuFont(group.readEntry("menuFont", QString()));
group = KConfigGroup(conf, "kdeglobals");