┌   ┐
54
└   ┘

summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorPeter Penz <[email protected]>2011-03-27 19:27:27 +0200
committerPeter Penz <[email protected]>2011-03-27 19:29:23 +0200
commit2dcc433ab2c353a40e3c65f3df46e8a1eac697cc (patch)
tree09438f59d9294596e988ca36c59c2db848754d03 /src
parentc80b261505d513dda50f54ab6ececa5cf9ca2d28 (diff)
DolphinContextMenu: Show "Show menubar" entry if necessary
If the user has hidden the menubar and the toolbar there is no way to get back the menu (at least not without knowing the Ctrl+M shortcut). Show an entry in the context-menu to bring back the menubar.
Diffstat (limited to 'src')
-rw-r--r--src/dolphincontextmenu.cpp15
-rw-r--r--src/dolphincontextmenu.h6
2 files changed, 21 insertions, 0 deletions
diff --git a/src/dolphincontextmenu.cpp b/src/dolphincontextmenu.cpp
index 07c934e33..0aa82b206 100644
--- a/src/dolphincontextmenu.cpp
+++ b/src/dolphincontextmenu.cpp
@@ -49,6 +49,7 @@
#include <KPropertiesDialog>
#include <KStandardAction>
#include <KStandardDirs>
+#include <KToolBar>
#include <QApplication>
#include <QClipboard>
@@ -184,6 +185,8 @@ void DolphinContextMenu::openTrashContextMenu()
QAction* propertiesAction = m_mainWindow->actionCollection()->action("properties");
m_popup->addAction(propertiesAction);
+ addShowMenuBarAction();
+
QAction *action = m_popup->exec(QCursor::pos());
if (action == emptyTrashAction) {
const QString text(i18nc("@info", "Do you really want to empty the Trash? All items will be deleted."));
@@ -365,6 +368,8 @@ void DolphinContextMenu::openViewportContextMenu()
QAction* propertiesAction = m_popup->addAction(i18nc("@action:inmenu", "Properties"));
propertiesAction->setIcon(KIcon("document-properties"));
+ addShowMenuBarAction();
+
QAction* action = m_popup->exec(QCursor::pos());
if (action == propertiesAction) {
const KUrl& url = m_mainWindow->activeViewContainer()->url();
@@ -405,6 +410,16 @@ void DolphinContextMenu::insertDefaultItemActions()
}
}
+void DolphinContextMenu::addShowMenuBarAction()
+{
+ const KActionCollection* ac = m_mainWindow->actionCollection();
+ QAction* showMenuBar = ac->action(KStandardAction::name(KStandardAction::ShowMenubar));
+ if (!m_mainWindow->menuBar()->isVisible() && !m_mainWindow->toolBar()->isVisible()) {
+ m_popup->addSeparator();
+ m_popup->addAction(showMenuBar);
+ }
+}
+
QString DolphinContextMenu::placesName(const KUrl& url) const
{
QString name = url.fileName();
diff --git a/src/dolphincontextmenu.h b/src/dolphincontextmenu.h
index 1c1cabb82..50fce4439 100644
--- a/src/dolphincontextmenu.h
+++ b/src/dolphincontextmenu.h
@@ -123,6 +123,12 @@ private:
void insertDefaultItemActions();
/**
+ * Adds the "Show menubar" action to the menu if the
+ * menubar is hidden.
+ */
+ void addShowMenuBarAction();
+
+ /**
* Returns a name for adding the URL \a url to the Places panel.
*/
QString placesName(const KUrl& url) const;