Merge pull request #1855

55c3d07 Transfer: hide PaymentId and Description by default (xiphon)
This commit is contained in:
luigi1111 2018-12-26 16:11:02 -06:00
commit b88ac2baa9
No known key found for this signature in database
GPG key ID: F4ACA0183641E010
6 changed files with 60 additions and 14 deletions

BIN
images/minus-white.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 170 B

BIN
images/minus-white@2x.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 170 B

BIN
images/plus-white.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 193 B

BIN
images/plus-white@2x.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 195 B

View file

@ -63,17 +63,27 @@ Rectangle {
function updateFromQrCode(address, payment_id, amount, tx_description, recipient_name) { function updateFromQrCode(address, payment_id, amount, tx_description, recipient_name) {
console.log("updateFromQrCode") console.log("updateFromQrCode")
addressLine.text = address addressLine.text = address
paymentIdLine.text = payment_id setPaymentId(payment_id);
amountLine.text = amount amountLine.text = amount
descriptionLine.text = recipient_name + " " + tx_description setDescription(recipient_name + " " + tx_description);
cameraUi.qrcode_decoded.disconnect(updateFromQrCode) 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() { function clearFields() {
addressLine.text = "" addressLine.text = ""
paymentIdLine.text = "" setPaymentId("");
amountLine.text = "" amountLine.text = ""
descriptionLine.text = "" setDescription("");
priorityDropdown.currentIndex = 0 priorityDropdown.currentIndex = 0
updatePriorityDropdown() updatePriorityDropdown()
} }
@ -215,9 +225,9 @@ Rectangle {
const parsed = walletManager.parse_uri_to_object(clipboardText); const parsed = walletManager.parse_uri_to_object(clipboardText);
if (!parsed.error) { if (!parsed.error) {
addressLine.text = parsed.address; addressLine.text = parsed.address;
paymentIdLine.text = parsed.payment_id; setPaymentId(parsed.payment_id);
amountLine.text = parsed.amount; amountLine.text = parsed.amount;
descriptionLine.text = parsed.tx_description; setDescription(parsed.tx_description);
} else { } else {
addressLine.text = clipboardText; 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 <font size='2'>( Optional )</font>") + translationManager.emptyString
onClicked: {
if (!paymentIdCheckbox.checked) {
paymentIdLine.text = "";
}
}
}
// payment id input // payment id input
LineEditMulti { LineEditMulti {
id: paymentIdLine id: paymentIdLine
fontBold: true fontBold: true
labelText: qsTr("Payment ID <font size='2'>( Optional )</font>") + translationManager.emptyString
placeholderText: qsTr("16 or 64 hexadecimal characters") + translationManager.emptyString placeholderText: qsTr("16 or 64 hexadecimal characters") + translationManager.emptyString
Layout.fillWidth: true Layout.fillWidth: true
wrapMode: Text.WrapAnywhere wrapMode: Text.WrapAnywhere
addressValidation: false addressValidation: false
visible: paymentIdCheckbox.checked
}
}
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 = "";
}
} }
} }
RowLayout {
LineEditMulti { LineEditMulti {
id: descriptionLine id: descriptionLine
labelText: qsTr("Description <font size='2'>( Optional )</font>") + translationManager.emptyString
placeholderText: qsTr("Saved to local wallet history") + translationManager.emptyString placeholderText: qsTr("Saved to local wallet history") + translationManager.emptyString
Layout.fillWidth: true Layout.fillWidth: true
visible: descriptionCheckbox.checked
} }
} }
@ -347,7 +389,7 @@ Rectangle {
console.log("priority: " + priority) console.log("priority: " + priority)
console.log("amount: " + amountLine.text) console.log("amount: " + amountLine.text)
addressLine.text = addressLine.text.trim() 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) root.paymentClicked(addressLine.text, paymentIdLine.text, amountLine.text, root.mixin, priority, descriptionLine.text)
} }
} }
@ -428,7 +470,7 @@ Rectangle {
console.log("priority: " + priority) console.log("priority: " + priority)
console.log("amount: " + amountLine.text) console.log("amount: " + amountLine.text)
addressLine.text = addressLine.text.trim() 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) root.paymentClicked(addressLine.text, paymentIdLine.text, amountLine.text, root.mixin, priority, descriptionLine.text)
} }
@ -661,7 +703,7 @@ Rectangle {
// Popuplate fields from addressbook. // Popuplate fields from addressbook.
function sendTo(address, paymentId, description){ function sendTo(address, paymentId, description){
addressLine.text = address addressLine.text = address
paymentIdLine.text = paymentId setPaymentId(paymentId);
descriptionLine.text = description setDescription(description);
} }
} }

View file

@ -8,7 +8,11 @@
<file>images/helpIcon.png</file> <file>images/helpIcon.png</file>
<file>images/maximizeIcon.png</file> <file>images/maximizeIcon.png</file>
<file>images/minimizeIcon.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/moneroLogo.png</file>
<file>images/plus-white.png</file>
<file>images/plus-white@2x.png</file>
<file>components/Label.qml</file> <file>components/Label.qml</file>
<file>images/whatIsIcon.png</file> <file>images/whatIsIcon.png</file>
<file>images/lockIcon.png</file> <file>images/lockIcon.png</file>