Persistent application configuration data.

Richard Moore rich at ipso-facto.freeserve.co.uk
Fri Mar 17 17:33:26 UTC 2000


You ought to consider whether you really want to do this. It could be
that it should be handled by the session and window managers. Perhaps
you should talk to Matthias Ettrich to get his opinion on this (or ask
on kde-core-devel).

Rich.

Ralf Nolden wrote:
> 
> "Miller, John JE" wrote:
> >
> > Hi all,
> >
> > In the Linux world where does one store application
> > specific configuration data, ie the top/left co-ordinates
> > of a window on the screen when the window is shutdown,
> > so that it can be restored to that position the next time
> > it is opened (dare I suggest, in the style of INI files on
> > windows).  Anyone got a class to create/read/write/delete
> > this data.
> 
> Before you get some other advice as I have read ;-) here´s some expert
> help:
> the class you want to use is KConfig. The templates for KDE apps already
> use these in reading and writing options. the Geometry is already saved
> for your application in saveOptions() and restored when starting up in
> readOptions(). Look for QWidget methods to retrieve the topleft
> position, store it in a QPoint and look for suitable methods to write
> and read the point and set the position. You can use setGeometry(QRect)
> instead of resize() which the normal templates use, where you can
> specify the topleft position in the QRect.  Add your code to the
> read/saveOptions() methods to ensure all goes well.
> 
> In KDE you NEVER need an INI file or something like that nor do you have
> to take care for the actual location for the file. KConfig does that
> completely for you, so use this class whenever you want to store/read
> any options, e.g. key accelerators or whatever. Use setGroup() to
> separate the config file into groups and watch out for ALWAYS giving
> default values in the read methods like described in the KConfig API, so
> your members don´t run uninitialized if the user starts your program the
> first time.
> 
> Hope this helps,
> 
> Ralf
> 
> --
> **********************************
> Ralf Nolden
> 
> Ardennenstr. 41
> 52355 Düren
> 
> Tel. 02421/502758
> 
> The KDevelop Project
> http://www.kdevelop.org
> 
> Email: rnolden at kdevelop.de
> **********************************

-- 
     Richard Moore		rich at ipso-facto.freeserve.co.uk
http://www.robocast.com/	richard at robocast.com
http://developer.kde.org/	rich at kde.org





More information about the KDevelop mailing list