File indexing completed on 2024-05-12 16:23:39
0001 /* 0002 * SPDX-FileCopyrightText: 2021 Dimitris Kardarakos <dimkard@posteo.net> 0003 * 0004 * SPDX-License-Identifier: GPL-3.0-or-later 0005 */ 0006 0007 #pragma once 0008 0009 #include <QSortFilterProxyModel> 0010 0011 /** 0012 * @brief Filters EntriesModel 0013 * 0014 */ 0015 class EntriesProxyModel : public QSortFilterProxyModel 0016 { 0017 Q_OBJECT 0018 0019 Q_PROPERTY(bool onlyUnread READ onlyUnread WRITE setOnlyUnread NOTIFY onlyUnreadChanged) 0020 0021 public: 0022 explicit EntriesProxyModel(QObject *parent = nullptr); 0023 ~EntriesProxyModel() override; 0024 0025 bool filterAcceptsRow(int source_row, const QModelIndex &source_parent) const override; 0026 0027 bool onlyUnread() const; 0028 void setOnlyUnread(bool onlyUnread); 0029 0030 Q_SIGNALS: 0031 void onlyUnreadChanged(); 0032 0033 private: 0034 bool m_onlyUnread; 0035 };