summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichele Calgaro <michele.calgaro@yahoo.it>2025-12-04 20:21:26 +0900
committerMichele Calgaro <michele.calgaro@yahoo.it>2025-12-05 14:04:10 +0900
commit52b719af6697a88e0173a35ed85afaf228b714d5 (patch)
tree66acc636a41109f9fc60bd77f68f53edf3218e82
parent2f927acd565e0741e8c299c89152e1cf92ecac43 (diff)
downloadtdegraphics-52b719af6697a88e0173a35ed85afaf228b714d5.tar.gz
tdegraphics-52b719af6697a88e0173a35ed85afaf228b714d5.zip
kpdf: fix crash when starting in fullscreen mode. Also remember
visibility settings for the menubar and toolbar across multiple runs and whether we exit the application in normal mode or fullscreen mode. This resolves issue #144 and replaces PR #145. Signed-off-by: Michele Calgaro <michele.calgaro@yahoo.it>
-rw-r--r--kpdf/shell/shell.cpp33
1 files changed, 26 insertions, 7 deletions
diff --git a/kpdf/shell/shell.cpp b/kpdf/shell/shell.cpp
index 79d1d83d..c0df6a4f 100644
--- a/kpdf/shell/shell.cpp
+++ b/kpdf/shell/shell.cpp
@@ -108,7 +108,6 @@ void Shell::init()
setupActions();
setupGUI(Keys | Save);
- readSettings();
if (!TDEGlobal::config()->hasGroup("MainWindow"))
{
TDEMainWindowInterface kmwi(this);
@@ -122,6 +121,7 @@ void Shell::init()
TQTimer::singleShot(0, this, TQ_SLOT(delayedOpen()));
}
+ readSettings();
reconfigure();
}
@@ -186,15 +186,38 @@ void Shell::readSettings()
m_recent->setToolTip( i18n("Click to open a file\nClick and hold to open a recent file") );
TDEGlobal::config()->setDesktopGroup();
+ m_menuBarWasShown = TDEGlobal::config()->readBoolEntry( "ShowMenuBar", true );
+ m_showMenuBarAction->setChecked(m_menuBarWasShown);
+ slotShowMenubar();
+
+ m_toolBarWasShown = TDEGlobal::config()->readBoolEntry( "ShowToolBar", true );
+ m_showToolBarAction = static_cast<TDEToggleAction*>(toolBarMenuAction());
+ if (m_toolBarWasShown)
+ {
+ toolBar()->show();
+ }
+ else
+ {
+ toolBar()->hide();
+ }
+
bool fullScreen = TDEGlobal::config()->readBoolEntry( "FullScreen", false );
- setFullScreen( fullScreen );
+ setFullScreen(fullScreen);
}
void Shell::writeSettings()
{
m_recent->saveEntries( TDEGlobal::config() );
TDEGlobal::config()->setDesktopGroup();
- TDEGlobal::config()->writeEntry( "FullScreen", m_fullScreenAction->isChecked());
+ bool fullScreen = m_fullScreenAction->isChecked();
+ if (!fullScreen)
+ {
+ m_menuBarWasShown = m_showMenuBarAction->isChecked();
+ m_toolBarWasShown = m_showToolBarAction->isChecked();
+ }
+ TDEGlobal::config()->writeEntry( "ShowMenuBar", m_menuBarWasShown);
+ TDEGlobal::config()->writeEntry( "ShowToolBar", m_toolBarWasShown);
+ TDEGlobal::config()->writeEntry( "FullScreen", fullScreen);
TDEGlobal::config()->sync();
}
@@ -385,10 +408,6 @@ KParts::ReadOnlyPart* Shell::createTab()
part->widget()->show();
m_manager->addPart(part, true);
- if (!m_showToolBarAction)
- {
- m_showToolBarAction = static_cast<TDEToggleAction*>(toolBarMenuAction());
- }
return part;
}