]> cloud.milkyroute.net Git - dolphin.git/blobdiff - src/dolphincontextmenu.cpp
Clean includes + port to QMenu
[dolphin.git] / src / dolphincontextmenu.cpp
index 22272fb74b10f0c1b1530947dba850603fca9165..84a09f4d256a086c96f42b3de1cc1e6e5a679467 100644 (file)
@@ -39,7 +39,7 @@
 #include <KIO/JobUiDelegate>
 #include <KJobUiDelegate>
 #include <KJobWidgets>
-#include <KMenu>
+#include <QMenu>
 #include <KMenuBar>
 #include <KMessageBox>
 #include <KMimeTypeTrader>
@@ -50,7 +50,6 @@
 #include <KLocale>
 #include <KPropertiesDialog>
 #include <KStandardAction>
-#include <KStandardDirs>
 #include <KToolBar>
 
 #include <panels/places/placesitem.h>
@@ -67,7 +66,7 @@ DolphinContextMenu::DolphinContextMenu(DolphinMainWindow* parent,
                                        const QPoint& pos,
                                        const KFileItem& fileInfo,
                                        const KUrl& baseUrl) :
-    KMenu(parent),
+    QMenu(parent),
     m_pos(pos),
     m_mainWindow(parent),
     m_fileInfo(fileInfo),
@@ -132,7 +131,7 @@ void DolphinContextMenu::keyPressEvent(QKeyEvent *ev)
     if (m_removeAction && ev->key() == Qt::Key_Shift) {
         m_removeAction->update();
     }
-    KMenu::keyPressEvent(ev);
+    QMenu::keyPressEvent(ev);
 }
 
 void DolphinContextMenu::keyReleaseEvent(QKeyEvent *ev)
@@ -140,7 +139,7 @@ void DolphinContextMenu::keyReleaseEvent(QKeyEvent *ev)
     if (m_removeAction && ev->key() == Qt::Key_Shift) {
         m_removeAction->update();
     }
-    KMenu::keyReleaseEvent(ev);
+    QMenu::keyReleaseEvent(ev);
 }
 
 void DolphinContextMenu::openTrashContextMenu()
@@ -200,6 +199,7 @@ void DolphinContextMenu::openItemContextMenu()
 {
     Q_ASSERT(!m_fileInfo.isNull());
 
+    QAction* openParentAction = 0;
     QAction* openParentInNewWindowAction = 0;
     QAction* openParentInNewTabAction = 0;
     QAction* addToPlacesAction = 0;
@@ -235,7 +235,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 +312,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) {
@@ -389,7 +397,7 @@ void DolphinContextMenu::insertDefaultItemActions(const KFileItemListProperties&
 
     // Insert 'Move to Trash' and/or 'Delete'
     if (properties.supportsDeleting()) {
-        const bool showDeleteAction = (KGlobal::config()->group("KDE").readEntry("ShowDeleteCommand", false) ||
+        const bool showDeleteAction = (KSharedConfig::openConfig()->group("KDE").readEntry("ShowDeleteCommand", false) ||
                                        !properties.isLocal());
         const bool showMoveToTrashAction = (properties.isLocal() &&
                                             properties.supportsMoving());