diff options
author | Sjors Provoost <sjors@sprovoost.nl> | 2019-09-16 19:01:04 +0200 |
---|---|---|
committer | Sjors Provoost <sjors@sprovoost.nl> | 2021-05-27 14:01:54 +0200 |
commit | 62ac119f919ae1160ed67af796f24b78025fa8e3 (patch) | |
tree | 59484f351df0e3755c13ad077048a7db4ccf45a6 /src/qt | |
parent | 450cb40a344605dda3bcc39495c35869580b9fc2 (diff) |
gui: display address on external signer
Diffstat (limited to 'src/qt')
-rw-r--r-- | src/qt/forms/receiverequestdialog.ui | 13 | ||||
-rw-r--r-- | src/qt/receiverequestdialog.cpp | 6 | ||||
-rw-r--r-- | src/qt/walletmodel.cpp | 12 | ||||
-rw-r--r-- | src/qt/walletmodel.h | 1 |
4 files changed, 32 insertions, 0 deletions
diff --git a/src/qt/forms/receiverequestdialog.ui b/src/qt/forms/receiverequestdialog.ui index 7d95a8bc90..70a7cf71de 100644 --- a/src/qt/forms/receiverequestdialog.ui +++ b/src/qt/forms/receiverequestdialog.ui @@ -255,6 +255,19 @@ </widget> </item> <item> + <widget class="QPushButton" name="btnVerify"> + <property name="text"> + <string>&Verify</string> + </property> + <property name="toolTip"> + <string>Verify this address on e.g. a hardware wallet screen</string> + </property> + <property name="autoDefault"> + <bool>false</bool> + </property> + </widget> + </item> + <item> <widget class="QPushButton" name="btnSaveAs"> <property name="text"> <string>&Save Imageā¦</string> diff --git a/src/qt/receiverequestdialog.cpp b/src/qt/receiverequestdialog.cpp index 78ae5c07da..abe7de8f89 100644 --- a/src/qt/receiverequestdialog.cpp +++ b/src/qt/receiverequestdialog.cpp @@ -89,6 +89,12 @@ void ReceiveRequestDialog::setInfo(const SendCoinsRecipient &_info) ui->wallet_tag->hide(); ui->wallet_content->hide(); } + + ui->btnVerify->setVisible(this->model->wallet().hasExternalSigner()); + + connect(ui->btnVerify, &QPushButton::clicked, [this] { + model->displayAddress(info.address.toStdString()); + }); } void ReceiveRequestDialog::updateDisplayUnit() diff --git a/src/qt/walletmodel.cpp b/src/qt/walletmodel.cpp index cc6db8d33e..2ce378e15b 100644 --- a/src/qt/walletmodel.cpp +++ b/src/qt/walletmodel.cpp @@ -571,6 +571,18 @@ bool WalletModel::bumpFee(uint256 hash, uint256& new_hash) return true; } +bool WalletModel::displayAddress(std::string sAddress) +{ + CTxDestination dest = DecodeDestination(sAddress); + bool res = false; + try { + res = m_wallet->displayAddress(dest); + } catch (const std::runtime_error& e) { + QMessageBox::critical(nullptr, tr("Can't display address"), e.what()); + } + return res; +} + bool WalletModel::isWalletEnabled() { return !gArgs.GetBoolArg("-disablewallet", DEFAULT_DISABLE_WALLET); diff --git a/src/qt/walletmodel.h b/src/qt/walletmodel.h index 4ca8643444..76b8ac72af 100644 --- a/src/qt/walletmodel.h +++ b/src/qt/walletmodel.h @@ -139,6 +139,7 @@ public: bool saveReceiveRequest(const std::string &sAddress, const int64_t nId, const std::string &sRequest); bool bumpFee(uint256 hash, uint256& new_hash); + bool displayAddress(std::string sAddress); static bool isWalletEnabled(); |