saving/restoring session in kded module

Andriy Rysin arysin at
Sat Mar 5 16:32:07 GMT 2011

There seems to be plenty info on saving/restoring sessions for 
applications (i.e. the features in KApplication and KMainWindow classes) 
but I'd like to save/restore some information in KDED module (keyboard 
layouts to be exact) but only if restore session on login is set to true 
(I'd like not to introduce another option in keyboard kcm but rather 
reuse system-wide session handing option).

So far the solution I've found is this:
save/restore session in module dtor/ctor checking if in "ksmserverrc" 
the "loginMode" parameter is set to "restoreSavedSession".
This is not very nice as I have to read some other module's config and 
compare some string values, though I could not find an exposed native or 
DBUS API from ksmserver. Also I noticed that at least two plasma applets 
in kde-workspace do exactly that.

If there's a better/righter way please let me know,

More information about the kde-core-devel mailing list