Skip to content
Permalink
Browse files

device: show address on device display

  • Loading branch information...
ph4r05 committed Jun 17, 2019
1 parent d1e8b6f commit d2603cbc829293cf4e57d8bdf3e63c99c92a1acd
Showing with 35 additions and 0 deletions.
  1. +11 −0 pages/Receive.qml
  2. +19 −0 src/libwalletqt/Wallet.cpp
  3. +5 −0 src/libwalletqt/Wallet.h
@@ -308,6 +308,17 @@ Rectangle {
appWindow.showStatusMessage(qsTr("Copied to clipboard") + translationManager.emptyString, 3);
}
}

MoneroComponents.StandardButton {
rightIcon: "qrc:///images/external-link-white.png" // TODO: make appropriate icon
visible: appWindow.currentWallet.isHwBacked()
onClicked: {
appWindow.currentWallet.deviceShowAddressAsync(
appWindow.currentWallet.currentSubaddressAccount,
appWindow.current_subaddress_table_index,
'');
}
}
}
}

@@ -265,6 +265,11 @@ void Wallet::initAsync(const QString &daemonAddress, quint64 upperTransactionLim
watcher->setFuture(future);
}

bool Wallet::isHwBacked() const
{
return m_walletImpl->getDeviceType() != Monero::Wallet::Device_Software;
}

//! create a view only wallet
bool Wallet::createViewOnly(const QString &path, const QString &password) const
{
@@ -347,6 +352,20 @@ void Wallet::setSubaddressLabel(quint32 accountIndex, quint32 addressIndex, cons
{
m_walletImpl->setSubaddressLabel(accountIndex, addressIndex, label.toStdString());
}
void Wallet::deviceShowAddressAsync(quint32 accountIndex, quint32 addressIndex, const QString &paymentId)
{
QFuture<void> future = QtConcurrent::run(m_walletImpl, &Monero::Wallet::deviceShowAddress,
accountIndex, addressIndex, paymentId.toStdString());
QFutureWatcher<void> * watcher = new QFutureWatcher<void>();

connect(watcher, &QFutureWatcher<void>::finished,
this, [this, watcher]() {
QFuture<void> future = watcher->future();
watcher->deleteLater();
emit deviceShowAddressShowed();
});
watcher->setFuture(future);
}

void Wallet::refreshHeightAsync() const
{
@@ -177,6 +177,10 @@ class Wallet : public QObject
Q_INVOKABLE void addSubaddress(const QString& label);
Q_INVOKABLE QString getSubaddressLabel(quint32 accountIndex, quint32 addressIndex) const;
Q_INVOKABLE void setSubaddressLabel(quint32 accountIndex, quint32 addressIndex, const QString &label);
Q_INVOKABLE void deviceShowAddressAsync(quint32 accountIndex, quint32 addressIndex, const QString &paymentId);

//! hw-device backed wallets
Q_INVOKABLE bool isHwBacked() const;

//! returns if view only wallet
Q_INVOKABLE bool viewOnly() const;
@@ -348,6 +352,7 @@ class Wallet : public QObject
void deviceButtonPressed();
void transactionCommitted(bool status, PendingTransaction *t, QStringList txid);
void heightRefreshed(quint64 walletHeight, quint64 daemonHeight, quint64 targetHeight) const;
void deviceShowAddressShowed();

// emitted when transaction is created async
void transactionCreated(PendingTransaction * transaction, QString address, QString paymentId, quint32 mixinCount);

0 comments on commit d2603cb

Please sign in to comment.
You can’t perform that action at this time.