Am 03.01.2011 um 13:13 schrieb Vincent van Ravesteijn:

> Hmm.. gmail sent the mail to early:
> 
> 
>> void GuiToolbar::restoreSession()
>> {
>>        QSettings settings;
>> 
>>        setVisibility(settings.value(sessionKey() + "/visibility").toInt());
>> }
>> 
>> 
> 
> void GuiToolbar::restoreSession()
> {
>       QSettings settings;
>       int const error_val = -1;
>       int visibility = settings.value(sessionKey() + "/visibility",
> error_val).toInt();
>       if (visibility == error_val) {
>            LYXERR0("Settings are screwed up! Falling back to the defaults.");
>            visibility =
> guiApp->toolbars().defaultVisibility(fromqstr(objectName()));
>       }
>       setVisibility(visibility);
> }
> 
> This is what I wanted to propose.

In principle this would be fine.

I would add the name of the toolbar to the error message.
And if the settings were written with the default value for visibility_ (0)
then restoreSession() happily will restore that nonsense value.

Stephan

PS: I forgot to mention again the change below...

Index: src/frontends/qt4/GuiToolbar.h
===================================================================
--- src/frontends/qt4/GuiToolbar.h      (Revision 37069)
+++ src/frontends/qt4/GuiToolbar.h      (Arbeitskopie)
@@ -112,8 +112,6 @@
        void showEvent(QShowEvent *);
 
        ///
-       QString name_;
-       ///
        QList<Action *> actions_;
        /// initial visibility flags
        int visibility_;

Reply via email to