-// Copyright (c) 2011-2013 The Bitcoin developers
-// Distributed under the MIT/X11 software license, see the accompanying
+// Copyright (c) 2011-2013 The Bitcoin Core developers
+// Distributed under the MIT software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
#include "transactionfilterproxy.h"
dateTo(MAX_DATE),
addrPrefix(),
typeFilter(ALL_TYPES),
+ watchOnlyFilter(WatchOnlyFilter_All),
minAmount(0),
limitRows(-1),
- showInactive(false)
+ showInactive(true)
{
}
int type = index.data(TransactionTableModel::TypeRole).toInt();
QDateTime datetime = index.data(TransactionTableModel::DateRole).toDateTime();
+ bool involvesWatchAddress = index.data(TransactionTableModel::WatchonlyRole).toBool();
QString address = index.data(TransactionTableModel::AddressRole).toString();
QString label = index.data(TransactionTableModel::LabelRole).toString();
qint64 amount = llabs(index.data(TransactionTableModel::AmountRole).toLongLong());
int status = index.data(TransactionTableModel::StatusRole).toInt();
- if(!showInactive && status == TransactionStatus::Conflicted && type == TransactionRecord::Other)
+ if(!showInactive && status == TransactionStatus::Conflicted)
return false;
if(!(TYPE(type) & typeFilter))
return false;
+ if (involvesWatchAddress && watchOnlyFilter == WatchOnlyFilter_No)
+ return false;
+ if (!involvesWatchAddress && watchOnlyFilter == WatchOnlyFilter_Yes)
+ return false;
if(datetime < dateFrom || datetime > dateTo)
return false;
if (!address.contains(addrPrefix, Qt::CaseInsensitive) && !label.contains(addrPrefix, Qt::CaseInsensitive))
invalidateFilter();
}
-void TransactionFilterProxy::setMinAmount(qint64 minimum)
+void TransactionFilterProxy::setMinAmount(const CAmount& minimum)
{
this->minAmount = minimum;
invalidateFilter();
}
+void TransactionFilterProxy::setWatchOnlyFilter(WatchOnlyFilter filter)
+{
+ this->watchOnlyFilter = filter;
+ invalidateFilter();
+}
+
void TransactionFilterProxy::setLimit(int limit)
{
this->limitRows = limit;