Porting problems with KMainWindow::readProperties()
David Faure
faure at kde.org
Mon Feb 26 19:35:05 GMT 2007
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.
--
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