X-Git-Url: https://cloud.milkyroute.net/gitweb/dolphin.git/blobdiff_plain/a05db2f0d081a67f306141e2f31442eea49dd71b..d72f5d2db72fcbf6d631baa56f5fcd9f7c7a51f9:/src/dolphinpart.cpp diff --git a/src/dolphinpart.cpp b/src/dolphinpart.cpp index 642b15013..e8138eb8e 100644 --- a/src/dolphinpart.cpp +++ b/src/dolphinpart.cpp @@ -426,10 +426,27 @@ void DolphinPart::slotOpenContextMenu(const QPoint& pos, editActions += customActions; if (!_item.isNull()) { // only for context menu on one or more items - bool supportsDeleting = capabilities.supportsDeleting(); - bool supportsMoving = capabilities.supportsMoving(); - - if (!supportsDeleting) { + const bool supportsMoving = capabilities.supportsMoving(); + + if (capabilities.supportsDeleting()) { + const bool showDeleteAction = (KGlobal::config()->group("KDE").readEntry("ShowDeleteCommand", false) || + !item.isLocalFile()); + const bool showMoveToTrashAction = capabilities.isLocal() && supportsMoving; + + if (showDeleteAction && showMoveToTrashAction) { + delete m_removeAction; + m_removeAction = 0; + editActions.append(actionCollection()->action("move_to_trash")); + editActions.append(actionCollection()->action("delete")); + } else if (showDeleteAction && !showMoveToTrashAction) { + editActions.append(actionCollection()->action("delete")); + } else { + if (!m_removeAction) + m_removeAction = new DolphinRemoveAction(this, actionCollection()); + editActions.append(m_removeAction); + m_removeAction->update(); + } + } else { popupFlags |= KParts::BrowserExtension::NoDeletion; } @@ -437,35 +454,6 @@ void DolphinPart::slotOpenContextMenu(const QPoint& pos, editActions.append(actionCollection()->action("rename")); } - bool addTrash = capabilities.isLocal() && supportsMoving; - bool addDel = false; - if (supportsDeleting) { - if ( !item.isLocalFile() ) - addDel = true; - else if (QApplication::keyboardModifiers() & Qt::ShiftModifier) { - addTrash = false; - addDel = true; - } - else { - KSharedConfig::Ptr globalConfig = KSharedConfig::openConfig("kdeglobals", KConfig::IncludeGlobals); - KConfigGroup configGroup(globalConfig, "KDE"); - addDel = configGroup.readEntry("ShowDeleteCommand", false); - } - } - - if (!addTrash || !addDel) { - if (!m_removeAction) { - m_removeAction = new DolphinRemoveAction(this, actionCollection()); - } - editActions.append(m_removeAction); - m_removeAction->update(); - } else { - delete m_removeAction; - m_removeAction = 0; - editActions.append(actionCollection()->action("move_to_trash")); - editActions.append(actionCollection()->action("delete")); - } - // Normally KonqPopupMenu only shows the "Create new" submenu in the current view // since otherwise the created file would not be visible. // But in treeview mode we should allow it.