plasma-shell reads theming from LookAndFeel package

ShellCorona reads the theme from the LookAndFeel package, (defaults,
group "Theme", key name), looks into plasmarc if the LNF theme should be
overridden, and if either exists, it sets the new theme on startup of
plasma-shell.
This commit is contained in:
Sebastian Kügler 2014-02-01 23:51:05 +01:00
parent 174eae6802
commit 833c2f55dd
2 changed files with 26 additions and 5 deletions

View File

@ -34,6 +34,9 @@ void LookAndFeelPackage::initPackage(Plasma::Package *package)
package->setDefaultPackageRoot("plasma/look-and-feel/");
//Defaults
package->addFileDefinition("defaults", "defaults", i18n("Default settings for theme, etc."));
//Directories
package->addDirectoryDefinition("previews", "previews", i18n("Preview Images"));
package->addFileDefinition("loginmanagerpreview", "previews/loginmanager.png", i18n("Preview for the Login Manager"));

View File

@ -98,11 +98,29 @@ ShellCorona::ShellCorona(QObject *parent)
{
d->desktopDefaultsConfig = KConfigGroup(KSharedConfig::openConfig(package().filePath("defaults")), "Desktop");
// FIXME: read from config,if emptry from package
Plasma::Theme *t = new Plasma::Theme(this);
//t->setThemeName("oxygen");
KConfigGroup cg(KSharedConfig::openConfig("plasmarc"), "Theme-plasma-shell");
t->setThemeName(cg.readEntry("name", "default"));
// Look for theme config in plasmarc, if it isn't configured, take the theme from the
// LookAndFeel package, if either is set, change the default theme
const QString themeGroupKey = QStringLiteral("Theme");
const QString themeNameKey = QStringLiteral("name");
QString themeName;
KConfigGroup plasmarc(KSharedConfig::openConfig("plasmarc"), themeGroupKey);
themeName = plasmarc.readEntry(themeNameKey, themeName);
if (themeName.isEmpty()) {
const KConfigGroup lnfCfg = KConfigGroup(KSharedConfig::openConfig(
lookAndFeelPackage().filePath("defaults")),
themeGroupKey
);
themeName = lnfCfg.readEntry(themeNameKey, themeName);
}
if (!themeName.isEmpty()) {
Plasma::Theme *t = new Plasma::Theme(this);
t->setThemeName(themeName);
}
connect(this, &ShellCorona::containmentAdded,
this, &ShellCorona::handleContainmentAdded);