Line data Source code
1 : #pragma once
2 :
3 : #include <QWidget>
4 :
5 : class QLineEdit;
6 : class QPushButton;
7 : class QTimer;
8 :
9 : // QuickFilterBar provides a toolbar above the mail list for filtering.
10 : // Toggle buttons for Unread/Starred/Attachments and a text search field.
11 : // Emits filterChanged() on every state change (with debounce for text input).
12 : class QuickFilterBar : public QWidget {
13 42 : Q_OBJECT
14 :
15 : public:
16 : explicit QuickFilterBar(QWidget *parent = nullptr);
17 :
18 : bool showUnreadOnly() const;
19 : bool showStarredOnly() const;
20 : bool showWithAttachments() const;
21 : QString filterText() const;
22 :
23 : signals:
24 : void filterChanged();
25 :
26 : private:
27 : void setupUi();
28 : void retranslateUi();
29 : void onFilterButtonToggled();
30 : void onTextChanged();
31 :
32 : protected:
33 : void changeEvent(QEvent *event) override;
34 :
35 : QPushButton *m_unreadBtn = nullptr;
36 : QPushButton *m_starredBtn = nullptr;
37 : QPushButton *m_attachBtn = nullptr;
38 : QLineEdit *m_searchEdit = nullptr;
39 : QTimer *m_debounceTimer = nullptr;
40 : };
|