diff --git a/src/MainWindow.cpp b/src/MainWindow.cpp index 906f8ddc6..0aa76a3f8 100644 --- a/src/MainWindow.cpp +++ b/src/MainWindow.cpp @@ -267,7 +267,6 @@ void MainWindow::setupActions() // View Menu _toggleMenuBarAction = KStandardAction::showMenubar(menuBar(), SLOT(setVisible(bool)), collection); _toggleMenuBarAction->setShortcut( QKeySequence(Qt::CTRL + Qt::SHIFT + Qt::Key_M) ); - _toggleMenuBarAction->setChecked( !menuBar()->isHidden() ); // Hide the Show/Hide menubar item if the menu bar is a MacOS-style menu bar if ( menuBar()->isTopLevelMenu() ) @@ -504,5 +503,17 @@ void MainWindow::configureNotifications() KNotifyConfigWidget::configure( this ); } +void MainWindow::showEvent(QShowEvent *event) +{ + // This code from Konqueror. + // We need to check if our toolbars are shown/hidden here, and set + // our menu items accordingly. We can't do it in the constructor because + // view profiles store toolbar info, and that info is read after + // construct time. + _toggleMenuBarAction->setChecked( !menuBar()->isHidden() ); + // Call parent method + KXmlGuiWindow::showEvent(event); +} + #include "MainWindow.moc" diff --git a/src/MainWindow.h b/src/MainWindow.h index 21aadea3d..0e51e5ee9 100644 --- a/src/MainWindow.h +++ b/src/MainWindow.h @@ -143,6 +143,9 @@ class MainWindow : public KXmlGuiWindow void closeActiveSessionRequest(); protected: + // Reimplemented for internal reasons. + virtual void showEvent(QShowEvent *event); + // reimplemented from KMainWindow virtual bool queryClose(); virtual void saveProperties(KConfigGroup& group);