KConfigBase::writeEntry and flags (patch)

David Faure faure at kde.org
Wed Jan 4 14:21:11 GMT 2006


The idea is good, but:

On Wednesday 04 January 2006 13:43, Olivier Goffart wrote:
> +                               cg.writeEntry( sName, s, (KConfigBase::WriteConfigFlag)(bGlobal?KConfigBase::Global:0) );

This is a bit ugly IMHO. How about using QFlags for real, like:
Q_DECLARE_FLAGS(WriteConfigFlags, WriteConfigFlag)
inside KConfigBase

and out of KConfigBase:
Q_DECLARE_OPERATORS_FOR_FLAGS(KConfigBase::WriteConfigFlags)

And then add a name for the value 0 (NoFlag? Normal?), and then the above can be
cg.writeEntry( sName, s, gGlobal ? KConfigBase::Global : KConfigBase::NoFlag );

(And you can s/QFlags<WriteConfigFlag>/WriteConfigFlags/ everywhere)

-- 
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