From d003b255b96671346b741072265212cd8af15ddd Mon Sep 17 00:00:00 2001 From: cryptochangements34 Date: Fri, 11 May 2018 18:56:04 -0400 Subject: [PATCH] use regex for value input --- pages/Receive.qml | 10 +++------- pages/Transfer.qml | 8 ++------ 2 files changed, 5 insertions(+), 13 deletions(-) diff --git a/pages/Receive.qml b/pages/Receive.qml index f5cac4a9..52ac373e 100644 --- a/pages/Receive.qml +++ b/pages/Receive.qml @@ -57,7 +57,7 @@ Rectangle { var nfields = 0 s += current_address; var amount = amountToReceiveLine.text.trim() - if (amount !== "") { + if (amount !== "" && amount.slice(-1) !== ".") { s += (nfields++ ? "&" : "?") s += "tx_amount=" + amount } @@ -456,12 +456,8 @@ Rectangle { placeholderText: qsTr("Amount to receive") + translationManager.emptyString fontBold: true inlineIcon: true - validator: DoubleValidator { - bottom: 0.0 - top: 18446744.073709551615 - decimals: 12 - notation: DoubleValidator.StandardNotation - locale: "C" + validator: RegExpValidator { + regExp: /(\d{1,8})([.]\d{1,12})?$/ } } } diff --git a/pages/Transfer.qml b/pages/Transfer.qml index 8a029deb..38100a5b 100644 --- a/pages/Transfer.qml +++ b/pages/Transfer.qml @@ -193,12 +193,8 @@ Rectangle { inlineButtonText: qsTr("All") + translationManager.emptyString inlineButton.onClicked: amountLine.text = "(all)" - validator: DoubleValidator { - bottom: 0.0 - top: 18446744.073709551615 - decimals: 12 - notation: DoubleValidator.StandardNotation - locale: "C" + validator: RegExpValidator { + regExp: /(\d{1,8})([.]\d{1,12})?$/ } } }