From 5fb4e89531e7a7b86ba1bf6a173ebb8c91093278 Mon Sep 17 00:00:00 2001 From: "moneromooo.monero" Date: Sun, 6 Nov 2016 10:49:02 +0000 Subject: [PATCH 1/3] Transfer: remove spammy debug traces --- pages/Transfer.qml | 4 ---- 1 file changed, 4 deletions(-) diff --git a/pages/Transfer.qml b/pages/Transfer.qml index 2ea3fb9a..6d816e90 100644 --- a/pages/Transfer.qml +++ b/pages/Transfer.qml @@ -244,15 +244,11 @@ Rectangle { } function checkAddressAndPaymentID(address, payment_id, testnet) { - print ("testing") if (!walletManager.addressValid(address, testnet)) return false - print ("address is valid") var ipid = walletManager.paymentIdFromAddress(address, testnet) - print ("ipid: [" + ipid + "]") if (ipid.length > 0) return payment_id === "" - print ("payment_id: [" + payment_id + "]") return payment_id === "" || walletManager.paymentIdValid(payment_id) } From b97d0a934d7399fe34648abb6cf1757b1b53276e Mon Sep 17 00:00:00 2001 From: "moneromooo.monero" Date: Sun, 6 Nov 2016 12:12:11 +0000 Subject: [PATCH 2/3] LineEdit: add an error property This is then used to display a reddish background when it's true --- components/LineEdit.qml | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/components/LineEdit.qml b/components/LineEdit.qml index 2ebc6e0c..f1e275f2 100644 --- a/components/LineEdit.qml +++ b/components/LineEdit.qml @@ -35,10 +35,18 @@ Item { property alias readOnly : input.readOnly property alias cursorPosition: input.cursorPosition property int fontSize: 18 + property bool error: false height: 37 + function getColor(error) { + if (error) + return "#FFDDDD" + else + return "#FFFFFF" + } + Rectangle { anchors.fill: parent anchors.bottomMargin: 1 @@ -49,7 +57,7 @@ Item { Rectangle { anchors.fill: parent anchors.topMargin: 1 - color: "#FFFFFF" + color: getColor(error) //radius: 4 } From 142e34862618a587bd905a972310d22e57122a19 Mon Sep 17 00:00:00 2001 From: "moneromooo.monero" Date: Sun, 6 Nov 2016 12:12:37 +0000 Subject: [PATCH 3/3] Transfer: use the new error LineEdit property to highlight bad fields --- pages/Transfer.qml | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/pages/Transfer.qml b/pages/Transfer.qml index 6d816e90..f15fc6ce 100644 --- a/pages/Transfer.qml +++ b/pages/Transfer.qml @@ -252,6 +252,24 @@ Rectangle { return payment_id === "" || walletManager.paymentIdValid(payment_id) } + function checkInformation(amount, address, payment_id, testnet) { + address = address.trim() + payment_id = payment_id.trim() + + var amount_ok = amount.length > 0 + var address_ok = walletManager.addressValid(address, testnet) + var payment_id_ok = payment_id.length == 0 || walletManager.paymentIdValid(payment_id) + var ipid = walletManager.paymentIdFromAddress(address, testnet) + if (ipid.length > 0 && payment_id.length > 0) + payment_id_ok = false + + addressLine.error = !address_ok + amountLine.error = !amount_ok + paymentIdLine.error = !payment_id_ok + + return amount_ok && address_ok && payment_id_ok + } + StandardButton { id: sendButton anchors.left: parent.left @@ -264,7 +282,7 @@ Rectangle { shadowPressedColor: "#B32D00" releasedColor: "#FF6C3C" pressedColor: "#FF4304" - enabled : amountLine.text.length > 0 && checkAddressAndPaymentID(addressLine.text.trim(), paymentIdLine.text.trim(), appWindow.persistentSettings.testnet) + enabled : checkInformation(amountLine.text, addressLine.text, paymentIdLine.text, appWindow.persistentSettings.testnet) onClicked: { console.log("Transfer: paymentClicked") var priority = priorityModel.get(priorityDropdown.currentIndex).priority