forked from Public/monero-gui
Merge pull request #117
142e348Transfer: use the new error LineEdit property to highlight bad fields (moneromooo.monero)b97d0a9LineEdit: add an error property (moneromooo.monero)5fb4e89Transfer: remove spammy debug traces (moneromooo.monero)
This commit is contained in:
@@ -35,10 +35,18 @@ Item {
|
|||||||
property alias readOnly : input.readOnly
|
property alias readOnly : input.readOnly
|
||||||
property alias cursorPosition: input.cursorPosition
|
property alias cursorPosition: input.cursorPosition
|
||||||
property int fontSize: 18
|
property int fontSize: 18
|
||||||
|
property bool error: false
|
||||||
|
|
||||||
|
|
||||||
height: 37
|
height: 37
|
||||||
|
|
||||||
|
function getColor(error) {
|
||||||
|
if (error)
|
||||||
|
return "#FFDDDD"
|
||||||
|
else
|
||||||
|
return "#FFFFFF"
|
||||||
|
}
|
||||||
|
|
||||||
Rectangle {
|
Rectangle {
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
anchors.bottomMargin: 1
|
anchors.bottomMargin: 1
|
||||||
@@ -49,7 +57,7 @@ Item {
|
|||||||
Rectangle {
|
Rectangle {
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
anchors.topMargin: 1
|
anchors.topMargin: 1
|
||||||
color: "#FFFFFF"
|
color: getColor(error)
|
||||||
//radius: 4
|
//radius: 4
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -244,18 +244,32 @@ Rectangle {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function checkAddressAndPaymentID(address, payment_id, testnet) {
|
function checkAddressAndPaymentID(address, payment_id, testnet) {
|
||||||
print ("testing")
|
|
||||||
if (!walletManager.addressValid(address, testnet))
|
if (!walletManager.addressValid(address, testnet))
|
||||||
return false
|
return false
|
||||||
print ("address is valid")
|
|
||||||
var ipid = walletManager.paymentIdFromAddress(address, testnet)
|
var ipid = walletManager.paymentIdFromAddress(address, testnet)
|
||||||
print ("ipid: [" + ipid + "]")
|
|
||||||
if (ipid.length > 0)
|
if (ipid.length > 0)
|
||||||
return payment_id === ""
|
return payment_id === ""
|
||||||
print ("payment_id: [" + payment_id + "]")
|
|
||||||
return payment_id === "" || walletManager.paymentIdValid(payment_id)
|
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 {
|
StandardButton {
|
||||||
id: sendButton
|
id: sendButton
|
||||||
anchors.left: parent.left
|
anchors.left: parent.left
|
||||||
@@ -268,7 +282,7 @@ Rectangle {
|
|||||||
shadowPressedColor: "#B32D00"
|
shadowPressedColor: "#B32D00"
|
||||||
releasedColor: "#FF6C3C"
|
releasedColor: "#FF6C3C"
|
||||||
pressedColor: "#FF4304"
|
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: {
|
onClicked: {
|
||||||
console.log("Transfer: paymentClicked")
|
console.log("Transfer: paymentClicked")
|
||||||
var priority = priorityModel.get(priorityDropdown.currentIndex).priority
|
var priority = priorityModel.get(priorityDropdown.currentIndex).priority
|
||||||
|
|||||||
Reference in New Issue
Block a user