Transfer: disable Send button if the payment id is invalid

This commit is contained in:
moneromooo.monero 2016-10-16 13:57:56 +01:00
parent 05046a5f21
commit 51f89a8402
3 changed files with 8 additions and 1 deletions

View file

@ -251,7 +251,7 @@ Rectangle {
shadowPressedColor: "#B32D00" shadowPressedColor: "#B32D00"
releasedColor: "#FF6C3C" releasedColor: "#FF6C3C"
pressedColor: "#FF4304" pressedColor: "#FF4304"
enabled : addressLine.text.length > 0 && amountLine.text.length > 0 enabled : addressLine.text.length > 0 && amountLine.text.length > 0 && (paymentIdLine.text.trim() === "" || walletManager.paymentIdValid(paymentIdLine.text.trim()))
onClicked: { onClicked: {
console.log("Transfer: paymentClicked") console.log("Transfer: paymentClicked")
var priority = priorityModel.get(priorityDropdown.currentIndex).priority var priority = priorityModel.get(priorityDropdown.currentIndex).priority

View file

@ -149,6 +149,11 @@ quint64 WalletManager::amountFromDouble(double amount) const
return Bitmonero::Wallet::amountFromDouble(amount); return Bitmonero::Wallet::amountFromDouble(amount);
} }
bool WalletManager::paymentIdValid(const QString &payment_id) const
{
return Bitmonero::Wallet::paymentIdValid(payment_id.toStdString());
}
void WalletManager::setLogLevel(int logLevel) void WalletManager::setLogLevel(int logLevel)
{ {
Bitmonero::WalletManagerFactory::setLogLevel(logLevel); Bitmonero::WalletManagerFactory::setLogLevel(logLevel);

View file

@ -89,6 +89,8 @@ public:
// QML JS engine doesn't support unsigned integers // QML JS engine doesn't support unsigned integers
Q_INVOKABLE QString maximumAllowedAmountAsSting() const; Q_INVOKABLE QString maximumAllowedAmountAsSting() const;
Q_INVOKABLE bool paymentIdValid(const QString &payment_id) const;
// QML missing such functionality, implementing these helpers here // QML missing such functionality, implementing these helpers here
Q_INVOKABLE QString urlToLocalPath(const QUrl &url) const; Q_INVOKABLE QString urlToLocalPath(const QUrl &url) const;
Q_INVOKABLE QUrl localPathToUrl(const QString &path) const; Q_INVOKABLE QUrl localPathToUrl(const QString &path) const;