Skip to content
Permalink
Browse files

device: show address on device display

  • Loading branch information...
ph4r05 committed Jun 17, 2019
1 parent 702b654 commit 2d72f55e57ace903d705cf617f305f366cf5665e
Showing with 32 additions and 0 deletions.
  1. +15 −0 pages/Receive.qml
  2. +12 −0 src/libwalletqt/Wallet.cpp
  3. +5 −0 src/libwalletqt/Wallet.h
@@ -31,6 +31,7 @@ import QtQuick.Controls 2.0
import QtQuick.Controls.Styles 1.4
import QtQuick.Layouts 1.1
import QtQuick.Dialogs 1.2
import FontAwesome 1.0

import "../components" as MoneroComponents
import "../components/effects/" as MoneroEffects
@@ -308,6 +309,20 @@ Rectangle {
appWindow.showStatusMessage(qsTr("Copied to clipboard") + translationManager.emptyString, 3);
}
}

MoneroComponents.StandardButton {
text: FontAwesome.eye
label.font.family: FontAwesome.fontFamily
fontSize: 24
width: 36
visible: appWindow.currentWallet && appWindow.currentWallet.isHwBacked()
onClicked: {
appWindow.currentWallet.deviceShowAddressAsync(
appWindow.currentWallet.currentSubaddressAccount,
appWindow.current_subaddress_table_index,
'');
}
}
}
}

@@ -253,6 +253,11 @@ void Wallet::initAsync(const QString &daemonAddress, quint64 upperTransactionLim
});
}

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
{
@@ -335,6 +340,13 @@ 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)
{
m_scheduler.run([this, accountIndex, addressIndex, paymentId] {
m_walletImpl->deviceShowAddress(accountIndex, addressIndex, paymentId.toStdString());
emit deviceShowAddressShowed();
});
}

void Wallet::refreshHeightAsync()
{
@@ -179,6 +179,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;
@@ -353,6 +357,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 2d72f55

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