KConfigGroup (Re: KDE/kdelibs/khtml)

David Faure faure at kde.org
Sat Feb 10 22:54:20 GMT 2007


On Friday 09 February 2007, Aaron J. Seigo wrote:
>  - a method in KConfig that returns a KConfigGroup object
Does this change anything?
  KConfigGroup group = KGlobal::config()->configGroup("bar");
instead of
  KConfigGroup group = KConfigGroup( KGlobal::config(), "bar" );
?
Can't see much improvement (only more object copying).

>  - providing a KConfigGroup(const QString& config, const QString& group) which 
> creates an internal KConfig as a shortcut for this common idiom:
I am strongly against this. People will write code like
KConfigGroup group1("myconfigrc","group1");
group1.writeEntry(..);
KConfigGroup group2("myconfigrc","group2");
group2.writeEntry(..);
... which will lead to myconfigrc being parsed twice. Very slow.

> perhaps even KConfigGroup(const QString& group) to shortcut this idiom:
> 	KConfigGroup group(KGlobal::config(), "bar");
would become KConfigGroup group("bar")... Hmm. A bit too much hidden magic 
to my taste but I guess it makes the simple case (kmyapp) a bit simpler. So I guess
I'm ok with that one.

> IOW, if we remove KConfig::setGroup() from the public API, we will want to 
> make KConfigGroup more convenient to get to and use. which is thankfully 
> pretty trivial to do.
KConfigGroup doesn't strike me as difficult to use as it is, to be honest.
Well, especially now that I added entryMap() to it, for the case where that's needed ;)

-- 
David Faure, faure at kde.org, sponsored by Trolltech to work on KDE,
Konqueror (http://www.konqueror.org), and KOffice (http://www.koffice.org).




More information about the kde-core-devel mailing list