Mailcommon

searchruledate.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 "searchpattern.h"
10 #include <Akonadi/Item>
11 namespace MailCommon
12 {
13 class SearchRuleDate : public SearchRule
14 {
15 public:
16  /**
17  * Creates new date search rule.
18  *
19  * @param field The field to search in.
20  * @param function The function to use for searching.
21  * @param contents The contents to search for.
22  */
23  explicit SearchRuleDate(const QByteArray &field = QByteArray(), Function function = FuncContains, const QString &contents = QString());
24  /**
25  * @copydoc SearchRule::isEmpty()
26  */
27  Q_REQUIRED_RESULT bool isEmpty() const override;
28 
29  /**
30  * @copydoc SearchRule::matches()
31  */
32  bool matches(const Akonadi::Item &item) const override;
33 
34  /**
35  * @copydoc SearchRule::requiredPart()
36  */
37  Q_REQUIRED_RESULT RequiredPart requiredPart() const override;
38 
39  // Optimized matching not implemented, will use the unoptimized matching
40  // from SearchRule
41  using SearchRule::matches;
42 
43  /**
44  * A helper method for the main matches() method.
45  * Does the actual comparing.
46  */
47  bool matchesInternal(QDate dateValue, QDate msgDate) const;
48 
49  /**
50  * @copydoc SearchRule::addQueryTerms()
51  */
52  void addQueryTerms(Akonadi::SearchTerm &groupTerm, bool &emptyIsNotAnError) const override;
53  Q_REQUIRED_RESULT QString informationAboutNotValidRules() const override;
54 };
55 }
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
The filter dialog.
This file is part of the KDE documentation.
Documentation copyright © 1996-2022 The KDE developers.
Generated on Sat Sep 24 2022 03:58:15 by doxygen 1.8.17 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.