![]() Registered Member ![]()
|
This is the scenario:
I have an application 'App' which reads/writes some settings (let's call them 'AppSettings') via KConfigXT. There exists a KCModule 'KCM_App_Config' which also reads/writes 'AppSettings'. Assuming that both App and KCM_APP_Config are running concurrently, is there a way via KConfigXT or a similar framework for them to "watch" AppSettings for changes? Please note that the obvious approach of listening for the KCoreConfigSkeleton::configChanged() signal will not work, as App and KCM_App_Config are different processes. Although I could use a custom DBus signal/slot pair, I suspect there is an out-of-the-box solution which I have been unable to spot. Any suggestions in this regard will be greatly appreciated. |
![]() Administrator ![]()
|
I would recommend that both use file monitoring to watch the file(s) in question, and reload the configuration whenever it changes.
KDE Sysadmin
[img]content/bcooksley_sig.png[/img] |
![]() Registered Member ![]()
|
Thank you for your answer. Indeed, that's what I have done in the end.
For reference, this is how it can be implemented:
[ reconfigure() is the slot in my application which re-reads the configuration. ] Curiously, config writes appear to be dealt with by unlinking the config file and creating it anew, so KDirWatch::dirty() is never emitted, and if I connected to KDirWatch::deleted() my reconfigure() slot would be called twice: once on unlink, once on create. One way or the other, the above seems to work so far. |
Registered users: Bing [Bot], Evergrowing, Google [Bot], rockscient