Commit a02797ca authored by Martin Flöser's avatar Martin Flöser

Use existing KSharedConfig in RuleBook::save

Summary:
Recently a KSharedConfig was introduced in RuleBook. It makes sense to
also use it in save and not just in load.

Reviewers: #kwin, #plasma

Subscribers: kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D12747
parent 32a715b0
......@@ -1080,20 +1080,23 @@ void RuleBook::load()
void RuleBook::save()
{
m_updateTimer->stop();
KConfig cfg(QStringLiteral(KWIN_NAME "rulesrc"), KConfig::NoGlobals);
QStringList groups = cfg.groupList();
if (!m_config) {
qCWarning(KWIN_CORE) << "RuleBook::save invoked without prior invokation of RuleBook::load";
return;
}
QStringList groups = m_config->groupList();
for (QStringList::ConstIterator it = groups.constBegin();
it != groups.constEnd();
++it)
cfg.deleteGroup(*it);
cfg.group("General").writeEntry("count", m_rules.count());
m_config->deleteGroup(*it);
m_config->group("General").writeEntry("count", m_rules.count());
int i = 1;
for (QList< Rules* >::ConstIterator it = m_rules.constBegin();
it != m_rules.constEnd();
++it) {
if ((*it)->isTemporary())
continue;
KConfigGroup cg(&cfg, QString::number(i));
KConfigGroup cg(m_config, QString::number(i));
(*it)->write(cg);
++i;
}
......
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