Mailcommon

searchrulestatus.h
1/*
2 SPDX-FileCopyrightText: 2015-2025 Laurent Montel <montel@kde.org>
3
4 SPDX-License-Identifier: GPL-2.0-or-later
5*/
6
7#pragma once
8
9#include "mailcommon/searchpattern.h"
10#include "mailcommon_export.h"
11#include <Akonadi/Item>
12#include <Akonadi/MessageStatus>
13
14namespace 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 */
23class MAILCOMMON_EXPORT SearchRuleStatus : public SearchRule
24{
25public:
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 [[nodiscard]] bool isEmpty() const override;
31 [[nodiscard]] bool matches(const Akonadi::Item &item) const override;
32
33 /**
34 * @copydoc SearchRule::requiredPart()
35 */
36 [[nodiscard]] 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
42
43 static Akonadi::MessageStatus statusFromEnglishName(const QString &);
44
45 [[nodiscard]] QString informationAboutNotValidRules() const override;
46
47private:
49};
50}
bool matches(const Akonadi::Item &item) const override
Tries to match the rule against the KMime::Message in the given item.
RequiredPart requiredPart() const override
Returns the required part from the item that is needed for the search to operate.
void addQueryTerms(Akonadi::SearchTerm &groupTerm, bool &emptyIsNotAnError) const override
Adds query terms to the given term group.
bool isEmpty() const override
Determines whether the rule is worth considering.
QByteArray field() const
Returns the message header field name (without the trailing ':').
Function function() const
Returns the filter function of the rule.
QString contents() const
Returns the contents of the rule.
Function
Describes operators for comparison of field and contents.
Definition searchrule.h:40
SearchRule(const QByteArray &field=QByteArray(), Function function=FuncContains, const QString &contents=QString())
Creates new new search rule.
RequiredPart
Possible required parts.
Definition searchrule.h:70
virtual bool matches(const Akonadi::Item &item) const =0
Tries to match the rule against the KMime::Message in the given item.
Q_SCRIPTABLE CaptureState status()
The filter dialog.
This file is part of the KDE documentation.
Documentation copyright © 1996-2025 The KDE developers.
Generated on Fri Jan 24 2025 11:56:35 by doxygen 1.13.2 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.