Porting problems with KMainWindow::readProperties()

Stephan Kulow coolo at kde.org
Tue Feb 27 08:47:19 GMT 2007


Am Montag 26 Februar 2007 schrieb David Faure:
> On Saturday 24 February 2007, Tobias Koenig wrote:
> > On Fri, Feb 23, 2007 at 09:18:15PM +0100, David Faure wrote:
> > > On Friday 23 February 2007, Aaron J. Seigo wrote:
> >
> > Hi,
> >
> > > > i think this is the other side of the bug being discussed in the "Re:
> > > > kmainwindow settings group (Re: KDE/kdelibs/kparts)" thread. i don't
> > > > see any resolution/conclusion yet, but between coolo and dfaure one
> > > > can only hope =)
> > >
> > > No this is completely orthogonal to apply/saveMainWindowSettings.
> > >
> > > readProperties is called by KMainWindow in the first place, so the
> > > group is known. The apps should just honour it IMHO.
> >
> > So to port the following code:
> >
> >   void FooBarMainWindow::readProperties( KConfig *config )
> >   {
> >     const KConfigGroup group = config->group( "view" );
> >     value = group.readValue("bar");
> >   }
> >
> > we shall write now
> >
> >   void FooBarMainWindow::readProperties( const KConfigGroup &config )
> >   {
> >     const KConfigGroup group = config.config()->group( "view" );
> >     value = group.readValue("bar");
> >   }
>
> No, value = config.readValue("bar"). And fix saveProperties to do the same.
> A fixed-named group breaks in a per-mainwindow call! If you have two
> mainwindows, they override each other's settings.
>
> App-global settings should be saved from elsewhere.
And yes, this was the reason I didn't add KConfigGroup::config() - but as we 
just have too much code out there that mixes group specific code with global 
settings code, we had to add it ;(

Greetings, Stephan




More information about the kde-core-devel mailing list