Merge pull request #66

628b26c Transfer: validate destination address (moneromooo.monero)
51f89a8 Transfer: disable Send button if the payment id is invalid (moneromooo.monero)
This commit is contained in:
Riccardo Spagni
2016-10-24 10:34:29 +02:00
3 changed files with 33 additions and 1 deletions

View File

@@ -149,6 +149,21 @@ 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());
}
bool WalletManager::addressValid(const QString &address, bool testnet) const
{
return Bitmonero::Wallet::addressValid(address.toStdString(), testnet);
}
QString WalletManager::paymentIdFromAddress(const QString &address, bool testnet) const
{
return QString::fromStdString(Bitmonero::Wallet::paymentIdFromAddress(address.toStdString(), testnet));
}
void WalletManager::setLogLevel(int logLevel)
{
Bitmonero::WalletManagerFactory::setLogLevel(logLevel);

View File

@@ -89,6 +89,10 @@ public:
// QML JS engine doesn't support unsigned integers
Q_INVOKABLE QString maximumAllowedAmountAsSting() const;
Q_INVOKABLE bool paymentIdValid(const QString &payment_id) const;
Q_INVOKABLE bool addressValid(const QString &address, bool testnet) const;
Q_INVOKABLE QString paymentIdFromAddress(const QString &address, bool testnet) 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;