Commit 1a3699a8 authored by Nicolas Fella's avatar Nicolas Fella Committed by Nate Graham
Browse files

[kcms/colors] Notify global settings change after saving

ManagedConfigModule::save() writes the value for the 'ColorScheme' entry to disk.

If we notify the settings change anyone who connects to it may read the old value before the new one is saved.

To avoid this race consition emit the signal after saving instead of before


(cherry picked from commit d0106152)
parent 85399471
......@@ -46,6 +46,8 @@
#include "colorssettings.h"
#include "filterproxymodel.h"
#include "../kcms-common_p.h"
K_PLUGIN_FACTORY_WITH_JSON(KCMColorsFactory, "kcm_colors.json", registerPlugin<KCMColors>(); registerPlugin<ColorsData>();)
KCMColors::KCMColors(QObject *parent, const QVariantList &args)
......@@ -354,6 +356,7 @@ void KCMColors::save()
saveColors();
}
ManagedConfigModule::save();
notifyKcmChange(GlobalChangeType::PaletteChanged);
m_activeSchemeEdited = false;
processPendingDeletions();
......
......@@ -150,6 +150,4 @@ void applyScheme(const QString &colorSchemePath, KConfig *configOutput, KConfig:
applyToAlien = group.readEntry("exportKDEColors", applyToAlien);
}
runRdb(KRdbExportQtColors | KRdbExportGtkTheme | (applyToAlien ? KRdbExportColors : 0));
notifyKcmChange(GlobalChangeType::PaletteChanged);
}
......@@ -8,6 +8,7 @@
#include "colorsmodel.h"
#include "colorssettings.h"
#include "../kcms-common_p.h"
#include "../krdb/krdb.h"
#include <KColorScheme>
......@@ -87,6 +88,7 @@ int main(int argc, char **argv)
QStandardPaths::locate(QStandardPaths::GenericDataLocation, QStringLiteral("color-schemes/%1.colors").arg(model->selectedScheme()));
applyScheme(path, settings->config());
settings->save();
notifyKcmChange(GlobalChangeType::PaletteChanged);
ts << i18n("Successfully applied the color scheme %1 to your current Plasma session", requestedScheme) << Qt::endl;
} else {
ts << i18n("Could not find theme \"%1\". The theme should be one of the following options: %2",
......
......@@ -518,6 +518,7 @@ void KCMLookandFeel::setColors(const QString &scheme, const QString &colorFile)
writeNewDefaults(*m_config, configDefault, QStringLiteral("General"), QStringLiteral("ColorScheme"), scheme, KConfig::Notify);
applyScheme(colorFile, m_config.data(), KConfig::Notify);
notifyKcmChange(GlobalChangeType::PaletteChanged);
}
void KCMLookandFeel::setIcons(const QString &theme)
......
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