From 43a33e717d731e3570ddb15782579100c300d3d4 Mon Sep 17 00:00:00 2001 From: Michael Campagnaro Date: Sat, 18 Mar 2017 18:01:00 -0400 Subject: [PATCH 1/2] Don't set a default payment ID on receive page --- pages/Receive.qml | 31 ++++++++++++++++++------------- 1 file changed, 18 insertions(+), 13 deletions(-) diff --git a/pages/Receive.qml b/pages/Receive.qml index 76845dc7..a540e56e 100644 --- a/pages/Receive.qml +++ b/pages/Receive.qml @@ -51,16 +51,22 @@ Rectangle { function updatePaymentId(payment_id) { if (typeof appWindow.currentWallet === 'undefined' || appWindow.currentWallet == null) return + // generate a new one if not given as argument if (typeof payment_id === 'undefined') { payment_id = appWindow.currentWallet.generatePaymentId() - appWindow.persistentSettings.payment_id = payment_id paymentIdLine.text = payment_id } - addressLine.text = appWindow.currentWallet.address - integratedAddressLine.text = appWindow.currentWallet.integratedAddress(payment_id) - if (integratedAddressLine.text === "") - integratedAddressLine.text = qsTr("Invalid payment ID") + + if (payment_id.length > 0) { + integratedAddressLine.text = appWindow.currentWallet.integratedAddress(payment_id) + if (integratedAddressLine.text === "") + integratedAddressLine.text = qsTr("Invalid payment ID") + } + else { + integratedAddressLine.text = "" + } + update() } @@ -243,13 +249,10 @@ Rectangle { pressedColor: "#FF4304" text: qsTr("Generate") + translationManager.emptyString; anchors.right: parent.right - onClicked: { - appWindow.persistentSettings.payment_id = appWindow.currentWallet.generatePaymentId(); - updatePaymentId() - } + onClicked: updatePaymentId() } } - + RowLayout { id: integratedAddressRow Label { @@ -414,12 +417,14 @@ Rectangle { function onPageCompleted() { console.log("Receive page loaded"); - if(addressLine.text.length === 0 || addressLine.text !== appWindow.currentWallet.address) { - updatePaymentId() + if (appWindow.currentWallet) { + if (addressLine.text.length === 0 || addressLine.text !== appWindow.currentWallet.address) { + addressLine.text = appWindow.currentWallet.address + } } + update() timer.running = true - } function onPageClosed() { From 51074a8fe69d6daa31b42eafd787bff39dc0b5bb Mon Sep 17 00:00:00 2001 From: Michael Campagnaro Date: Sat, 18 Mar 2017 18:28:29 -0400 Subject: [PATCH 2/2] Add a clear payment ID button --- pages/Receive.qml | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/pages/Receive.qml b/pages/Receive.qml index a540e56e..9af1ce15 100644 --- a/pages/Receive.qml +++ b/pages/Receive.qml @@ -64,6 +64,7 @@ Rectangle { integratedAddressLine.text = qsTr("Invalid payment ID") } else { + paymentIdLine.text = "" integratedAddressLine.text = "" } @@ -248,9 +249,20 @@ Rectangle { releasedColor: "#FF6C3C" pressedColor: "#FF4304" text: qsTr("Generate") + translationManager.emptyString; - anchors.right: parent.right onClicked: updatePaymentId() } + + StandardButton { + id: clearPaymentId + enabled: !!paymentIdLine.text + width: 80 + shadowReleasedColor: "#FF4304" + shadowPressedColor: "#B32D00" + releasedColor: "#FF6C3C" + pressedColor: "#FF4304" + text: qsTr("Clear") + translationManager.emptyString; + onClicked: updatePaymentId("") + } } RowLayout {