mirror of
https://github.com/monero-project/monero-gui.git
synced 2024-12-24 20:49:24 +00:00
Merge pull request #567
51074a8
Add a clear payment ID button (Michael Campagnaro)43a33e7
Don't set a default payment ID on receive page (Michael Campagnaro)
This commit is contained in:
commit
1fe0600e1e
1 changed files with 31 additions and 14 deletions
|
@ -51,16 +51,23 @@ Rectangle {
|
||||||
function updatePaymentId(payment_id) {
|
function updatePaymentId(payment_id) {
|
||||||
if (typeof appWindow.currentWallet === 'undefined' || appWindow.currentWallet == null)
|
if (typeof appWindow.currentWallet === 'undefined' || appWindow.currentWallet == null)
|
||||||
return
|
return
|
||||||
|
|
||||||
// generate a new one if not given as argument
|
// generate a new one if not given as argument
|
||||||
if (typeof payment_id === 'undefined') {
|
if (typeof payment_id === 'undefined') {
|
||||||
payment_id = appWindow.currentWallet.generatePaymentId()
|
payment_id = appWindow.currentWallet.generatePaymentId()
|
||||||
appWindow.persistentSettings.payment_id = payment_id
|
|
||||||
paymentIdLine.text = payment_id
|
paymentIdLine.text = payment_id
|
||||||
}
|
}
|
||||||
addressLine.text = appWindow.currentWallet.address
|
|
||||||
|
if (payment_id.length > 0) {
|
||||||
integratedAddressLine.text = appWindow.currentWallet.integratedAddress(payment_id)
|
integratedAddressLine.text = appWindow.currentWallet.integratedAddress(payment_id)
|
||||||
if (integratedAddressLine.text === "")
|
if (integratedAddressLine.text === "")
|
||||||
integratedAddressLine.text = qsTr("Invalid payment ID")
|
integratedAddressLine.text = qsTr("Invalid payment ID")
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
paymentIdLine.text = ""
|
||||||
|
integratedAddressLine.text = ""
|
||||||
|
}
|
||||||
|
|
||||||
update()
|
update()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -242,11 +249,19 @@ Rectangle {
|
||||||
releasedColor: "#FF6C3C"
|
releasedColor: "#FF6C3C"
|
||||||
pressedColor: "#FF4304"
|
pressedColor: "#FF4304"
|
||||||
text: qsTr("Generate") + translationManager.emptyString;
|
text: qsTr("Generate") + translationManager.emptyString;
|
||||||
anchors.right: parent.right
|
onClicked: updatePaymentId()
|
||||||
onClicked: {
|
|
||||||
appWindow.persistentSettings.payment_id = appWindow.currentWallet.generatePaymentId();
|
|
||||||
updatePaymentId()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
StandardButton {
|
||||||
|
id: clearPaymentId
|
||||||
|
enabled: !!paymentIdLine.text
|
||||||
|
width: 80
|
||||||
|
shadowReleasedColor: "#FF4304"
|
||||||
|
shadowPressedColor: "#B32D00"
|
||||||
|
releasedColor: "#FF6C3C"
|
||||||
|
pressedColor: "#FF4304"
|
||||||
|
text: qsTr("Clear") + translationManager.emptyString;
|
||||||
|
onClicked: updatePaymentId("")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -414,12 +429,14 @@ Rectangle {
|
||||||
function onPageCompleted() {
|
function onPageCompleted() {
|
||||||
console.log("Receive page loaded");
|
console.log("Receive page loaded");
|
||||||
|
|
||||||
|
if (appWindow.currentWallet) {
|
||||||
if (addressLine.text.length === 0 || addressLine.text !== appWindow.currentWallet.address) {
|
if (addressLine.text.length === 0 || addressLine.text !== appWindow.currentWallet.address) {
|
||||||
updatePaymentId()
|
addressLine.text = appWindow.currentWallet.address
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
update()
|
update()
|
||||||
timer.running = true
|
timer.running = true
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function onPageClosed() {
|
function onPageClosed() {
|
||||||
|
|
Loading…
Reference in a new issue