[PATCH]KConfigGroup::groupList() kind of broken

Andreas Pakulat apaku at gmx.de
Tue Nov 20 11:04:06 GMT 2007


On 20.11.07 09:36:14, Oswald Buddenhagen wrote:
> On Tue, Nov 20, 2007 at 01:38:33AM +0100, Andreas Pakulat wrote:
> > Ok, while implementing this I've found a new problem :( 
> > 
> > KConfigGroup bargrp( &grp, "foo/bar" );
> > 
> > returns "foo/bar" as name,
> >
> that's good.
> 
> > though implementation wise that group is the same as bargrp here:
> > 
> > KConfigGroup middle(&grp, "foo");
> > KConfigGroup bargrp(&middle, "bar");
> > 
> that's not good.
> it's again the same ... separator quoting. i.e., a full group name in
> an ini file is a list with a separator which should be opaque to the
> caller.

I feared that :(

> > I guess we can't fix this without creating a real parent-child
> > relation ship between KConfigGroups, instead of just handling group
> > names in a special way.
> > 
> yes, i've been pondering this myself. it's gonna be a bit hard to have
> that in 4.0, though. ;)
> i think for the moment we just need to forbid the slash in group names.

Ok, will add API dox about this limitation. So the code that returns the
plain name should in fact not care about slashes, i.e. I can remove the
mid() in KConfigGroupPrivate::name()?

> > Index: tests/kconfigtest.cpp
> > ===================================================================
> > --- tests/kconfigtest.cpp	(Revision 738799)
> > +++ tests/kconfigtest.cpp	(Arbeitskopie)
> > @@ -701,13 +704,29 @@
> >      KConfigGroup subcg3( &cg, "SubGroup/3");
> > -    QVERIFY(subcg3.readEntry( "sub3string", "") == QString("somevalue") );
> > +    QCOMPARE(subcg3.readEntry( "sub3string", ""), QString("somevalue") );
> > +    QCOMPARE(subcg3.name(), QString("3"));
> > +
> urgs. that's an expected failure, not a pass. if it is not possible to
> express this with qtest, at least add a big fat comment here.

It can work with expected failures, I'll change that. 

Andreas

-- 
You have a deep appreciation of the arts and music.




More information about the kde-core-devel mailing list