Author: vfr
Date: Mon Jan 3 15:39:41 2011
New Revision: 37075
URL: http://www.lyx.org/trac/changeset/37075
Log:
Fix bug #7099: Math toolbars don't autoshow.
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.
Modified:
lyx-devel/trunk/src/frontends/qt4/GuiToolbar.cpp
Modified: lyx-devel/trunk/src/frontends/qt4/GuiToolbar.cpp
==============================================================================
--- lyx-devel/trunk/src/frontends/qt4/GuiToolbar.cpp Mon Jan 3 15:28:33
2011 (r37074)
+++ lyx-devel/trunk/src/frontends/qt4/GuiToolbar.cpp Mon Jan 3 15:39:41
2011 (r37075)
@@ -326,7 +326,17 @@
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);
}