diff options
author | Emil Engler <me@emilengler.com> | 2020-01-13 19:50:44 +0100 |
---|---|---|
committer | Emil Engler <me@emilengler.com> | 2020-01-18 09:00:40 +0100 |
commit | c4ea501e96363e937200bc97b8e2d78162bdb699 (patch) | |
tree | 06eaaff12260b7ed84cc8dfecc2d78ce4091a7a9 /src/qt/addresstablemodel.cpp | |
parent | 2ed74a43a05a47129d56117deeb489addbcaf05f (diff) | |
download | bitcoin-c4ea501e96363e937200bc97b8e2d78162bdb699.tar.xz |
qt: Hide non PKHash-Addresses in signing address book
Diffstat (limited to 'src/qt/addresstablemodel.cpp')
-rw-r--r-- | src/qt/addresstablemodel.cpp | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/src/qt/addresstablemodel.cpp b/src/qt/addresstablemodel.cpp index 3ac98a5970..ec67c1f2ad 100644 --- a/src/qt/addresstablemodel.cpp +++ b/src/qt/addresstablemodel.cpp @@ -11,6 +11,7 @@ #include <wallet/wallet.h> #include <algorithm> +#include <typeinfo> #include <QFont> #include <QDebug> @@ -75,12 +76,14 @@ public: explicit AddressTablePriv(AddressTableModel *_parent): parent(_parent) {} - void refreshAddressTable(interfaces::Wallet& wallet) + void refreshAddressTable(interfaces::Wallet& wallet, bool pk_hash_only = false) { cachedAddressTable.clear(); { for (const auto& address : wallet.getAddresses()) { + if (pk_hash_only && address.dest.type() != typeid(PKHash)) + continue; AddressTableEntry::Type addressType = translateTransactionType( QString::fromStdString(address.purpose), address.is_mine); cachedAddressTable.append(AddressTableEntry(addressType, @@ -159,12 +162,12 @@ public: } }; -AddressTableModel::AddressTableModel(WalletModel *parent) : +AddressTableModel::AddressTableModel(WalletModel *parent, bool pk_hash_only) : QAbstractTableModel(parent), walletModel(parent) { columns << tr("Label") << tr("Address"); priv = new AddressTablePriv(this); - priv->refreshAddressTable(parent->wallet()); + priv->refreshAddressTable(parent->wallet(), pk_hash_only); } AddressTableModel::~AddressTableModel() |