]> cloud.milkyroute.net Git - dolphin.git/blobdiff - src/dolphincontextmenu.cpp
kdelibs4support--
[dolphin.git] / src / dolphincontextmenu.cpp
index 1fca7509bf3fb68fbdb2897894ca916b98b43607..ccfd290e007ab879f407ba4181ee388e68fc36ea 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>
@@ -48,7 +50,6 @@
 #include <KLocale>
 #include <KPropertiesDialog>
 #include <KStandardAction>
-#include <KStandardDirs>
 #include <KToolBar>
 
 #include <panels/places/placesitem.h>
@@ -158,7 +159,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 +199,7 @@ void DolphinContextMenu::openItemContextMenu()
 {
     Q_ASSERT(!m_fileInfo.isNull());
 
+    QAction* openParentAction = 0;
     QAction* openParentInNewWindowAction = 0;
     QAction* openParentInNewTabAction = 0;
     QAction* addToPlacesAction = 0;
@@ -227,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"),
@@ -298,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) {
@@ -381,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());