Add context menu on transaction list: copy label, copy address, edit label, show details

This commit is contained in:
Wladimir J. van der Laan
2011-07-08 22:27:36 +02:00
parent 35105534e7
commit 51d7cc07f1
10 changed files with 168 additions and 37 deletions

View File

@@ -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();
}
}