diff --git a/containments/desktop/package/contents/ui/FolderView.qml b/containments/desktop/package/contents/ui/FolderView.qml --- a/containments/desktop/package/contents/ui/FolderView.qml +++ b/containments/desktop/package/contents/ui/FolderView.qml @@ -273,12 +273,12 @@ 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 @@ clearPressState(); - dir.openContextMenu(); + dir.openContextMenu(null, mouse.modifiers); mouse.accepted = true; } } @@ -868,7 +868,7 @@ 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.h b/containments/desktop/plugins/folder/foldermodel.h --- a/containments/desktop/plugins/folder/foldermodel.h +++ b/containments/desktop/plugins/folder/foldermodel.h @@ -225,7 +225,8 @@ 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); diff --git a/containments/desktop/plugins/folder/foldermodel.cpp b/containments/desktop/plugins/folder/foldermodel.cpp --- a/containments/desktop/plugins/folder/foldermodel.cpp +++ b/containments/desktop/plugins/folder/foldermodel.cpp @@ -1640,7 +1640,7 @@ } } -void FolderModel::openContextMenu(QQuickItem *visualParent) +void FolderModel::openContextMenu(QQuickItem *visualParent, Qt::KeyboardModifiers modifiers) { QModelIndexList indexes = m_selectionModel->selectedIndexes(); @@ -1728,12 +1728,13 @@ 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"))); }