Commit 92a4d012 authored by Benjamin Port's avatar Benjamin Port
Browse files

KCM LookAndFeel: fix color application

Store as kdedefault only the colorscheme, colors data can still live in kdeglobals
They are not used to change default.
This will simplify code and fix some bugs when we apply theme without all groups
parent bf9003b0
......@@ -466,20 +466,14 @@ void KCMLookandFeel::setColors(const QString &scheme, const QString &colorFile)
return;
}
KConfig configDefault(configDefaults("kdeglobals"));
KSharedConfigPtr colorConf = KSharedConfig::openConfig(colorFile, KSharedConfig::CascadeConfig);
if (!m_data->isDefaults()) {
colorConf->copyTo(configDefault.name(), &configDefault);
} else {
for (const QString &grp : colorConf->groupList()) {
KConfigGroup colorConfGroup(colorConf, grp);
KConfigGroup cghome(&m_config, grp);
KConfigGroup cgd(&configDefault, grp);
revertKeyIfNeeded(colorConfGroup, cghome, cgd);
colorConf->deleteGroup(grp);
}
KSharedConfigPtr conf = KSharedConfig::openConfig(colorFile, KSharedConfig::CascadeConfig);
for (const QString &grp : conf->groupList()) {
KConfigGroup cg(conf, grp);
KConfigGroup cg2(&m_config, grp);
cg.copyTo(&cg2, KConfig::Notify);
}
KConfig configDefault(configDefaults("kdeglobals"));
writeNewDefaults(m_config, configDefault, QStringLiteral("General"), QStringLiteral("ColorScheme"), scheme, KConfig::Notify);
m_config.sync();
configDefault.sync();
......
Supports Markdown
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