From 55c3d07a143c56fe404aedc652263c94af393d6d Mon Sep 17 00:00:00 2001 From: xiphon Date: Fri, 21 Dec 2018 16:32:26 +0000 Subject: [PATCH] Transfer: hide PaymentId and Description by default --- images/minus-white.png | Bin 0 -> 170 bytes images/minus-white@2x.png | Bin 0 -> 170 bytes images/plus-white.png | Bin 0 -> 193 bytes images/plus-white@2x.png | Bin 0 -> 195 bytes pages/Transfer.qml | 70 ++++++++++++++++++++++++++++++-------- qml.qrc | 4 +++ 6 files changed, 60 insertions(+), 14 deletions(-) create mode 100644 images/minus-white.png create mode 100644 images/minus-white@2x.png create mode 100644 images/plus-white.png create mode 100644 images/plus-white@2x.png diff --git a/images/minus-white.png b/images/minus-white.png new file mode 100644 index 0000000000000000000000000000000000000000..b42bee8e1cfcae55d0901c1e4037e15794455658 GIT binary patch literal 170 zcmeAS@N?(olHy`uVBq!ia0vp^JRr=$1|-8uW1a&kmSQK*5Dp-y;YjHK@;M7UB8wRq z#8g3;(KATp15i-1#5JNMI6tkVJh3R1p}f3YFEcN@I61K(RWH9NefB#WDWD>CPZ!4! zjfu$#62BTg{{R14nJ z=y-xKnVFfJZKu>uXl#7Qu&eFANvRMwGqba@ grr#k3X9GEg+50p<$Efen0Gh<$>FVdQ&MBb@0NJ)Tn*aa+ literal 0 HcmV?d00001 diff --git a/images/plus-white@2x.png b/images/plus-white@2x.png new file mode 100644 index 0000000000000000000000000000000000000000..54611b87e159e179598557266828922031132b56 GIT binary patch literal 195 zcmeAS@N?(olHy`uVBq!ia0vp^5+KaM1|%Pp+x`GjEX7WqAsj$Z!;#Vf4nJ z=y-!L<5JscD}jQNC9V-A!TD(=<%vb94CUqJdYO6I#mR{Use1WE>9gP2NC6c&c)B=- zcyuPGC@}r`|Np>S)IgbDU literal 0 HcmV?d00001 diff --git a/pages/Transfer.qml b/pages/Transfer.qml index bcb23d07..45cf7d4e 100644 --- a/pages/Transfer.qml +++ b/pages/Transfer.qml @@ -71,17 +71,27 @@ Rectangle { function updateFromQrCode(address, payment_id, amount, tx_description, recipient_name) { console.log("updateFromQrCode") addressLine.text = address - paymentIdLine.text = payment_id + setPaymentId(payment_id); amountLine.text = amount - descriptionLine.text = recipient_name + " " + tx_description + setDescription(recipient_name + " " + tx_description); cameraUi.qrcode_decoded.disconnect(updateFromQrCode) } + function setDescription(value) { + descriptionLine.text = value; + descriptionCheckbox.checked = descriptionLine.text != ""; + } + + function setPaymentId(value) { + paymentIdLine.text = value; + paymentIdCheckbox.checked = paymentIdLine.text != ""; + } + function clearFields() { addressLine.text = "" - paymentIdLine.text = "" + setPaymentId(""); amountLine.text = "" - descriptionLine.text = "" + setDescription(""); priorityDropdown.currentIndex = 0 updatePriorityDropdown() } @@ -223,9 +233,9 @@ Rectangle { const parsed = walletManager.parse_uri_to_object(clipboardText); if (!parsed.error) { addressLine.text = parsed.address; - paymentIdLine.text = parsed.payment_id; + setPaymentId(parsed.payment_id); amountLine.text = parsed.amount; - descriptionLine.text = parsed.tx_description; + setDescription(parsed.tx_description); } else { addressLine.text = clipboardText; } @@ -290,25 +300,57 @@ Rectangle { } } - RowLayout { + ColumnLayout { + CheckBox { + id: paymentIdCheckbox + border: false + checkedIcon: "qrc:///images/minus-white.png" + uncheckedIcon: "qrc:///images/plus-white.png" + fontSize: paymentIdLine.labelFontSize + iconOnTheLeft: false + Layout.fillWidth: true + text: qsTr("Payment ID ( Optional )") + translationManager.emptyString + onClicked: { + if (!paymentIdCheckbox.checked) { + paymentIdLine.text = ""; + } + } + } + // payment id input LineEditMulti { id: paymentIdLine fontBold: true - labelText: qsTr("Payment ID ( Optional )") + translationManager.emptyString placeholderText: qsTr("16 or 64 hexadecimal characters") + translationManager.emptyString Layout.fillWidth: true wrapMode: Text.WrapAnywhere addressValidation: false + visible: paymentIdCheckbox.checked } } - RowLayout { + ColumnLayout { + CheckBox { + id: descriptionCheckbox + border: false + checkedIcon: "qrc:///images/minus-white.png" + uncheckedIcon: "qrc:///images/plus-white.png" + fontSize: descriptionLine.labelFontSize + iconOnTheLeft: false + Layout.fillWidth: true + text: qsTr("Description ( Optional )") + translationManager.emptyString + onClicked: { + if (!descriptionCheckbox.checked) { + descriptionLine.text = ""; + } + } + } + LineEditMulti { id: descriptionLine - labelText: qsTr("Description ( Optional )") + translationManager.emptyString placeholderText: qsTr("Saved to local wallet history") + translationManager.emptyString Layout.fillWidth: true + visible: descriptionCheckbox.checked } } @@ -355,7 +397,7 @@ Rectangle { console.log("priority: " + priority) console.log("amount: " + amountLine.text) addressLine.text = addressLine.text.trim() - paymentIdLine.text = paymentIdLine.text.trim() + setPaymentId(paymentIdLine.text.trim()); root.paymentClicked(addressLine.text, paymentIdLine.text, amountLine.text, root.mixin, priority, descriptionLine.text) } } @@ -436,7 +478,7 @@ Rectangle { console.log("priority: " + priority) console.log("amount: " + amountLine.text) addressLine.text = addressLine.text.trim() - paymentIdLine.text = paymentIdLine.text.trim() + setPaymentId(paymentIdLine.text.trim()); root.paymentClicked(addressLine.text, paymentIdLine.text, amountLine.text, root.mixin, priority, descriptionLine.text) } @@ -667,7 +709,7 @@ Rectangle { // Popuplate fields from addressbook. function sendTo(address, paymentId, description){ addressLine.text = address - paymentIdLine.text = paymentId - descriptionLine.text = description + setPaymentId(paymentId); + setDescription(description); } } diff --git a/qml.qrc b/qml.qrc index 74f100ca..e8cbdf86 100644 --- a/qml.qrc +++ b/qml.qrc @@ -8,7 +8,11 @@ images/helpIcon.png images/maximizeIcon.png images/minimizeIcon.png + images/minus-white.png + images/minus-white@2x.png images/moneroLogo.png + images/plus-white.png + images/plus-white@2x.png components/Label.qml images/whatIsIcon.png images/lockIcon.png