diff options
author | Wladimir J. van der Laan <laanwj@gmail.com> | 2011-07-08 22:27:36 +0200 |
---|---|---|
committer | Wladimir J. van der Laan <laanwj@gmail.com> | 2011-07-08 22:27:36 +0200 |
commit | 51d7cc07f10209ac12bd5286391e3c8b095abd34 (patch) | |
tree | b874383fb3c423b3dbd06cbb6f51b0c9c329c8f5 /src/qt/addresstablemodel.cpp | |
parent | 35105534e702d1a6db4fcac994869ab05266285b (diff) |
Add context menu on transaction list: copy label, copy address, edit label, show details
Diffstat (limited to 'src/qt/addresstablemodel.cpp')
-rw-r--r-- | src/qt/addresstablemodel.cpp | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/src/qt/addresstablemodel.cpp b/src/qt/addresstablemodel.cpp index d04989ea2e..9ca7542016 100644 --- a/src/qt/addresstablemodel.cpp +++ b/src/qt/addresstablemodel.cpp @@ -296,3 +296,33 @@ bool AddressTableModel::validateAddress(const QString &address) return AddressToHash160(address.toStdString(), hash160); } + +/* Look up label for address in address book, if not found return empty string. + */ +QString AddressTableModel::labelForAddress(const QString &address) const +{ + CRITICAL_BLOCK(wallet->cs_mapAddressBook) + { + std::map<std::string, std::string>::iterator mi = wallet->mapAddressBook.find(address.toStdString()); + if (mi != wallet->mapAddressBook.end()) + { + return QString::fromStdString(mi->second); + } + } + return QString(); +} + +int AddressTableModel::lookupAddress(const QString &address) const +{ + QModelIndexList lst = match(index(0, Address, QModelIndex()), + Qt::EditRole, address, 1, Qt::MatchExactly); + if(lst.isEmpty()) + { + return -1; + } + else + { + return lst.at(0).row(); + } +} + |