saving/restoring session in kded module

David Faure faure at kde.org
Mon May 2 14:00:37 BST 2011


On Friday 29 April 2011, Andriy Rysin wrote:
> Well saving layouts is most useful if the switcher is in
> "per-application" mode (I guess even more when in "per window" but hat
> mode currently can't save layouts as it uses wid for the key which is
> transient). If you restore your session (and thus windows) it makes
> sense to remember which layouts they had. But if you prefer to start
> with a clean sheet (empty session) then saving layouts may be a bit too
> imposing on the user.

OK, your kded module is a bit special since it's related to the windows opened 
by other applications.

So I can see the sense in restoring settings only when the session should be 
restored. But I think this is really specific to keyboard layout switcher, I 
can't see how this would ever apply to another kded module.

For this reason I don't think this belongs in KDEDModule.

> Although one may argue that in per-application
> mode you always prefer same layout for particular app irregardless
> whether you restore your windows/apps or not.

Yeah, there's that too :)

> On the implementation side if we don't honor the "restore session"
> option then new methods in KDEDModule won't add much - you can just save
> in destructor and restore in constructor. 

Well, developers of kded module won't understand the difference and will just 
use this for saving settings, if they see these methods, while in fact in most 
cases a simple KConfig would be simpler/better.

> getSessionStoreDir() might be useful in any case though.

I can't see how.
E.g. the cookierserver kded module should save into its kconfig file (say 
kcookiejarrc), not into a window-manager session file.
Same for the SSL certificates module, same for the password server, the 
timezone module, and so on.
They are all about "data", not about adding information to windows from other 
processes, which is the only case where "restore windows from last session" 
matters.

=> AFAICS these methods are useful for only one module, and in addition their 
implementation is... well, there's no better solution but it looks ugly, so 
I'd rather not generalize the use of this, unless it's really needed.

-- 
David Faure, faure at kde.org, http://www.davidfaure.fr
Sponsored by Nokia to work on KDE, incl. Konqueror (http://www.konqueror.org).




More information about the kde-core-devel mailing list