Messagelib

quicksearchline.h
1 /*
2  SPDX-FileCopyrightText: 2014-2021 Laurent Montel <[email protected]>
3 
4  SPDX-License-Identifier: LGPL-2.0-or-later
5 
6 */
7 
8 #pragma once
9 
10 #include "messagelist_export.h"
11 #include <Akonadi/KMime/MessageStatus>
12 #include <QWidget>
13 
14 class QComboBox;
15 namespace MessageList
16 {
17 namespace Core
18 {
19 class SearchLineStatus;
20 class Filter;
21 /**
22  * @brief The QuickSearchLine class
23  * @author Laurent Montel <[email protected]>
24  */
25 class MESSAGELIST_EXPORT QuickSearchLine : public QWidget
26 {
27  Q_OBJECT
28 public:
29  explicit QuickSearchLine(QWidget *parent = nullptr);
30  ~QuickSearchLine() override;
31 
32  enum SearchOption {
33  SearchEveryWhere = 1,
34  SearchAgainstBody = 2,
35  SearchAgainstSubject = 4,
36  SearchAgainstFrom = 8,
37  SearchAgainstBcc = 16,
38  SearchAgainstTo = 32
39  };
40 
41  Q_ENUM(SearchOption)
42  Q_DECLARE_FLAGS(SearchOptions, SearchOption)
43 
44  Q_REQUIRED_RESULT SearchOptions searchOptions() const;
45 
46  void focusQuickSearch(const QString &selectedText);
47 
48  Q_REQUIRED_RESULT QComboBox *tagFilterComboBox() const;
49  Q_REQUIRED_RESULT SearchLineStatus *searchEdit() const;
50  void resetFilter();
51  Q_REQUIRED_RESULT QVector<Akonadi::MessageStatus> status() const;
52 
53  void updateComboboxVisibility();
54 
55  Q_REQUIRED_RESULT bool containsOutboundMessages() const;
56  void setContainsOutboundMessages(bool containsOutboundMessages);
57 
58  void changeQuicksearchVisibility(bool show);
59  void addCompletionItem(const QString &str);
60 
61  void setSearchOptions(QuickSearchLine::SearchOptions opts);
62  void setFilterMessageStatus(const QVector<Akonadi::MessageStatus> &newLstStatus);
63 
64 Q_SIGNALS:
65  void clearButtonClicked();
66  void searchEditTextEdited(const QString &);
67  void searchOptionChanged();
68  void statusButtonsClicked();
69  void forceLostFocus();
70  void saveFilter();
71  void activateFilter(MessageList::Core::Filter *f);
72 
73 protected:
74  bool eventFilter(QObject *object, QEvent *e) override;
75 private Q_SLOTS:
76  void slotSearchEditTextEdited(const QString &text);
77  void slotClearButtonClicked();
78  void slotFilterActionChanged(const QVector<Akonadi::MessageStatus> &lst);
79 
80 private:
81  SearchLineStatus *const mSearchEdit;
82  QComboBox *const mTagFilterCombo;
84 };
85 }
86 }
The QuickSearchLine class.
This class is responsible of matching messages that should be displayed in the View.
Definition: filter.h:32
This file is part of the KDE documentation.
Documentation copyright © 1996-2021 The KDE developers.
Generated on Sun Dec 5 2021 23:04:54 by doxygen 1.8.11 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.