From 52b719af6697a88e0173a35ed85afaf228b714d5 Mon Sep 17 00:00:00 2001 From: Michele Calgaro Date: Thu, 4 Dec 2025 20:21:26 +0900 Subject: 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 --- kpdf/shell/shell.cpp | 33 ++++++++++++++++++++++++++------- 1 file changed, 26 insertions(+), 7 deletions(-) (limited to 'kpdf/shell/shell.cpp') 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(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(toolBarMenuAction()); - } return part; } -- cgit v1.2.3