Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Transfer: hide PaymentId and Description by default #1855

Merged
merged 1 commit into from
Dec 26, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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.
70 changes: 56 additions & 14 deletions pages/Transfer.qml
Original file line number Diff line number Diff line change
Expand Up @@ -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()
}
Expand Down Expand Up @@ -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;
}
Expand Down Expand Up @@ -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 <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
}
}

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 <font size='2'>( Optional )</font>") + translationManager.emptyString
onClicked: {
if (!descriptionCheckbox.checked) {
descriptionLine.text = "";
}
}
}

LineEditMulti {
id: descriptionLine
labelText: qsTr("Description <font size='2'>( Optional )</font>") + translationManager.emptyString
placeholderText: qsTr("Saved to local wallet history") + translationManager.emptyString
Layout.fillWidth: true
visible: descriptionCheckbox.checked
}
}

Expand Down Expand Up @@ -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)
}
}
Expand Down Expand Up @@ -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)

}
Expand Down Expand Up @@ -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);
}
}
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