aboutsummaryrefslogtreecommitdiff
path: root/src/qt/transactionview.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/transactionview.cpp
parent939ed97373fdea0e8ecb173f1c22eb53b9f90bb6 (diff)
[Qt] Add column Watch-only to transactions list
Diffstat (limited to 'src/qt/transactionview.cpp')
-rw-r--r--src/qt/transactionview.cpp32
1 files changed, 32 insertions, 0 deletions
diff --git a/src/qt/transactionview.cpp b/src/qt/transactionview.cpp
index 7e8b71d8ea..2d34d58129 100644
--- a/src/qt/transactionview.cpp
+++ b/src/qt/transactionview.cpp
@@ -51,6 +51,13 @@ TransactionView::TransactionView(QWidget *parent) :
hlayout->addSpacing(23);
#endif
+ watchOnlyWidget = new QComboBox(this);
+ watchOnlyWidget->setFixedWidth(24);
+ watchOnlyWidget->addItem("", TransactionFilterProxy::WatchOnlyFilter_All);
+ watchOnlyWidget->addItem(QIcon(":/icons/eye_plus"), "", TransactionFilterProxy::WatchOnlyFilter_Yes);
+ watchOnlyWidget->addItem(QIcon(":/icons/eye_minus"), "", TransactionFilterProxy::WatchOnlyFilter_No);
+ hlayout->addWidget(watchOnlyWidget);
+
dateWidget = new QComboBox(this);
#ifdef Q_OS_MAC
dateWidget->setFixedWidth(121);
@@ -150,6 +157,7 @@ TransactionView::TransactionView(QWidget *parent) :
connect(dateWidget, SIGNAL(activated(int)), this, SLOT(chooseDate(int)));
connect(typeWidget, SIGNAL(activated(int)), this, SLOT(chooseType(int)));
+ connect(watchOnlyWidget, SIGNAL(activated(int)), this, SLOT(chooseWatchonly(int)));
connect(addressWidget, SIGNAL(textChanged(QString)), this, SLOT(changedPrefix(QString)));
connect(amountWidget, SIGNAL(textChanged(QString)), this, SLOT(changedAmount(QString)));
@@ -187,6 +195,7 @@ void TransactionView::setModel(WalletModel *model)
transactionView->verticalHeader()->hide();
transactionView->setColumnWidth(TransactionTableModel::Status, STATUS_COLUMN_WIDTH);
+ transactionView->setColumnWidth(TransactionTableModel::Watchonly, WATCHONLY_COLUMN_WIDTH);
transactionView->setColumnWidth(TransactionTableModel::Date, DATE_COLUMN_WIDTH);
transactionView->setColumnWidth(TransactionTableModel::Type, TYPE_COLUMN_WIDTH);
transactionView->setColumnWidth(TransactionTableModel::Amount, AMOUNT_MINIMUM_COLUMN_WIDTH);
@@ -211,6 +220,12 @@ void TransactionView::setModel(WalletModel *model)
}
}
}
+
+ // show/hide column Watch-only
+ updateWatchOnlyColumn(model->haveWatchOnly());
+
+ // Watch-only signal
+ connect(model, SIGNAL(notifyWatchonlyChanged(bool)), this, SLOT(updateWatchOnlyColumn(bool)));
}
}
@@ -270,6 +285,14 @@ void TransactionView::chooseType(int idx)
typeWidget->itemData(idx).toInt());
}
+void TransactionView::chooseWatchonly(int idx)
+{
+ if(!transactionProxyModel)
+ return;
+ transactionProxyModel->setWatchOnlyFilter(
+ (TransactionFilterProxy::WatchOnlyFilter)watchOnlyWidget->itemData(idx).toInt());
+}
+
void TransactionView::changedPrefix(const QString &prefix)
{
if(!transactionProxyModel)
@@ -307,6 +330,8 @@ void TransactionView::exportClicked()
// name, column, role
writer.setModel(transactionProxyModel);
writer.addColumn(tr("Confirmed"), 0, TransactionTableModel::ConfirmedRole);
+ if (model && model->haveWatchOnly())
+ writer.addColumn(tr("Watchonly"), TransactionTableModel::Watchonly);
writer.addColumn(tr("Date"), 0, TransactionTableModel::DateRole);
writer.addColumn(tr("Type"), TransactionTableModel::Type, Qt::EditRole);
writer.addColumn(tr("Label"), 0, TransactionTableModel::LabelRole);
@@ -501,3 +526,10 @@ bool TransactionView::eventFilter(QObject *obj, QEvent *event)
}
return QWidget::eventFilter(obj, event);
}
+
+// show/hide column Watch-only
+void TransactionView::updateWatchOnlyColumn(bool fHaveWatchOnly)
+{
+ watchOnlyWidget->setVisible(fHaveWatchOnly);
+ transactionView->setColumnHidden(TransactionTableModel::Watchonly, !fHaveWatchOnly);
+}