Skip to content

Commit

Permalink
Transfer: hide PaymentId by default
Browse files Browse the repository at this point in the history
  • Loading branch information
xiphon committed Dec 21, 2018
1 parent bac833c commit 9644ae5
Show file tree
Hide file tree
Showing 6 changed files with 33 additions and 8 deletions.
Binary file added images/minus-white.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/minus-white@2x.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/plus-white.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/plus-white@2x.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
37 changes: 29 additions & 8 deletions pages/Transfer.qml
Original file line number Diff line number Diff line change
Expand Up @@ -71,15 +71,20 @@ 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
cameraUi.qrcode_decoded.disconnect(updateFromQrCode)
}

function setPaymentId(value) {
paymentIdLine.text = value;
paymentIdCheckbox.checked = paymentIdLine.text != "";
}

function clearFields() {
addressLine.text = ""
paymentIdLine.text = ""
setPaymentId("");
amountLine.text = ""
descriptionLine.text = ""
priorityDropdown.currentIndex = 0
Expand Down Expand Up @@ -223,7 +228,7 @@ 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;
} else {
Expand Down Expand Up @@ -290,16 +295,32 @@ 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 <font size='2'>( Optional )</font>") + translationManager.emptyString
onClicked: {
if (!paymentIdCheckbox.checked) {
paymentIdLine.text = "";
}
}
}

// payment id input
LineEditMulti {
id: paymentIdLine
fontBold: true
labelText: qsTr("Payment ID <font size='2'>( Optional )</font>") + translationManager.emptyString
placeholderText: qsTr("16 or 64 hexadecimal characters") + translationManager.emptyString
Layout.fillWidth: true
wrapMode: Text.WrapAnywhere
addressValidation: false
visible: paymentIdCheckbox.checked
}
}

Expand Down Expand Up @@ -355,7 +376,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)
}
}
Expand Down Expand Up @@ -436,7 +457,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)

}
Expand Down Expand Up @@ -667,7 +688,7 @@ Rectangle {
// Popuplate fields from addressbook.
function sendTo(address, paymentId, description){
addressLine.text = address
paymentIdLine.text = paymentId
selectMultiple(paymentId);
descriptionLine.text = description
}
}
4 changes: 4 additions & 0 deletions qml.qrc
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,11 @@
<file>images/helpIcon.png</file>
<file>images/maximizeIcon.png</file>
<file>images/minimizeIcon.png</file>
<file>images/minus-white.png</file>
<file>images/minus-white@2x.png</file>
<file>images/moneroLogo.png</file>
<file>images/plus-white.png</file>
<file>images/plus-white@2x.png</file>
<file>components/Label.qml</file>
<file>images/whatIsIcon.png</file>
<file>images/lockIcon.png</file>
Expand Down

0 comments on commit 9644ae5

Please sign in to comment.