Mailcommon

searchrulestatus.h
1 /*
2  SPDX-FileCopyrightText: 2015-2022 Laurent Montel <[email protected]>
3 
4  SPDX-License-Identifier: GPL-2.0-or-later
5 */
6 
7 #pragma once
8 
9 #include <Akonadi/Item>
10 
11 #include "mailcommon/searchpattern.h"
12 #include <Akonadi/MessageStatus>
13 
14 namespace MailCommon
15 {
16 /**
17  * This class represents a search to be performed against the status of a
18  * message. The status is represented by a bitfield.
19  *
20  * @short This class represents a search pattern rule operating on message
21  * status.
22  */
23 class MAILCOMMON_EXPORT SearchRuleStatus : public SearchRule
24 {
25 public:
26  explicit SearchRuleStatus(const QByteArray &field = QByteArray(), Function function = FuncContains, const QString &contents = QString());
27 
28  explicit SearchRuleStatus(Akonadi::MessageStatus status, Function function = FuncContains);
29 
30  Q_REQUIRED_RESULT bool isEmpty() const override;
31  Q_REQUIRED_RESULT bool matches(const Akonadi::Item &item) const override;
32 
33  /**
34  * @copydoc SearchRule::requiredPart()
35  */
36  Q_REQUIRED_RESULT RequiredPart requiredPart() const override;
37 
38  void addQueryTerms(Akonadi::SearchTerm &groupTerm, bool &emptyIsNotAnError) const override;
39 
40  // Not possible to implement optimized form for status searching
41  using SearchRule::matches;
42 
43  static Akonadi::MessageStatus statusFromEnglishName(const QString &);
44 
45  Q_REQUIRED_RESULT QString informationAboutNotValidRules() const override;
46 
47 private:
48  Akonadi::MessageStatus mStatus;
49 };
50 }
This class represents a search to be performed against the status of a message.
virtual bool matches(const Akonadi::Item &item) const =0
Tries to match the rule against the KMime::Message in the given item.
RequiredPart
Possible required parts.
Definition: searchrule.h:68
This class represents one search pattern rule.
Definition: searchrule.h:23
Function
Describes operators for comparison of field and contents.
Definition: searchrule.h:40
The filter dialog.
This file is part of the KDE documentation.
Documentation copyright © 1996-2022 The KDE developers.
Generated on Sat Oct 1 2022 04:00:53 by doxygen 1.8.17 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.