| 17 | } |
| 18 | |
| 19 | bool TransactionFilterProxy::filterAcceptsRow(int sourceRow, const QModelIndex &sourceParent) const |
| 20 | { |
| 21 | QModelIndex index = sourceModel()->index(sourceRow, 0, sourceParent); |
| 22 | |
| 23 | int status = index.data(TransactionTableModel::StatusRole).toInt(); |
| 24 | if (!showInactive && status == TransactionStatus::Conflicted) |
| 25 | return false; |
| 26 | |
| 27 | int type = index.data(TransactionTableModel::TypeRole).toInt(); |
| 28 | if (!(TYPE(type) & typeFilter)) |
| 29 | return false; |
| 30 | |
| 31 | QDateTime datetime = index.data(TransactionTableModel::DateRole).toDateTime(); |
| 32 | if (dateFrom && datetime < *dateFrom) return false; |
| 33 | if (dateTo && datetime > *dateTo) return false; |
| 34 | |
| 35 | QString address = index.data(TransactionTableModel::AddressRole).toString(); |
| 36 | QString label = index.data(TransactionTableModel::LabelRole).toString(); |
| 37 | QString txid = index.data(TransactionTableModel::TxHashRole).toString(); |
| 38 | if (!address.contains(m_search_string, Qt::CaseInsensitive) && |
| 39 | ! label.contains(m_search_string, Qt::CaseInsensitive) && |
| 40 | ! txid.contains(m_search_string, Qt::CaseInsensitive)) { |
| 41 | return false; |
| 42 | } |
| 43 | |
| 44 | qint64 amount = llabs(index.data(TransactionTableModel::AmountRole).toLongLong()); |
| 45 | if (amount < minAmount) |
| 46 | return false; |
| 47 | |
| 48 | return true; |
| 49 | } |
| 50 | |
| 51 | void TransactionFilterProxy::setDateRange(const std::optional<QDateTime>& from, const std::optional<QDateTime>& to) |
| 52 | { |