toolbar settings

Andras Mantia amantia at kde.org
Wed Jul 28 20:39:13 BST 2004


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On Wednesday 28 July 2004 07:00, Jens Herden wrote:
> Hi!
>
> I noticed that Quanta has a problem to remember which toolbar is
> visible. I can disable them but if I restart Quanta they are all
> visible again. I know that this did work.
> More strange is that the same code compiled on KDE 3.2 does it
> correct.
>
> Was there a recent change that might have caused this?

Seems to be so. The problem is in KMainWindow::saveMainWindowSettings 
combined with KToolBar::saveSettings. 

In the first method there is an iteration through the toolbars. The 
iterators is requested with KMainWindow::toolBarIterator(), which 
rebuilds the list of toolbars and returns an iterator. The problem is 
that in the  KToolBar::saveSettings a new iterator is requested with 
KMainWindow::toolBarIterator() and this invalidates the first iterator 
in saveMainWindowSettings and only the settings for the first toolbar 
are saved. All applications that have more than one toolbar are 
affected. I think the offending code was introduced recently and it is:

    // don't save if there's only one toolbar
    if ( !kmw || kmw->toolBarIterator().count() > 1 )
      config->writeEntry("Index", index);
    else
      config->revertToDefault("Index");

This either should be removed or the toolbarcounting should be done in 
another way. For example add either a method to get access to the 
toolbar list
QPtrList<KToolBar> KMainWindow::toolBarList() const
or just the number of toolbars
uint KMainWindoww::toolBarCount()

or the dirty way without API changes: in 
KMainWindow::saveMainWindowSettings copy the list and use an iterator 
over the copy.

Andras
>
> Jens

- -- 
Quanta Plus developer - http://quanta.sourceforge.net
K Desktop Environment - http://www.kde.org
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.4 (GNU/Linux)

iD8DBQFBCADmTQdfac6L/08RAmn8AJwJm3TXMOm9MEfIjPLejuOKRxQOSACfd01Y
qzrPIjmFGvWmMdABKH9KR6Y=
=O3JJ
-----END PGP SIGNATURE-----




More information about the kde-core-devel mailing list