diff options
| author | rating89us <45968869+rating89us@users.noreply.github.com> | 2021-09-05 15:36:38 +0200 |
|---|---|---|
| committer | rating89us <45968869+rating89us@users.noreply.github.com> | 2021-09-05 15:52:51 +0200 |
| commit | d3780abe33f8e78125eda7546fa2e14a4cfc4fab (patch) | |
| tree | 3c09afb67eed4f0be74c0abfa18b16d626f04418 /components/ContextMenu.qml | |
| parent | 113efbfdf093401d3044ce370b7039ea8cc596bf (diff) | |
| download | monzero-gui-d3780abe33f8e78125eda7546fa2e14a4cfc4fab.tar.gz monzero-gui-d3780abe33f8e78125eda7546fa2e14a4cfc4fab.tar.xz monzero-gui-d3780abe33f8e78125eda7546fa2e14a4cfc4fab.zip | |
ContextMenu: add Cut, Copy, Delete and Select All
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 + } } } |
