[PATCH] Allow reading of values on invalid KConfigGroups

David Faure faure at kde.org
Wed Feb 25 12:48:25 GMT 2009


On Wednesday 25 February 2009, Thomas Braxton wrote:
> On 2/24/09, Sebastian TrĂ¼g <sebastian at trueg.de> wrote:
> > On Tuesday 24 February 2009 15:08:34 Thomas Braxton wrote:
> >> I don't know why you would want to read from an invalid group, but
> >> wouldn't it make the patch a lot easier if you just returned the
> >> default right away if the group is invalid? i.e.
> >>
> >> replace
> >>     Q_ASSERT(isValid());
> >> with
> >>     if (!isValid()) {
> >>         return aDefault;
> >>     }
> >
> > yes, I just like one-exit-point methods better. But I don't really care. :)
> >
> I think I finally figured out what you're trying to do, and it's
> already supported in KConfig. You can have an "anonymous" config
> object. I think using that feature of KConfig would be better than
> working with invalid groups, because KConfigGroup is meant to be used
> only as a part of a config object. I don't think I documented how to
> open an anonymous object, so here it is; KConfig(QString(),
> KConfig::SimpleConfig)

What does an "anonymous config" means? That you can make operations
on it in memory and it doesn't get saved to disk? That sounds excellent,
we need exactly that in konqueror...

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




More information about the kde-core-devel mailing list