Feather, a free Monero desktop wallet

Co-Authored-By: tobtoht <thotbot@protonmail.com>
This commit is contained in:
dsc
2020-10-08 04:31:22 +02:00
co-authored by tobtoht
commit 133700160a
728 changed files with 55961 additions and 0 deletions
+36
View File
@@ -0,0 +1,36 @@
// SPDX-License-Identifier: BSD-3-Clause
// Copyright (c) 2020, The Monero Project.
#include "SubaddressProxyModel.h"
SubaddressProxyModel::SubaddressProxyModel(QObject *parent, Subaddress *subaddress, bool hidePrimary)
: QSortFilterProxyModel(parent),
m_searchRegExp(""),
m_searchCaseSensitiveRegExp(""),
m_subaddress(subaddress),
m_hidePrimary(hidePrimary)
{
m_searchRegExp.setCaseSensitivity(Qt::CaseInsensitive);
m_searchRegExp.setPatternSyntax(QRegExp::FixedString);
m_searchCaseSensitiveRegExp.setPatternSyntax(QRegExp::FixedString);
}
bool SubaddressProxyModel::filterAcceptsRow(int sourceRow, const QModelIndex &sourceParent) const
{
QString address, label;
bool isUsed;
m_subaddress->getRow(sourceRow, [&isUsed, &address, &label](const Monero::SubaddressRow &subaddress){
isUsed = subaddress.isUsed();
address = QString::fromStdString(subaddress.getAddress());
label = QString::fromStdString(subaddress.getLabel());
});
// Hide primary address
if (sourceRow == 0 && m_hidePrimary)
return false;
if (!m_searchRegExp.isEmpty()) {
return address.contains(m_searchCaseSensitiveRegExp) || label.contains(m_searchRegExp);
}
return (m_showUsed || !isUsed);
}