[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-devel
Subject:    KConfigBase changes (isDesktopFile() and getConfigState())
From:       iglio () fub ! it (Pietro Iglio)
Date:       1999-07-12 14:01:10
[Download RAW message or body]

I would like to remove the code from kpanel to test whether a file
is a desktop file or not, and move everything in KConfigBase.

I propose to add a new method:

  static bool KConfig::isDesktopFile(QString path);

that returns true if the extension is either .kdelnk or .desktop

Moreover, KConfigBase::getConfigState() should return an extra
value WrongFormat. It's my understanding that a config file should
begin (discarding all comment lines) with a [anygroup] line. If this
is not true, the WrongFormat internal state should be set.

Here is an example of standard use for KConfig to open a desktop file:

    if (KConfig::isDesktopFile(path)) {
	KConfig config(path);

       if (config.getConfigState() == KConfig::WrongFormat)
		// handle error

       config.setGroup(...);

       etc.


What do you think? I update the CVS if nobody objects.


-- Pietro

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic