Merging settings by group in KConfig

Matt Rogers mattr at kde.org
Tue Apr 4 18:21:30 BST 2006


On Mon, Apr 03, 2006 at 08:56:28PM +0200, David Faure wrote:
> On Monday 03 April 2006 20:27, Matt Rogers wrote:
> > config->setGroup( "Chatwindow:FooContact", "Chatwindow" );
> setGroup is deprecated in favour of using KConfigGroup; setGroup 
> is too dangerous since it changes the state of KConfig.
> 

for kde 4 only or for kde 3 as well? this is still KDE3 code i'm working
with ATM.

> > //read an entry. if no entry for the key exists in the real group
> > //read the entry from the default group, and if no entry exists there
> > //use the specified default.
> > config->readEntry("OverriddenKey", "Default"); //returns "NotDefault"
> 
> I'm wondering if this shouldn't be done why this can't be done by an extra layer 
> above KConfigGroup...  Something like
> KConfigGroupWithDefault myGroup( "Chatwindow:FooContact", "Chatwindow" );
> myGroup.readEntry("OverriddenKey", "Default");
> Should be easy to implement, e.g. with two KConfigGroups as member,
> or by deriving from KConfigGroup and adding fallback-lookup.
> 

ahh, neat. i'll see if i can't take a stab at this in the next day or
two.

Thanks!
--
Matt




More information about the kde-core-devel mailing list