┌   ┐
54
└   ┘

summaryrefslogtreecommitdiff
path: root/src/dolphinpart.cpp
diff options
context:
space:
mode:
authorDawit Alemayehu <[email protected]>2013-06-24 01:11:16 -0400
committerDawit Alemayehu <[email protected]>2013-06-24 22:41:53 -0400
commitd72f5d2db72fcbf6d631baa56f5fcd9f7c7a51f9 (patch)
treee23a9685876bc06c8b670abbe1acfaf3adaa8d99 /src/dolphinpart.cpp
parent51b978f7fd7ed02b509f34f2579bf016f78bc5e0 (diff)
Do not show "Move To Trash" action in context menu for remote URLs.
BUG: 261762 REVIEW: 111206 FIXED-IN: 4.11
Diffstat (limited to 'src/dolphinpart.cpp')
-rw-r--r--src/dolphinpart.cpp52
1 files changed, 20 insertions, 32 deletions
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();
+ const bool supportsMoving = capabilities.supportsMoving();
- if (!supportsDeleting) {
+ 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.