]> cloud.milkyroute.net Git - dolphin.git/blobdiff - src/dolphincontextmenu.cpp
Implemented one of the most often requested features for Dolphin: allow that the...
[dolphin.git] / src / dolphincontextmenu.cpp
index f40b4787881d79e87aa903584be60774e25f2112..14f71f44953898aab65c0dba917ffe70a3125357 100644 (file)
@@ -25,6 +25,8 @@
 #include "dolphinview.h"
 #include "editbookmarkdialog.h"
 
+#include "dolphin_generalsettings.h"
+
 #include <assert.h>
 
 #include <kactioncollection.h>
@@ -151,13 +153,18 @@ void DolphinContextMenu::openItemContextMenu()
     QAction* renameAction = dolphin->actionCollection()->action("rename");
     popup->addAction(renameAction);
 
-    // insert 'Move to Trash' for local Urls, otherwise insert 'Delete'
+    // insert 'Move to Trash' and (optionally) 'Delete'
+    bool showDeleteCommand = DolphinSettings::instance().generalSettings()->showDeleteCommand();
     const KUrl& url = dolphin->activeView()->url();
     if (url.isLocalFile()) {
         QAction* moveToTrashAction = dolphin->actionCollection()->action("move_to_trash");
         popup->addAction(moveToTrashAction);
     }
     else {
+        showDeleteCommand = true;
+    }
+
+    if (showDeleteCommand) {
         QAction* deleteAction = dolphin->actionCollection()->action("delete");
         popup->addAction(deleteAction);
     }
@@ -317,8 +324,7 @@ QList<QAction*> DolphinContextMenu::insertActionItems(KMenu* popup,
         QStringList entries = dir.entryList(QDir::Files);
 
         for (QStringList::ConstIterator entryIt = entries.begin(); entryIt != entries.end(); ++entryIt) {
-            KSimpleConfig cfg(*dirIt + *entryIt, true);
-            cfg.setDesktopGroup();
+            KConfigGroup cfg(KSharedConfig::openConfig( *dirIt + *entryIt, KConfig::OnlyLocal), "Desktop Entry" );
             if ((cfg.hasKey("Actions") || cfg.hasKey("X-KDE-GetActionMenu")) && cfg.hasKey("ServiceTypes")) {
                 //const QStringList types = cfg.readListEntry("ServiceTypes");
                 QStringList types;