aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormmbyday <bromark@protonmail.com>2018-11-28 14:03:05 -0800
committermmbyday <bromark@protonmail.com>2018-11-28 14:03:05 -0800
commiteb311b9acab45b3c9d89f74f42675d984e67c58a (patch)
tree56de4f3b68c2b475796c9cf9ec4c2999c0d135e9
parent45781ab4a173fe0a747ed72140e10d18765b007e (diff)
downloadmonzero-gui-eb311b9acab45b3c9d89f74f42675d984e67c58a.tar.gz
monzero-gui-eb311b9acab45b3c9d89f74f42675d984e67c58a.tar.xz
monzero-gui-eb311b9acab45b3c9d89f74f42675d984e67c58a.zip
receive: qrcode fixes
-rw-r--r--pages/Receive.qml29
1 files changed, 17 insertions, 12 deletions
diff --git a/pages/Receive.qml b/pages/Receive.qml
index ea443502..f7d15742 100644
--- a/pages/Receive.qml
+++ b/pages/Receive.qml
@@ -53,15 +53,15 @@ Rectangle {
property alias addressText : pageReceive.current_address
function makeQRCodeString() {
- var s = "monero:"
- var nfields = 0
- s += current_address;
- var amount = amountToReceiveLine.text.trim()
- if (amount !== "" && amount.slice(-1) !== ".") {
- s += (nfields++ ? "&" : "?")
- s += "tx_amount=" + amount
+ var XMR_URI_SCHEME = "monero:"
+ var XMR_AMOUNT = "tx_amount"
+ var qrCodeString =""
+ var amount = amountToReceiveLine.text
+ qrCodeString += (XMR_URI_SCHEME + current_address)
+ if (amount !== ""){
+ qrCodeString += ("?" + XMR_AMOUNT + "=" + amount)
}
- return s
+ return qrCodeString
}
function update() {
@@ -452,8 +452,13 @@ Rectangle {
placeholderText: qsTr("Amount to receive") + translationManager.emptyString
fontBold: true
inlineIcon: true
+ onTextChanged: {
+ if (amountToReceiveLine.text.startsWith('.')) {
+ amountToReceiveLine.text = '0' + amountToReceiveLine.text;
+ }
+ }
validator: RegExpValidator {
- regExp: /(\d{1,8})([.]\d{1,12})?$/
+ regExp: /^(\d{1,8})?([\.]\d{1,12})?$/
}
}
@@ -496,14 +501,14 @@ Rectangle {
}
}
- LineEdit {
+ LineEditMulti {
id: paymentUrl
Layout.fillWidth: true
labelText: qsTr("Payment URL") + translationManager.emptyString
- text: makeQRCodeString()
- onTextUpdated: function() { paymentUrl.cursorPosition = 0; }
+ text: makeQRCodeString()
readOnly: true
copyButton: true
+ wrapMode: Text.WrapAnywhere
}
}
}