aboutsummaryrefslogtreecommitdiff
path: root/src/qt/transactiontablemodel.cpp
diff options
context:
space:
mode:
authorCozz Lovan <cozzlovan@yahoo.com>2014-08-10 02:26:04 +0200
committerCozz Lovan <cozzlovan@yahoo.com>2014-08-11 21:38:36 +0200
commit1c5f0af0fd8b5630470d471d8319a7c979aa2587 (patch)
tree4eb6b12ba606e034284fb65ad7263515bf227d01 /src/qt/transactiontablemodel.cpp
parent939ed97373fdea0e8ecb173f1c22eb53b9f90bb6 (diff)
[Qt] Add column Watch-only to transactions list
Diffstat (limited to 'src/qt/transactiontablemodel.cpp')
-rw-r--r--src/qt/transactiontablemodel.cpp32
1 files changed, 24 insertions, 8 deletions
diff --git a/src/qt/transactiontablemodel.cpp b/src/qt/transactiontablemodel.cpp
index 1647bc776f..1a1f726bf8 100644
--- a/src/qt/transactiontablemodel.cpp
+++ b/src/qt/transactiontablemodel.cpp
@@ -27,6 +27,7 @@
// Amount column is right-aligned it contains numbers
static int column_alignments[] = {
Qt::AlignLeft|Qt::AlignVCenter, /* status */
+ Qt::AlignLeft|Qt::AlignVCenter, /* watchonly */
Qt::AlignLeft|Qt::AlignVCenter, /* date */
Qt::AlignLeft|Qt::AlignVCenter, /* type */
Qt::AlignLeft|Qt::AlignVCenter, /* address */
@@ -234,7 +235,7 @@ TransactionTableModel::TransactionTableModel(CWallet* wallet, WalletModel *paren
walletModel(parent),
priv(new TransactionTablePriv(wallet, this))
{
- columns << QString() << tr("Date") << tr("Type") << tr("Address") << BitcoinUnits::getAmountColumnTitle(walletModel->getOptionsModel()->getDisplayUnit());
+ columns << QString() << QString() << tr("Date") << tr("Type") << tr("Address") << BitcoinUnits::getAmountColumnTitle(walletModel->getOptionsModel()->getDisplayUnit());
priv->refreshWallet();
connect(walletModel->getOptionsModel(), SIGNAL(displayUnitChanged(int)), this, SLOT(updateDisplayUnit()));
@@ -393,22 +394,19 @@ QVariant TransactionTableModel::txAddressDecoration(const TransactionRecord *wtx
QString TransactionTableModel::formatTxToAddress(const TransactionRecord *wtx, bool tooltip) const
{
- // mark transactions involving watch-only addresses:
- QString watchAddress = wtx->involvesWatchAddress ? " (w) " : "";
-
switch(wtx->type)
{
case TransactionRecord::RecvFromOther:
- return QString::fromStdString(wtx->address) + watchAddress;
+ return QString::fromStdString(wtx->address);
case TransactionRecord::RecvWithAddress:
case TransactionRecord::SendToAddress:
case TransactionRecord::Generated:
- return lookupAddress(wtx->address, tooltip) + watchAddress;
+ return lookupAddress(wtx->address, tooltip);
case TransactionRecord::SendToOther:
- return QString::fromStdString(wtx->address) + watchAddress;
+ return QString::fromStdString(wtx->address);
case TransactionRecord::SendToSelf:
default:
- return tr("(n/a)") + watchAddress;
+ return tr("(n/a)");
}
}
@@ -482,6 +480,14 @@ QVariant TransactionTableModel::txStatusDecoration(const TransactionRecord *wtx)
return QColor(0,0,0);
}
+QVariant TransactionTableModel::txWatchonlyDecoration(const TransactionRecord *wtx) const
+{
+ if (wtx->involvesWatchAddress)
+ return QIcon(":/icons/eye");
+ else
+ return QVariant();
+}
+
QString TransactionTableModel::formatTooltip(const TransactionRecord *rec) const
{
QString tooltip = formatTxStatus(rec) + QString("\n") + formatTxType(rec);
@@ -506,6 +512,8 @@ QVariant TransactionTableModel::data(const QModelIndex &index, int role) const
{
case Status:
return txStatusDecoration(rec);
+ case Watchonly:
+ return txWatchonlyDecoration(rec);
case ToAddress:
return txAddressDecoration(rec);
}
@@ -533,6 +541,8 @@ QVariant TransactionTableModel::data(const QModelIndex &index, int role) const
return rec->time;
case Type:
return formatTxType(rec);
+ case Watchonly:
+ return (rec->involvesWatchAddress ? 1 : 0);
case ToAddress:
return formatTxToAddress(rec, true);
case Amount:
@@ -562,6 +572,10 @@ QVariant TransactionTableModel::data(const QModelIndex &index, int role) const
return rec->type;
case DateRole:
return QDateTime::fromTime_t(static_cast<uint>(rec->time));
+ case WatchonlyRole:
+ return rec->involvesWatchAddress;
+ case WatchonlyDecorationRole:
+ return txWatchonlyDecoration(rec);
case LongDescriptionRole:
return priv->describe(rec, walletModel->getOptionsModel()->getDisplayUnit());
case AddressRole:
@@ -606,6 +620,8 @@ QVariant TransactionTableModel::headerData(int section, Qt::Orientation orientat
return tr("Date and time that the transaction was received.");
case Type:
return tr("Type of transaction.");
+ case Watchonly:
+ return tr("Whether or not a watch-only address is involved in this transaction.");
case ToAddress:
return tr("Destination address of transaction.");
case Amount: