Line data Source code
1 : #pragma once
2 :
3 : #include <QSortFilterProxyModel>
4 :
5 : // MailFilterProxyModel filters the mail list based on programmatic state.
6 : // Supports: unread-only, starred-only, text search (subject/from).
7 : // Sits between MailListModel and the QTreeView.
8 : //
9 : // Sprint 15: QuickFilterBar dependency removed. Filters are now set directly
10 : // via setFilterText(), setShowUnreadOnly(), etc. from CommandBar commands.
11 : class MailFilterProxyModel : public QSortFilterProxyModel {
12 : Q_OBJECT
13 :
14 : public:
15 : explicit MailFilterProxyModel(QObject *parent = nullptr);
16 :
17 : // T-146: Direct filter setters (replace QuickFilterBar)
18 : void setFilterText(const QString &text);
19 : void setShowUnreadOnly(bool on);
20 : void setShowStarredOnly(bool on);
21 : void setShowWithAttachments(bool on);
22 :
23 2 : bool showUnreadOnly() const { return m_showUnread; }
24 2 : bool showStarredOnly() const { return m_showStarred; }
25 : bool showWithAttachments() const { return m_showAttachments; }
26 173 : QString filterText() const { return m_filterText; }
27 :
28 : protected:
29 : bool filterAcceptsRow(int sourceRow,
30 : const QModelIndex &sourceParent) const override;
31 :
32 : private:
33 : QString m_filterText;
34 : bool m_showUnread = false;
35 : bool m_showStarred = false;
36 : bool m_showAttachments = false;
37 : };
|