]> cloud.milkyroute.net Git - dolphin.git/commitdiff
Add "Open Path" context menu action
authorKai Uwe Broulik <kde@privat.broulik.de>
Tue, 9 Sep 2014 13:31:55 +0000 (15:31 +0200)
committerKai Uwe Broulik <kde@privat.broulik.de>
Tue, 9 Sep 2014 13:31:55 +0000 (15:31 +0200)
This adds a third option to the "in new tab" and "in new window" which opens
the parent folder in the same view

BUG: 298704
FIXED-IN: 4.15
REVIEW: 110133

src/dolphincontextmenu.cpp
src/dolphincontextmenu.h
src/dolphinmainwindow.cpp

index 22272fb74b10f0c1b1530947dba850603fca9165..e74adca5584ef34ec4c0dc9fab2bc624fd48b6b8 100644 (file)
@@ -200,6 +200,7 @@ void DolphinContextMenu::openItemContextMenu()
 {
     Q_ASSERT(!m_fileInfo.isNull());
 
+    QAction* openParentAction = 0;
     QAction* openParentInNewWindowAction = 0;
     QAction* openParentInNewTabAction = 0;
     QAction* addToPlacesAction = 0;
@@ -235,7 +236,13 @@ void DolphinContextMenu::openItemContextMenu()
             }
 
             addSeparator();
-        } else if (m_baseUrl.protocol().contains("search")) {
+        } else if (m_baseUrl.protocol().contains("search") || m_baseUrl.protocol().contains("timeline")) {
+            openParentAction = new QAction(QIcon::fromTheme("document-open-folder"),
+                                           i18nc("@action:inmenu",
+                                                 "Open Path"),
+                                           this);
+            addAction(openParentAction);
+
             openParentInNewWindowAction = new QAction(QIcon::fromTheme("window-new"),
                                                     i18nc("@action:inmenu",
                                                           "Open Path in New Window"),
@@ -306,6 +313,8 @@ void DolphinContextMenu::openItemContextMenu()
                 PlacesItem* item = model.createPlacesItem(text, selectedUrl);
                 model.appendItemToGroup(item);
             }
+        } else if (activatedAction == openParentAction) {
+            m_command = OpenParentFolder;
         } else if (activatedAction == openParentInNewWindowAction) {
             m_command = OpenParentFolderInNewWindow;
         } else if (activatedAction == openParentInNewTabAction) {
index 180f91787c0f3ccb842bc900d878185940e7f9c7..3646ebcb5114b13991dbb2e82f74fe2d84497f4c 100644 (file)
@@ -58,6 +58,7 @@ public:
     enum Command
     {
         None,
+        OpenParentFolder,
         OpenParentFolderInNewWindow,
         OpenParentFolderInNewTab
     };
index 21d13202016f882a342676e2580a21d2c0ce1923..f9ebe33ac5258c56e45c7c236728207b4189c38d 100644 (file)
@@ -773,6 +773,10 @@ void DolphinMainWindow::openContextMenu(const QPoint& pos,
     const DolphinContextMenu::Command command = contextMenu.data()->open();
 
     switch (command) {
+    case DolphinContextMenu::OpenParentFolder:
+        changeUrl(KIO::upUrl(item.url()));
+        break;
+
     case DolphinContextMenu::OpenParentFolderInNewWindow: {
 
         KRun::run("dolphin %u", QList<QUrl>() << KIO::upUrl(item.url()), this);