From a85ff67deb4fcd2a5ec69b3fb9390e9a25f45a71 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Gr=C3=A4=C3=9Flin?= Date: Fri, 12 Oct 2012 08:23:00 +0200 Subject: [PATCH] QML Plastik as fallback for incorrectly configured Aurorae If a theme is configured which does not exist, Aurorae will load the Plastik theme which is known to be around. --- clients/aurorae/src/aurorae.cpp | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/clients/aurorae/src/aurorae.cpp b/clients/aurorae/src/aurorae.cpp index fb0ce347d3..67bb7ee76a 100644 --- a/clients/aurorae/src/aurorae.cpp +++ b/clients/aurorae/src/aurorae.cpp @@ -54,7 +54,10 @@ void AuroraeFactory::init() KConfig conf("auroraerc"); KConfigGroup group(&conf, "Engine"); - if (group.hasKey("EngineType")) { + if (!group.hasKey("EngineType") && !group.hasKey("ThemeName")) { + // neither engine type and theme name are configured, use the only available theme + initQML(group); + } else if (group.hasKey("EngineType")) { const QString engineType = group.readEntry("EngineType", "aurorae").toLower(); if (engineType == "qml") { initQML(group); @@ -71,7 +74,12 @@ void AuroraeFactory::init() void AuroraeFactory::initAurorae(KConfig &conf, KConfigGroup &group) { m_engineType = AuroraeEngine; - const QString themeName = group.readEntry("ThemeName", "example-deco"); + const QString themeName = group.readEntry("ThemeName"); + if (themeName.isEmpty()) { + // no theme configured, fall back to Plastik QML theme + initQML(group); + return; + } KConfig config("aurorae/themes/" + themeName + '/' + themeName + "rc", KConfig::FullConfig, "data"); KConfigGroup themeGroup(&conf, themeName); m_theme->loadTheme(themeName, config); @@ -90,7 +98,7 @@ void AuroraeFactory::initAurorae(KConfig &conf, KConfigGroup &group) void AuroraeFactory::initQML(const KConfigGroup &group) { // try finding the QML package - const QString themeName = group.readEntry("ThemeName"); + const QString themeName = group.readEntry("ThemeName", "kwin4_decoration_qml_plastik"); kDebug(1212) << "Trying to load QML Decoration " << themeName; const QString internalname = themeName.toLower();