]> cloud.milkyroute.net Git - dolphin.git/blobdiff - src/dolphincontextmenu.cpp
Port away from KonqOperations::renameV2.
[dolphin.git] / src / dolphincontextmenu.cpp
index 1fca7509bf3fb68fbdb2897894ca916b98b43607..e74adca5584ef34ec4c0dc9fab2bc624fd48b6b8 100644 (file)
@@ -35,6 +35,8 @@
 #include <KGlobal>
 #include <KIconLoader>
 #include <KIO/RestoreJob>
+#include <KIO/EmptyTrashJob>
+#include <KIO/JobUiDelegate>
 #include <KJobUiDelegate>
 #include <KJobWidgets>
 #include <KMenu>
@@ -158,7 +160,13 @@ void DolphinContextMenu::openTrashContextMenu()
     addShowMenuBarAction();
 
     if (exec(m_pos) == emptyTrashAction) {
-        KonqOperations::emptyTrash(m_mainWindow);
+        KIO::JobUiDelegate uiDelegate;
+        uiDelegate.setWindow(m_mainWindow);
+        if (uiDelegate.askDeleteConfirmation(QList<QUrl>(), KIO::JobUiDelegate::EmptyTrash, KIO::JobUiDelegate::DefaultConfirmation)) {
+            KIO::Job* job = KIO::emptyTrash();
+            KJobWidgets::setWindow(job, m_mainWindow);
+            job->ui()->setAutoErrorHandlingEnabled(true);
+        }
     }
 }
 
@@ -192,6 +200,7 @@ void DolphinContextMenu::openItemContextMenu()
 {
     Q_ASSERT(!m_fileInfo.isNull());
 
+    QAction* openParentAction = 0;
     QAction* openParentInNewWindowAction = 0;
     QAction* openParentInNewTabAction = 0;
     QAction* addToPlacesAction = 0;
@@ -227,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"),
@@ -298,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) {