Line data Source code
1 : #pragma once
2 :
3 : #include <QWidget>
4 : #include "data/MailCache.h"
5 :
6 : class QComboBox;
7 : class QDateEdit;
8 : class QLabel;
9 : class QLineEdit;
10 : class CheckableFolderCombo;
11 :
12 : class FilterPopoverWidget : public QWidget {
13 7080 : Q_OBJECT
14 :
15 : public:
16 : explicit FilterPopoverWidget(QWidget *parent = nullptr);
17 :
18 : // Set the current filter to display in the popover
19 : void setFilter(const MailCache::SearchFilter &filter);
20 :
21 : // Get the modified filter from the popover
22 : MailCache::SearchFilter filter() const;
23 :
24 : // Suggestions
25 : void setKnownFolders(const QStringList &paths);
26 : void setKnownTags(const QStringList &tags);
27 :
28 : signals:
29 : // Emitted when any field inside the popover is modified by the user
30 : void filterEdited();
31 :
32 : protected:
33 : void changeEvent(QEvent *event) override;
34 :
35 : private:
36 : void setupUi();
37 : void onFieldChanged();
38 : void retranslateUi();
39 :
40 : QLineEdit *m_subject = nullptr;
41 : QLineEdit *m_from = nullptr;
42 : QLineEdit *m_to = nullptr;
43 :
44 : QComboBox *m_datePreset = nullptr;
45 : QDateEdit *m_dateFrom = nullptr;
46 : QDateEdit *m_dateTo = nullptr;
47 :
48 : CheckableFolderCombo *m_folder = nullptr;
49 : QLineEdit *m_tags = nullptr;
50 :
51 : QComboBox *m_unread = nullptr;
52 : QComboBox *m_flagged = nullptr;
53 : QComboBox *m_answered = nullptr;
54 : QComboBox *m_attachment = nullptr;
55 :
56 : // T-76.B3: Form labels stored for runtime language switching
57 : QLabel *m_subjectLabel = nullptr;
58 : QLabel *m_fromLabel = nullptr;
59 : QLabel *m_toLabel = nullptr;
60 : QLabel *m_unreadLabel = nullptr;
61 : QLabel *m_flaggedLabel = nullptr;
62 : QLabel *m_answeredLabel = nullptr;
63 : QLabel *m_attachmentLabel = nullptr;
64 : QLabel *m_folderLabel = nullptr;
65 : QLabel *m_tagsLabel = nullptr;
66 : QLabel *m_dateLabel = nullptr;
67 : QLabel *m_sinceLabel = nullptr;
68 : QLabel *m_untilLabel = nullptr;
69 :
70 : QStringList m_knownTags;
71 : };
|