diff --git a/src/config.kcfg b/src/config.kcfg index 7d264da..7a63179 100644 --- a/src/config.kcfg +++ b/src/config.kcfg @@ -51,5 +51,8 @@ 255,255,200 + + true + diff --git a/src/gui/mainwindow.cpp b/src/gui/mainwindow.cpp index e7935cd..9bade5d 100644 --- a/src/gui/mainwindow.cpp +++ b/src/gui/mainwindow.cpp @@ -28,6 +28,7 @@ #include #include #include +#include #include #include #include @@ -138,6 +139,9 @@ void MainWindow::setupActions() actionCollection()->addAction("toggleDockOperations", dockOperations().toggleViewAction()); actionCollection()->addAction("toggleDockInformation", dockInformation().toggleViewAction()); actionCollection()->addAction("toggleDockLog", dockLog().toggleViewAction()); + + // Settings Actions + KStandardAction::showMenubar(this, SLOT(onShowMenuBar()), actionCollection()); } void MainWindow::setupConnections() @@ -222,3 +226,19 @@ bool MainWindow::isKPart() const // If we were instantiated with an action collection we're supposed to be a KPart return m_ActionCollection != NULL; } + +void MainWindow::onShowMenuBar() +{ + QAction* menuBarAction = actionCollection()->action(KStandardAction::name(KStandardAction::ShowMenubar)); + if (menuBarAction->isChecked()) + menuBar()->show(); + else + { + const QString accel = menuBarAction->shortcut().toString(); + KMessageBox::information(this, i18nc("@info", "This will hide the menu bar completely. You can show it again by typing %1.", accel), i18nc("@window:title", "Hide Menu Bar"), "hideMenuBarWarning"); + + menuBar()->hide(); + } + + Config::self()->setShowMenuBar(menuBarAction->isChecked()); +} diff --git a/src/gui/mainwindow.h b/src/gui/mainwindow.h index b6732cb..8d7f953 100644 --- a/src/gui/mainwindow.h +++ b/src/gui/mainwindow.h @@ -98,6 +98,7 @@ class LIBPARTITIONMANAGERPRIVATE_EXPORT MainWindow : public KXmlGuiWindow, publi void on_m_PartitionManagerWidget_devicesChanged(); void on_m_PartitionManagerWidget_operationsChanged(); void on_m_PartitionManagerWidget_selectedPartitionChanged(const Partition* p); + void onShowMenuBar(); private: QLabel* m_StatusText;