diff --git a/images/minus-white.png b/images/minus-white.png new file mode 100644 index 00000000..b42bee8e Binary files /dev/null and b/images/minus-white.png differ diff --git a/images/minus-white@2x.png b/images/minus-white@2x.png new file mode 100644 index 00000000..c8652959 Binary files /dev/null and b/images/minus-white@2x.png differ diff --git a/images/plus-white.png b/images/plus-white.png new file mode 100644 index 00000000..8cc8bcfc Binary files /dev/null and b/images/plus-white.png differ diff --git a/images/plus-white@2x.png b/images/plus-white@2x.png new file mode 100644 index 00000000..54611b87 Binary files /dev/null and b/images/plus-white@2x.png differ diff --git a/pages/Transfer.qml b/pages/Transfer.qml index 0b05c5f5..0a1693ef 100644 --- a/pages/Transfer.qml +++ b/pages/Transfer.qml @@ -63,17 +63,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() } @@ -215,9 +225,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; } @@ -282,25 +292,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 } } @@ -347,7 +389,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) } } @@ -428,7 +470,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) } @@ -661,7 +703,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 7c6eb9d8..2f00e2a2 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