aboutsummaryrefslogtreecommitdiff
path: root/src/qt/transactiontablemodel.cpp
diff options
context:
space:
mode:
authorWladimir J. van der Laan <laanwj@gmail.com>2011-07-02 13:45:59 +0200
committerWladimir J. van der Laan <laanwj@gmail.com>2011-07-02 13:45:59 +0200
commitebff5c40a234f38429965c391da020bbf8312b1b (patch)
treec37239c253c74dc4c2f73838e2d6ae9edad31ed7 /src/qt/transactiontablemodel.cpp
parent05da981f05d7b2e1551345a042d3379e9244f09b (diff)
Send: dialog redesign (automatically look up label for entered address)
Diffstat (limited to 'src/qt/transactiontablemodel.cpp')
-rw-r--r--src/qt/transactiontablemodel.cpp24
1 files changed, 5 insertions, 19 deletions
diff --git a/src/qt/transactiontablemodel.cpp b/src/qt/transactiontablemodel.cpp
index 5b11b3311b..0d0d97bbde 100644
--- a/src/qt/transactiontablemodel.cpp
+++ b/src/qt/transactiontablemodel.cpp
@@ -3,6 +3,7 @@
#include "transactionrecord.h"
#include "guiconstants.h"
#include "transactiondesc.h"
+#include "walletmodel.h"
#include "headers.h"
@@ -201,9 +202,10 @@ struct TransactionTablePriv
};
-TransactionTableModel::TransactionTableModel(CWallet* wallet, QObject *parent):
+TransactionTableModel::TransactionTableModel(CWallet* wallet, WalletModel *parent):
QAbstractTableModel(parent),
wallet(wallet),
+ walletModel(parent),
priv(new TransactionTablePriv(wallet, this))
{
columns << tr("Status") << tr("Date") << tr("Type") << tr("Address") << tr("Amount");
@@ -298,29 +300,13 @@ QVariant TransactionTableModel::formatTxDate(const TransactionRecord *wtx) const
}
}
-/* Look up label for address in address book, if not found return empty string.
- This should really move to the wallet class.
- */
-QString TransactionTableModel::labelForAddress(const std::string &address) const
-{
- CRITICAL_BLOCK(wallet->cs_mapAddressBook)
- {
- std::map<std::string, std::string>::iterator mi = wallet->mapAddressBook.find(address);
- if (mi != wallet->mapAddressBook.end())
- {
- return QString::fromStdString(mi->second);
- }
- }
- return QString();
-}
-
/* Look up address in address book, if found return
address[0:12]... (label)
otherwise just return address
*/
QString TransactionTableModel::lookupAddress(const std::string &address) const
{
- QString label = labelForAddress(address);
+ QString label = walletModel->labelForAddress(QString::fromStdString(address));
QString description;
if(label.isEmpty())
{
@@ -526,7 +512,7 @@ QVariant TransactionTableModel::data(const QModelIndex &index, int role) const
}
else if (role == LabelRole)
{
- return labelForAddress(rec->address);
+ return walletModel->labelForAddress(QString::fromStdString(rec->address));
}
else if (role == AbsoluteAmountRole)
{