File indexing completed on 2024-05-19 05:08:21

0001 /*
0002     SPDX-FileCopyrightText: 2019 Thomas Baumgart <tbaumgart@kde.org>
0003     SPDX-License-Identifier: GPL-2.0-or-later
0004 */
0005 
0006 
0007 #ifndef LEDGERPAYEEFILTER_H
0008 #define LEDGERPAYEEFILTER_H
0009 
0010 // ----------------------------------------------------------------------------
0011 // QT Includes
0012 
0013 // ----------------------------------------------------------------------------
0014 // KDE Includes
0015 
0016 // ----------------------------------------------------------------------------
0017 // Project Includes
0018 
0019 #include "ledgerfilterbase.h"
0020 
0021 class MyMoneyAccount;
0022 class LedgerPayeeFilterPrivate;
0023 class LedgerPayeeFilter : public LedgerFilterBase
0024 {
0025     Q_OBJECT
0026 
0027 public:
0028     explicit LedgerPayeeFilter(QObject* parent, QVector<QAbstractItemModel*> specialJournalModels);
0029     ~LedgerPayeeFilter() override;
0030 
0031     void setShowBalanceInverted(bool inverted = true);
0032 
0033     void setPayeeIdList(const QStringList& payeeIds);
0034 
0035 public Q_SLOTS:
0036     void recalculateBalances();
0037 
0038     void recalculateBalancesOnIdle(const QString& accountId);
0039 
0040 protected:
0041     /**
0042      * This method is overridden and checks if the splits payeeId is
0043      * contained in the list provided by setPayeeIdList() and
0044      * references an asset or liability account.
0045      */
0046     bool filterAcceptsRow(int source_row, const QModelIndex& source_parent) const override;
0047 
0048 private:
0049     Q_DECLARE_PRIVATE_D(LedgerFilterBase::d_ptr, LedgerPayeeFilter);
0050 };
0051 
0052 #endif // LEDGERPAYEEFILTER_H
0053