summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEike Hein <[email protected]>2018-06-13 16:38:10 +0900
committerEike Hein <[email protected]>2018-06-13 16:40:18 +0900
commit6f3a486330d02cd1feb10969ab56113a09f3e0af (patch)
treeabb3d1fe9c0bae4347c2ed3a8377b3a84ec3a35b
parent7909ca22667c615fcaf95a254ada2846e7dec8fe (diff)
Swap Trash for Delete action when only one is enabled and the Shift modifier is pressed
Summary: Now matches Dolphin behavior. BUG:395155 Reviewers: broulik, davidedmundson, mart Subscribers: plasma-devel Tags: #plasma Differential Revision: https://phabricator.kde.org/D13508
-rw-r--r--containments/desktop/package/contents/ui/FolderView.qml8
-rw-r--r--containments/desktop/plugins/folder/foldermodel.cpp5
-rw-r--r--containments/desktop/plugins/folder/foldermodel.h3
3 files changed, 9 insertions, 7 deletions
diff --git a/containments/desktop/package/contents/ui/FolderView.qml b/containments/desktop/package/contents/ui/FolderView.qml
index 077c6ae..c4e7a6c 100644
--- a/containments/desktop/package/contents/ui/FolderView.qml
+++ b/containments/desktop/package/contents/ui/FolderView.qml
@@ -273,12 +273,12 @@ FocusScope {
if (mouse.buttons & Qt.RightButton) {
clearPressState();
- dir.openContextMenu();
+ dir.openContextMenu(null, mouse.modifiers);
mouse.accepted = true;
}
} else {
pressedItem = hoveredItem;
-
+https://bugs.kde.org/show_bug.cgi?id=120008
var pos = mapToItem(hoveredItem.actionsOverlay, mouse.x, mouse.y);
if (!(pos.x <= hoveredItem.actionsOverlay.width && pos.y <= hoveredItem.actionsOverlay.height)) {
@@ -309,7 +309,7 @@ FocusScope {
clearPressState();
- dir.openContextMenu();
+ dir.openContextMenu(null, mouse.modifiers);
mouse.accepted = true;
}
}
@@ -868,7 +868,7 @@ FocusScope {
Keys.onMenuPressed: {
if (currentIndex != -1 && dir.hasSelection() && currentItem) {
dir.setSelected(positioner.map(currentIndex));
- dir.openContextMenu(currentItem.frame);
+ dir.openContextMenu(currentItem.frame, event.modifiers);
} else {
// Otherwise let the containment handle it.
event.accepted = false;
diff --git a/containments/desktop/plugins/folder/foldermodel.cpp b/containments/desktop/plugins/folder/foldermodel.cpp
index 295da0a..8436ccf 100644
--- a/containments/desktop/plugins/folder/foldermodel.cpp
+++ b/containments/desktop/plugins/folder/foldermodel.cpp
@@ -1640,7 +1640,7 @@ void FolderModel::updateActions()
}
}
-void FolderModel::openContextMenu(QQuickItem *visualParent)
+void FolderModel::openContextMenu(QQuickItem *visualParent, Qt::KeyboardModifiers modifiers)
{
QModelIndexList indexes = m_selectionModel->selectedIndexes();
@@ -1728,12 +1728,13 @@ void FolderModel::openContextMenu(QQuickItem *visualParent)
menu->addAction(emptyTrashAction);
}
} else {
- if (!hasRemoteFiles && itemProperties.supportsMoving()) {
+ if (!modifiers.testFlag(Qt::ShiftModifier) && !hasRemoteFiles && itemProperties.supportsMoving()) {
menu->addAction(m_actionCollection.action(QStringLiteral("trash")));
} else {
showDeleteCommand = true;
}
}
+
if (showDeleteCommand && itemProperties.supportsDeleting()) {
menu->addAction(m_actionCollection.action(QStringLiteral("del")));
}
diff --git a/containments/desktop/plugins/folder/foldermodel.h b/containments/desktop/plugins/folder/foldermodel.h
index 42cede2..040072f 100644
--- a/containments/desktop/plugins/folder/foldermodel.h
+++ b/containments/desktop/plugins/folder/foldermodel.h
@@ -225,7 +225,8 @@ class FOLDERPLUGIN_TESTS_EXPORT FolderModel : public QSortFilterProxyModel, publ
Q_INVOKABLE QAction* action(const QString& name) const;
QObject* newMenu() const;
Q_INVOKABLE void updateActions();
- Q_INVOKABLE void openContextMenu(QQuickItem *visualParent = nullptr);
+ Q_INVOKABLE void openContextMenu(QQuickItem *visualParent = nullptr,
+ Qt::KeyboardModifiers modifiers = Qt::NoModifier);
Q_INVOKABLE void linkHere(const QUrl &sourceUrl);