Idea: SkipDirtyOnIdenticalValues WriteConfigFlag for KConfigBase / KConfig

David Faure faure at
Wed Jun 4 09:46:04 BST 2008

On Saturday 24 May 2008, Oswald Buddenhagen wrote:
> it will not write a config when the
> set value is the same as the default, while it should write the value
> explicitly so the effective config does not change when the default
> changes.

... and this is exactly why you need a flag, isn't it? :-)
In some cases you want the effective config to be stored, and in some
cases you want to use the default value, even if it changes later.
An example of the latter is the toolbar settings: if you set "text position"
of a toolbar back to "icon only", and that's your default, we want to write 
nothing in the config file so that if you change the default later, it will indeed
apply (instead of "most toolbars switched, but a few refused to switch to the new setting").
This is currently done in KToolBar with
  if ( !cg.hasDefault( "Position" ) && position == d->PositionDefault )
    cg.revertToDefault( "Position" );
    cg.writeEntry( "Position", position );

Hmm, it looks like what this would need is a cg.writeEntry( "Position", position, d->PositionDefault ), in fact :-)

David Faure, faure at, sponsored by Trolltech to work on KDE,
Konqueror (, and KOffice (

More information about the kde-core-devel mailing list