diff options
Diffstat (limited to 'kpdf/shell/shell.cpp')
| -rw-r--r-- | kpdf/shell/shell.cpp | 49 |
1 files changed, 42 insertions, 7 deletions
diff --git a/kpdf/shell/shell.cpp b/kpdf/shell/shell.cpp index dd2adf2e..ed9403df 100644 --- a/kpdf/shell/shell.cpp +++ b/kpdf/shell/shell.cpp @@ -50,6 +50,8 @@ Shell::Shell() : DCOPObject("KPDFShellDCOPIface"), KParts::MainWindow(0, "KPDF::Shell"), m_menuBarWasShown(true), m_toolBarWasShown(true), + m_shuttingDown(false), + m_showToolBarAction(nullptr), m_tabs(nullptr), m_tabsContextMenu(nullptr), m_manager(nullptr), @@ -62,6 +64,8 @@ Shell::Shell(const KURL &url) : DCOPObject("KPDFShellDCOPIface"), KParts::MainWindow(0, "KPDF::Shell"), m_menuBarWasShown(true), m_toolBarWasShown(true), + m_shuttingDown(false), + m_showToolBarAction(nullptr), m_tabs(nullptr), m_tabsContextMenu(nullptr), m_manager(nullptr), @@ -99,6 +103,8 @@ void Shell::init() this, TQ_SLOT(createGUI(KParts::Part*))); connect(m_manager, TQ_SIGNAL(activePartChanged(KParts::Part*)), this, TQ_SLOT(slotChangeTab(KParts::Part*))); + connect(tdeApp, TQ_SIGNAL(shutDown()), + this, TQ_SLOT(slotShutDown())); setCentralWidget(m_tabs); setXMLFile("shell.rc"); @@ -106,7 +112,6 @@ void Shell::init() setupActions(); setupGUI(Keys | Save); - readSettings(); if (!TDEGlobal::config()->hasGroup("MainWindow")) { TDEMainWindowInterface kmwi(this); @@ -120,6 +125,7 @@ void Shell::init() TQTimer::singleShot(0, this, TQ_SLOT(delayedOpen())); } + readSettings(); reconfigure(); } @@ -184,15 +190,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(); } @@ -383,10 +412,6 @@ KParts::ReadOnlyPart* Shell::createTab() part->widget()->show(); m_manager->addPart(part, true); - if (!m_showToolBarAction) - { - m_showToolBarAction = static_cast<TDEToggleAction*>(toolBarMenuAction()); - } return part; } @@ -412,8 +437,18 @@ void Shell::removeTab() m_workingTab = -1; } +void Shell::slotShutDown() +{ + m_shuttingDown = true; +} + void Shell::slotChangeTab(KParts::Part *part) { + if (m_shuttingDown) + { + return; + } + if (!part) { part = createTab(); |
