diff options
| author | luigi1111 <luigi1111w@gmail.com> | 2021-11-26 22:48:40 -0600 |
|---|---|---|
| committer | luigi1111 <luigi1111w@gmail.com> | 2021-11-26 22:48:40 -0600 |
| commit | 80cd2e08a4bb4638aba0bd3c1243406c61bd2b59 (patch) | |
| tree | 84fc2d543e477d559b9aa356578afde1527caa48 /components/ContextMenu.qml | |
| parent | 97755e1b34cb2e31e538a9e5380e52677e9a831d (diff) | |
| parent | d3780abe33f8e78125eda7546fa2e14a4cfc4fab (diff) | |
| download | monzero-gui-80cd2e08a4bb4638aba0bd3c1243406c61bd2b59.tar.gz monzero-gui-80cd2e08a4bb4638aba0bd3c1243406c61bd2b59.tar.xz monzero-gui-80cd2e08a4bb4638aba0bd3c1243406c61bd2b59.zip | |
Merge pull request #3689
d3780ab ContextMenu: add Cut, Copy, Delete and Select All (rating89us)
Diffstat (limited to 'components/ContextMenu.qml')
| -rw-r--r-- | components/ContextMenu.qml | 46 |
1 files changed, 42 insertions, 4 deletions
diff --git a/components/ContextMenu.qml b/components/ContextMenu.qml index a4ca3209..efbd38ab 100644 --- a/components/ContextMenu.qml +++ b/components/ContextMenu.qml @@ -5,14 +5,21 @@ import FontAwesome 1.0 import "../components" as MoneroComponents MouseArea { + signal cut() + signal copy() signal paste() + signal remove() + signal selectAll() id: root acceptedButtons: Qt.RightButton anchors.fill: parent onClicked: { - if (mouse.button === Qt.RightButton) + if (mouse.button === Qt.RightButton) { + root.parent.persistentSelection = true; contextMenu.open() + root.parent.cursorVisible = true; + } } Menu { @@ -22,19 +29,50 @@ MouseArea { border.color: MoneroComponents.Style.buttonBackgroundColorDisabledHover border.width: 1 radius: 2 - color: MoneroComponents.Style.buttonBackgroundColorDisabled + color: MoneroComponents.Style.blackTheme ? MoneroComponents.Style.buttonBackgroundColorDisabled : "#E5E5E5" } padding: 1 - width: 100 + width: 110 x: root.mouseX y: root.mouseY + onClosed: { + if (!root.parent.activeFocus) { + root.parent.cursorVisible = false; + } + root.parent.persistentSelection = false; + root.parent.forceActiveFocus() + } + + MoneroComponents.ContextMenuItem { + enabled: root.parent.selectedText != "" && !root.parent.readOnly + onTriggered: root.cut() + text: qsTr("Cut") + translationManager.emptyString + } + + MoneroComponents.ContextMenuItem { + enabled: root.parent.selectedText != "" + onTriggered: root.copy() + text: qsTr("Copy") + translationManager.emptyString + } + MoneroComponents.ContextMenuItem { enabled: root.parent.canPaste === true - glyphIcon: FontAwesome.paste onTriggered: root.paste() text: qsTr("Paste") + translationManager.emptyString } + + MoneroComponents.ContextMenuItem { + enabled: root.parent.selectedText != "" && !root.parent.readOnly + onTriggered: root.remove() + text: qsTr("Delete") + translationManager.emptyString + } + + MoneroComponents.ContextMenuItem { + enabled: root.parent.text != "" + onTriggered: root.selectAll() + text: qsTr("Select All") + translationManager.emptyString + } } } |
