From b0cedbeefae19607e99abfe3084595720e364771 Mon Sep 17 00:00:00 2001 From: Claudio Cambra Date: Fri, 18 Oct 2024 11:47:54 +0800 Subject: [PATCH 1/2] Add a context menu for the sharees search field Signed-off-by: Claudio Cambra --- src/gui/filedetails/ShareeSearchField.qml | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/src/gui/filedetails/ShareeSearchField.qml b/src/gui/filedetails/ShareeSearchField.qml index 6017eea72f55..e4443f5fb9c9 100644 --- a/src/gui/filedetails/ShareeSearchField.qml +++ b/src/gui/filedetails/ShareeSearchField.qml @@ -94,6 +94,10 @@ TextField { } } } + onPressed: function(mouse) { + if (mouse.button !== Qt.RightButton) return; + contextMenu.popup(mouse.x, mouse.y); + } leftPadding: searchIcon.width + searchIcon.anchors.leftMargin + horizontalPaddingOffset rightPadding: clearTextButton.width + clearTextButton.anchors.rightMargin + horizontalPaddingOffset @@ -165,6 +169,23 @@ TextField { } } + Menu { + id: contextMenu + MenuItem { + text: qsTr("Cut") + onTriggered: root.cut() + } + MenuItem { + text: qsTr("Copy") + onTriggered: root.copy() + } + MenuItem { + text: qsTr("Paste") + onTriggered: root.paste() + } + } + + Popup { id: suggestionsPopup From f7968f5449b5fe69c6568291d2375040834b8362 Mon Sep 17 00:00:00 2001 From: Claudio Cambra Date: Fri, 18 Oct 2024 12:03:03 +0800 Subject: [PATCH 2/2] Ensure sharee suggestions popup does not appear on top of sharee field context menu Signed-off-by: Claudio Cambra --- src/gui/filedetails/ShareeSearchField.qml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gui/filedetails/ShareeSearchField.qml b/src/gui/filedetails/ShareeSearchField.qml index e4443f5fb9c9..39139c0c3ad9 100644 --- a/src/gui/filedetails/ShareeSearchField.qml +++ b/src/gui/filedetails/ShareeSearchField.qml @@ -42,7 +42,7 @@ TextField { readonly property double iconsScaleFactor: 0.6 function triggerSuggestionsVisibility() { - shareeListView.count > 0 ? suggestionsPopup.open() : suggestionsPopup.close(); + !contextMenu.opened && shareeListView.count > 0 ? suggestionsPopup.open() : suggestionsPopup.close(); } placeholderText: enabled ? qsTr("Search for users or groups…") : qsTr("Sharing is not available for this folder")