mirror of
https://github.com/monero-project/monero-gui.git
synced 2024-11-17 00:07:51 +00:00
commit
401aafab48
1 changed files with 17 additions and 12 deletions
|
@ -53,15 +53,15 @@ Rectangle {
|
||||||
property alias addressText : pageReceive.current_address
|
property alias addressText : pageReceive.current_address
|
||||||
|
|
||||||
function makeQRCodeString() {
|
function makeQRCodeString() {
|
||||||
var s = "monero:"
|
var XMR_URI_SCHEME = "monero:"
|
||||||
var nfields = 0
|
var XMR_AMOUNT = "tx_amount"
|
||||||
s += current_address;
|
var qrCodeString =""
|
||||||
var amount = amountToReceiveLine.text.trim()
|
var amount = amountToReceiveLine.text
|
||||||
if (amount !== "" && amount.slice(-1) !== ".") {
|
qrCodeString += (XMR_URI_SCHEME + current_address)
|
||||||
s += (nfields++ ? "&" : "?")
|
if (amount !== ""){
|
||||||
s += "tx_amount=" + amount
|
qrCodeString += ("?" + XMR_AMOUNT + "=" + amount)
|
||||||
}
|
}
|
||||||
return s
|
return qrCodeString
|
||||||
}
|
}
|
||||||
|
|
||||||
function update() {
|
function update() {
|
||||||
|
@ -452,8 +452,13 @@ Rectangle {
|
||||||
placeholderText: qsTr("Amount to receive") + translationManager.emptyString
|
placeholderText: qsTr("Amount to receive") + translationManager.emptyString
|
||||||
fontBold: true
|
fontBold: true
|
||||||
inlineIcon: true
|
inlineIcon: true
|
||||||
|
onTextChanged: {
|
||||||
|
if (amountToReceiveLine.text.startsWith('.')) {
|
||||||
|
amountToReceiveLine.text = '0' + amountToReceiveLine.text;
|
||||||
|
}
|
||||||
|
}
|
||||||
validator: RegExpValidator {
|
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
|
id: paymentUrl
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
labelText: qsTr("Payment URL") + translationManager.emptyString
|
labelText: qsTr("Payment URL") + translationManager.emptyString
|
||||||
text: makeQRCodeString()
|
text: makeQRCodeString()
|
||||||
onTextUpdated: function() { paymentUrl.cursorPosition = 0; }
|
|
||||||
readOnly: true
|
readOnly: true
|
||||||
copyButton: true
|
copyButton: true
|
||||||
|
wrapMode: Text.WrapAnywhere
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue