From 02134c4fc664334be07036d7511c89382376e480 Mon Sep 17 00:00:00 2001 From: xiphon Date: Fri, 30 Nov 2018 03:51:03 +0000 Subject: transfer: paste Payment URL to fill the payment form fields --- components/LineEditMulti.qml | 46 +++++++++++++++++++++++++++++--------------- 1 file changed, 30 insertions(+), 16 deletions(-) (limited to 'components') diff --git a/components/LineEditMulti.qml b/components/LineEditMulti.qml index 87cee6d4..63b2dee2 100644 --- a/components/LineEditMulti.qml +++ b/components/LineEditMulti.qml @@ -74,6 +74,10 @@ ColumnLayout { property bool mouseSelection: true property alias readOnly: input.readOnly property bool copyButton: false + property bool pasteButton: false + property var onPaste: function(clipboardText) { + item.text = clipboardText; + } property bool showingHeader: true property var wrapMode: Text.NoWrap property alias addressValidation: input.addressValidation @@ -109,25 +113,35 @@ ColumnLayout { } } - MoneroComponents.LabelButton { - id: labelButton - onClicked: labelButtonClicked() - visible: labelButtonVisible - } + RowLayout { + anchors.right: parent.right + spacing: 16 * scaleRatio + + MoneroComponents.LabelButton { + id: labelButton + onClicked: labelButtonClicked() + visible: labelButtonVisible + } - MoneroComponents.LabelButton { - id: copyButtonId - visible: copyButton && input.text !== "" - text: qsTr("Copy") - anchors.right: labelButton.visible ? inputLabel.right : parent.right - anchors.rightMargin: labelButton.visible? 4 : 0 - onClicked: { - if (input.text.length > 0) { - console.log("Copied to clipboard"); - clipboard.setText(input.text); - appWindow.showStatusMessage(qsTr("Copied to clipboard"), 3); + MoneroComponents.LabelButton { + id: copyButtonId + visible: copyButton && input.text !== "" + text: qsTr("Copy") + onClicked: { + if (input.text.length > 0) { + console.log("Copied to clipboard"); + clipboard.setText(input.text); + appWindow.showStatusMessage(qsTr("Copied to clipboard"), 3); + } } } + + MoneroComponents.LabelButton { + id: pasteButtonId + onClicked: item.onPaste(clipboard.text()) + text: qsTr("Paste") + visible: pasteButton + } } } -- cgit v1.2.3