Skip to content

Commit

Permalink
Merge pull request #1756
Browse files Browse the repository at this point in the history
eb311b9 receive: qrcode fixes (mmbyday)
  • Loading branch information
luigi1111 committed Dec 1, 2018
2 parents eb7e271 + eb311b9 commit 401aafa
Showing 1 changed file with 17 additions and 12 deletions.
29 changes: 17 additions & 12 deletions pages/Receive.qml
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand Down Expand Up @@ -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})?$/
}
}

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

0 comments on commit 401aafa

Please sign in to comment.