From 8579ec54838b7188ed016f7adb4a69bbf2e39712 Mon Sep 17 00:00:00 2001 From: David Edmundson Date: Wed, 10 Oct 2018 14:48:49 +0100 Subject: Add mechanism to notify other clients of config changes over DBus Summary: Intention is not to create a registry like system, but to replace KDElibs4Support::KGlobalSettings and to replace other system settingss -> some app communication in a more generic way. writeEntry gains an additional flag Notify which if set, will notify clients of what has actually changed when we sync. Rationale to put this into KConfig was so that we could have everything batched and sychronised to the file sync and to get the fine detailed exposure of what has actually changed which we don't get with a file watcher. Default behaviour remains identical without any broadcast messages. As it is a new dependency it is purely optional and anything referencing DBus is not in the public API. Our deployment on platforms without DBus tend to be standalone applications anyway. Test Plan: Attached unit test Reviewers: broulik, dfaure Reviewed By: broulik, dfaure Subscribers: dfaure, broulik, zzag, kde-frameworks-devel Tags: #frameworks Differential Revision: https://phabricator.kde.org/D13034 --- src/core/kconfigdata.cpp | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'src/core/kconfigdata.cpp') diff --git a/src/core/kconfigdata.cpp b/src/core/kconfigdata.cpp index 6ef6af07..d80b7d07 100644 --- a/src/core/kconfigdata.cpp +++ b/src/core/kconfigdata.cpp @@ -134,6 +134,8 @@ bool KEntryMap::setEntry(const QByteArray &group, const QByteArray &key, const Q e.mValue = value; e.bDirty = e.bDirty || (options & EntryDirty); + e.bNotify = e.bNotify || (options & EntryNotify); + e.bGlobal = (options & EntryGlobal); //we can't use || here, because changes to entries in //kdeglobals would be written to kdeglobals instead //of the local config file, regardless of the globals flag @@ -269,6 +271,8 @@ bool KEntryMap::getEntryOption(const QMap< KEntryKey, KEntry >::ConstIterator &i return it->bDeleted; case EntryExpansion: return it->bExpand; + case EntryNotify: + return it->bNotify; default: break; // fall through } @@ -296,6 +300,9 @@ void KEntryMap::setEntryOption(QMap< KEntryKey, KEntry >::Iterator it, KEntryMap case EntryExpansion: it->bExpand = bf; break; + case EntryNotify: + it->bNotify = bf; + break; default: break; // fall through } -- cgit v1.2.1