Idea: SkipDirtyOnIdenticalValues WriteConfigFlag for KConfigBase / KConfig

Matthew Woehlke mw_triad at users.sourceforge.net
Fri Jul 11 22:02:25 BST 2008


David Faure wrote:
> 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.

I know I'm about a month late here, but this is exactly a problem that 
exists in kate(part), that I was expecting to (eventually, whenever I 
actually got around to fixing it) have to fix by implementing this sort 
of logic in kate. Although, I think in kate's case what we really want 
to do is fix the granularity on our own dirty, so that we don't even 
call writes unless something has been changed.

Specifically, the issue in kate is that it should not write the scheme 
colors until you actually change one of them, so that if you don't 
fiddle with them, they stay in sync with the system color scheme. 
Currently if you change *anything* (e.g. indent, show line numbers) the 
colors get written also :-(.

But, it's an example of what dfaure is pointing out, there are times 
when you want to write the value regardless (in fact, kate will get VERY 
screwed up if it doesn't write out the entire colors, even if most are 
still "default"), and times when if it hasn't changed, you want it to 
remain unset.

What might work is:

writeEntry(value) -- always writes if empty, don't set dirty if 
unchanged (same as current behavior I think, sans gratuitous dirtying?)

writeEntry(value, default) -- don't write if current is empty and 
value==default, otherwise as above

The latter is especially needed because the default may not be constant 
(e.g. kate defaults are related to the current system color scheme)

-- 
Matthew
I picked up a Magic 8-Ball the other day and it said 'Outlook not so 
good.' I said 'Sure, but Microsoft still ships it.'
   -- Anonymous (from cluefire.net)





More information about the kde-core-devel mailing list