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
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);
}