From 5d2ed13479a480111355657bf22324118fa576e9 Mon Sep 17 00:00:00 2001 From: Kai Uwe Broulik Date: Wed, 24 Apr 2019 16:20:56 +0200 Subject: Add Notify capability to KConfigXT Lets you specify Notifiers= in .kcfg for config entries that should be written with Notify flag, i.e. announce the change to KConfigWatcher Differential Revision: https://phabricator.kde.org/D20196 --- src/core/kcoreconfigskeleton.h | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) (limited to 'src/core/kcoreconfigskeleton.h') diff --git a/src/core/kcoreconfigskeleton.h b/src/core/kcoreconfigskeleton.h index b384129d..771d8cc9 100644 --- a/src/core/kcoreconfigskeleton.h +++ b/src/core/kcoreconfigskeleton.h @@ -132,6 +132,19 @@ public: */ QString whatsThis() const; + /** + The write flags to be used when writing configuration. + @since 5.58 + */ + void setWriteFlags(KConfigBase::WriteConfigFlags flags); + + /** + Return write flags to be used when writing configuration. + They should be passed to every call of writeEntry() and revertToDefault(). + @since 5.58 + */ + KConfigBase::WriteConfigFlags writeFlags() const; + /** * This function is called by @ref KCoreConfigSkeleton to read the value for this setting * from a config file. @@ -141,6 +154,7 @@ public: /** * This function is called by @ref KCoreConfigSkeleton to write the value of this setting * to a config file. + * Make sure to pass writeFlags() to every call of writeEntry() and revertToDefault(). */ virtual void writeConfig(KConfig *) = 0; @@ -274,9 +288,9 @@ public: if (mReference != mLoadedValue) { // Is this needed? KConfigGroup cg(config, mGroup); if ((mDefault == mReference) && !cg.hasDefault(mKey)) { - cg.revertToDefault(mKey); + cg.revertToDefault(mKey, writeFlags()); } else { - cg.writeEntry(mKey, mReference); + cg.writeEntry(mKey, mReference, writeFlags()); } mLoadedValue = mReference; } -- cgit v1.2.1