Changeset View
Changeset View
Standalone View
Standalone View
kcms/lookandfeel/kcm.cpp
Show All 34 Lines | |||||
35 | #include <QDBusMessage> | 35 | #include <QDBusMessage> | ||
36 | #include <QDebug> | 36 | #include <QDebug> | ||
37 | #include <QQuickItem> | 37 | #include <QQuickItem> | ||
38 | #include <QQuickWindow> | 38 | #include <QQuickWindow> | ||
39 | #include <QStandardPaths> | 39 | #include <QStandardPaths> | ||
40 | #include <QProcess> | 40 | #include <QProcess> | ||
41 | #include <QStandardItemModel> | 41 | #include <QStandardItemModel> | ||
42 | #include <QX11Info> | 42 | #include <QX11Info> | ||
43 | #include <QStyle> | ||||
44 | #include <QStyleFactory> | ||||
43 | 45 | | |||
44 | #include <KLocalizedString> | 46 | #include <KLocalizedString> | ||
45 | #include <KPackage/PackageLoader> | 47 | #include <KPackage/PackageLoader> | ||
46 | 48 | | |||
47 | #include <X11/Xlib.h> | 49 | #include <X11/Xlib.h> | ||
48 | 50 | | |||
49 | #include <updatelaunchenvjob.h> | 51 | #include <updatelaunchenvjob.h> | ||
50 | 52 | | |||
▲ Show 20 Lines • Show All 206 Lines • ▼ Show 20 Line(s) | 251 | if (m_resetDefaultLayout) { | |||
257 | QDBusConnection::sessionBus().call(message, QDBus::NoBlock); | 259 | QDBusConnection::sessionBus().call(message, QDBus::NoBlock); | ||
258 | } | 260 | } | ||
259 | 261 | | |||
260 | if (!package.filePath("defaults").isEmpty()) { | 262 | if (!package.filePath("defaults").isEmpty()) { | ||
261 | KSharedConfigPtr conf = KSharedConfig::openConfig(package.filePath("defaults")); | 263 | KSharedConfigPtr conf = KSharedConfig::openConfig(package.filePath("defaults")); | ||
262 | KConfigGroup cg(conf, "kdeglobals"); | 264 | KConfigGroup cg(conf, "kdeglobals"); | ||
263 | cg = KConfigGroup(&cg, "KDE"); | 265 | cg = KConfigGroup(&cg, "KDE"); | ||
264 | if (m_applyWidgetStyle) { | 266 | if (m_applyWidgetStyle) { | ||
265 | setWidgetStyle(cg.readEntry("widgetStyle", QString())); | 267 | QString widgetStyle = cg.readEntry("widgetStyle", QString()); | ||
268 | // Some global themes refer to breeze's widgetStyle with a lowercase b. | ||||
ngraham: s/theme/themes/
s/lower case/lowercase/ | |||||
269 | if (widgetStyle == QStringLiteral("breeze")) { | ||||
270 | widgetStyle = QStringLiteral("Breeze"); | ||||
271 | } | ||||
272 | setWidgetStyle(widgetStyle); | ||||
266 | } | 273 | } | ||
267 | 274 | | |||
268 | if (m_applyColors) { | 275 | if (m_applyColors) { | ||
269 | QString colorsFile = package.filePath("colors"); | 276 | QString colorsFile = package.filePath("colors"); | ||
270 | KConfigGroup cg(conf, "kdeglobals"); | 277 | KConfigGroup cg(conf, "kdeglobals"); | ||
271 | cg = KConfigGroup(&cg, "General"); | 278 | cg = KConfigGroup(&cg, "General"); | ||
272 | QString colorScheme = cg.readEntry("ColorScheme", QString()); | 279 | QString colorScheme = cg.readEntry("ColorScheme", QString()); | ||
273 | 280 | | |||
▲ Show 20 Lines • Show All 129 Lines • ▼ Show 20 Line(s) | |||||
403 | } | 410 | } | ||
404 | 411 | | |||
405 | void KCMLookandFeel::setWidgetStyle(const QString &style) | 412 | void KCMLookandFeel::setWidgetStyle(const QString &style) | ||
406 | { | 413 | { | ||
407 | if (style.isEmpty()) { | 414 | if (style.isEmpty()) { | ||
408 | return; | 415 | return; | ||
409 | } | 416 | } | ||
410 | 417 | | |||
418 | // Some global themes use styles that may not be installed. | ||||
419 | // Test if style can be installed before updating the config. | ||||
ngraham: s/if can apply style/if style can be installed/ | |||||
420 | QScopedPointer<QStyle> newStyle(QStyleFactory::create(style)); | ||||
421 | if (newStyle) { | ||||
411 | m_configGroup.writeEntry("widgetStyle", style); | 422 | m_configGroup.writeEntry("widgetStyle", style); | ||
412 | m_configGroup.sync(); | 423 | m_configGroup.sync(); | ||
413 | //FIXME: changing style on the fly breaks QQuickWidgets | 424 | //FIXME: changing style on the fly breaks QQuickWidgets | ||
414 | KGlobalSettings::self()->emitChange(KGlobalSettings::StyleChanged); | 425 | KGlobalSettings::self()->emitChange(KGlobalSettings::StyleChanged); | ||
415 | } | 426 | } | ||
427 | } | ||||
416 | 428 | | |||
417 | void KCMLookandFeel::setColors(const QString &scheme, const QString &colorFile) | 429 | void KCMLookandFeel::setColors(const QString &scheme, const QString &colorFile) | ||
418 | { | 430 | { | ||
419 | if (scheme.isEmpty() && colorFile.isEmpty()) { | 431 | if (scheme.isEmpty() && colorFile.isEmpty()) { | ||
420 | return; | 432 | return; | ||
421 | } | 433 | } | ||
422 | 434 | | |||
423 | KSharedConfigPtr conf = KSharedConfig::openConfig(colorFile, KSharedConfig::CascadeConfig); | 435 | KSharedConfigPtr conf = KSharedConfig::openConfig(colorFile, KSharedConfig::CascadeConfig); | ||
▲ Show 20 Lines • Show All 284 Lines • Show Last 20 Lines |
s/theme/themes/
s/lower case/lowercase/