Commit 17ef374a authored by Cyril Rossi's avatar Cyril Rossi
Browse files

KCM LookAndFeel check widgetStyle availability before applying it

BUG: 419552
* Some Global Theme may refer to breeze widget style with a lower case b, apply the proper name `Breeze`

BUG: 418698
* Some Global Theme use widget style that may not be installed, then don't apply it.

Test Plan:
* Open KCM LookAndFeel, open GHNS and install Qogir-light theme, then apply it. Open Application Style KCM, if kvantum is not installed, Breeze is highlighted.
* Open KCM LookAndFeel, open GHNS and install Aritim-Light, then apply it. Open Application Style KCM, Breeze is highlighted.

Reviewers: #plasma, ervin, bport, meven, ngraham

Reviewed By: ervin, ngraham

Subscribers: ngraham, plasma-devel

Tags: #plasma

Differential Revision:
parent 080e9dd6
......@@ -39,6 +39,8 @@
#include <QProcess>
#include <QStandardItemModel>
#include <QX11Info>
#include <QStyle>
#include <QStyleFactory>
#include <KLocalizedString>
#include <KPackage/PackageLoader>
......@@ -259,7 +261,12 @@ void KCMLookandFeel::save()
KConfigGroup cg(conf, "kdeglobals");
cg = KConfigGroup(&cg, "KDE");
if (m_applyWidgetStyle) {
setWidgetStyle(cg.readEntry("widgetStyle", QString()));
QString widgetStyle = cg.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) {
......@@ -405,10 +412,15 @@ void KCMLookandFeel::setWidgetStyle(const QString &style)
// Some global themes use styles that may not be installed.
// Test if style can be installed before updating the config.
QScopedPointer<QStyle> newStyle(QStyleFactory::create(style));
if (newStyle) {
m_configGroup.writeEntry("widgetStyle", style);
//FIXME: changing style on the fly breaks QQuickWidgets
void KCMLookandFeel::setColors(const QString &scheme, const QString &colorFile)
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment