Messagelib

searchlinestatus.h
1 /*
2  SPDX-FileCopyrightText: 2016-2021 Laurent Montel <[email protected]>
3 
4  SPDX-License-Identifier: GPL-2.0-or-later
5 */
6 
7 #pragma once
8 
9 #include "messagelist_private_export.h"
10 #include "quicksearchline.h"
11 #include <Akonadi/KMime/MessageStatus>
12 #include <QIcon>
13 #include <QLineEdit>
14 class QStringListModel;
15 class QAction;
16 namespace MessageList
17 {
18 namespace Core
19 {
20 class FilterSavedMenu;
21 class Filter;
22 class MESSAGELIST_TESTS_EXPORT SearchLineStatus : public QLineEdit
23 {
24  Q_OBJECT
25 public:
26  explicit SearchLineStatus(QWidget *parent = nullptr);
27  ~SearchLineStatus() override;
28 
29  void setLocked(bool b);
30  Q_REQUIRED_RESULT bool locked() const;
31 
32  void setContainsOutboundMessages(bool containsOutboundMessages);
33  Q_REQUIRED_RESULT bool containsOutboundMessages() const;
34  Q_REQUIRED_RESULT QuickSearchLine::SearchOptions searchOptions() const;
35  void setSearchOptions(QuickSearchLine::SearchOptions opts);
36  void setFilterMessageStatus(const QVector<Akonadi::MessageStatus> &newLstStatus);
37  void addCompletionItem(const QString &str);
38  void slotClearHistory();
39  void clearFilterButtonClicked();
40 Q_SIGNALS:
41  void filterActionChanged(const QVector<Akonadi::MessageStatus> &lst);
42  void searchOptionChanged();
43  void clearButtonClicked();
44  void forceLostFocus();
45  void saveFilter();
46  void activateFilter(MessageList::Core::Filter *f);
47 
48 protected:
49  void contextMenuEvent(QContextMenuEvent *e) override;
50  void keyPressEvent(QKeyEvent *e) override;
51 
52 private Q_SLOTS:
53  void slotToggledLockAction();
54  void showMenu();
55  void slotFilterActionClicked(QAction *act);
56 
57 private:
58  void clearFilterAction();
59  void createFilterAction(const QIcon &icon, const QString &text, int value);
60  void createMenuSearch();
61  void updateLockAction();
62  void initializeActions();
63  void updateFilterActionIcon();
64  void updateFilters();
65  void createFilterByAction();
66  void clearFilterByAction();
67  void changeSearchAgainstFromOrToText();
68  void slotClear();
69  void showSavedFiltersMenu();
70  void slotConfigureFilters();
71  void slotActivateFilter(const QString &identifier);
72 
73  bool mLocked = false;
74  bool mHasFilter = false;
75  QIcon mWithoutFilter;
76  QIcon mWithFilter;
77  QAction *mLockAction = nullptr;
78  QAction *mFiltersAction = nullptr;
79  QAction *mSaveFilterAction = nullptr;
80  QMenu *mFilterMenu = nullptr;
81  QCompleter *mCompleter = nullptr;
82  QList<QAction *> mFilterListActions;
83  QAction *mSearchEveryWhereAction = nullptr;
84  QAction *mSearchAgainstBodyAction = nullptr;
85  QAction *mSearchAgainstSubjectAction = nullptr;
86  QAction *mSearchAgainstFromOrToAction = nullptr;
87  QAction *mSearchAgainstBccAction = nullptr;
88  QStringListModel *mCompleterListModel = nullptr;
89  FilterSavedMenu *mFilterSavedMenu = nullptr;
90  QStringList mListCompetion;
91  QString mColorName;
92  bool mContainsOutboundMessages = false;
93 };
94 }
95 }
96 
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 Tue Nov 30 2021 23:05:48 by doxygen 1.8.11 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.