1
mirror of https://github.com/monero-project/monero-gui synced 2024-12-25 01:53:43 +01:00

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"
releasedColor: "#FF6C3C"
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: {
console.log("Transfer: paymentClicked")
var priority = priorityModel.get(priorityDropdown.currentIndex).priority

View File

@ -149,6 +149,11 @@ quint64 WalletManager::amountFromDouble(double amount) const
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)
{
Bitmonero::WalletManagerFactory::setLogLevel(logLevel);

View File

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