KDED time zone module

Lubos Lunak l.lunak at suse.cz
Fri Mar 30 20:04:47 BST 2007


On st 28. března 2007, David Jarvie wrote:
> I want to implement a kded module to read system time zone information, as
> was previously suggested on this list.

 That's http://lists.kde.org/?l=kde-core-devel&m=115884044529385&w=2 , for 
those who don't remember anymore.

> The aim is to read the data only 
> once per session, rather than have each application cause it to be read
> the first time it calls a KDateTime or KTimeZone method requiring it. I'm
> not familiar with kded modules,

 KDED module is just a small module loaded into the KDED daemon instead having 
a full separate application (which have higher overhead because of being a 
separate application). Docs and test module in kdelibs/kded should be all you 
need ;).

> so can those who are please answer a 
> couple of questions:
>
> - Where/how should the kded module store the data it reads? It needs to be
> accessible via KSystemTimeZone. The data is basically fixed - any changes
> would be very infrequent - should it be stored in ksycoca?

 IIRC the data to store are the name of the local zone and some info about 
each timezone, right? The local zone name can go e.g. in kdeglobals or a 
separate config file (together with some timestamp(s) for avoiding doing 
anything when nothing has changed).

 As for storing timezone data, I suppose that's up to you :) and it probably 
depends on the data you want to store. If everything from /usr/share/zoneinfo 
is needed (that's 900k here :-/ ) and you want to do it a simple way, then I 
have a class for writing a complete directory structure into a single file 
and classes for accessing them (QDir::entryList()-like listing and a function 
returning contents as QByteArray) - it's for Qt3/KDE3 now though.

> - On some systems, a parsed copy of one of the system time zone files
> should ideally be stored in the system-wide KDE data directory so as to
> avoid having to re-parse the system file at session start. How can the
> location of this directory be accessed? KStandardDirs doesn't seem to
> provide this information except as one in a list of data directories,
> which is ambiguous.

 System-wide may be a bit problematic because of access rights and such stuff. 
Maybe there could be a setuid (setuid nobody?) helper that'd create the file, 
not that I'm really an expert on such things.

 For storing it per-user it'd be the "cache" KStandardDirs resource.

-- 
Lubos Lunak
KDE developer
--------------------------------------------------------------
SUSE LINUX, s.r.o.   e-mail: l.lunak at suse.cz , l.lunak at kde.org
Lihovarska 1060/12   tel: +420 284 028 972
190 00 Prague 9      fax: +420 284 028 951
Czech Republic       http//www.suse.cz




More information about the kde-core-devel mailing list