]> git.lyx.org Git - features.git/commitdiff
Fix bug #7099: Math toolbars don't autoshow.
authorVincent van Ravesteijn <vfr@lyx.org>
Mon, 3 Jan 2011 14:39:41 +0000 (14:39 +0000)
committerVincent van Ravesteijn <vfr@lyx.org>
Mon, 3 Jan 2011 14:39:41 +0000 (14:39 +0000)
In GuiApplication::readUIFile() the settings for views gets removed if the ui file is newer than the saved timestamp in the settings. Later the non existing settings will be used to initialize the visibility. The default value for a non existing setting is 0. The visibility_ variable does never get changed afterwards. And therefore
we will again write 0 to the registry.

We should have read the ui file instead when we can't find the registry value.

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@37075 a592a061-630c-0410-9148-cb99ea01b6c8

src/frontends/qt4/GuiToolbar.cpp

index 05e97e912a103cad8f4ac6b4d1b3a6d3eb577d81..93ea4c75525ce68b0d252b8596217fba8db0b760 100644 (file)
@@ -326,7 +326,17 @@ void GuiToolbar::saveSession() const
 void GuiToolbar::restoreSession()
 {
        QSettings settings;
-       setVisibility(settings.value(sessionKey() + "/visibility").toInt());
+       int const error_val = -1;
+       int visibility =
+               settings.value(sessionKey() + "/visibility", error_val).toInt();
+       if (visibility == error_val || visibility == 0) {
+               // The settings have not been found. This can happen when
+               // the ui file has changed so that we use the settings from
+               // the new ui file rather than the old settings.
+               visibility = 
+                       guiApp->toolbars().defaultVisibility(fromqstr(objectName()));
+       }
+       setVisibility(visibility);
 }