Akonadi Search

emailquery.h
1/*
2 * This file is part of the KDE Akonadi Search Project
3 * SPDX-FileCopyrightText: 2013 Vishesh Handa <me@vhanda.in>
4 *
5 * SPDX-License-Identifier: LGPL-2.1-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL
6 *
7 */
8
9#pragma once
10
11#include "query.h"
12#include "search_pim_export.h"
13
14#include <Akonadi/Collection>
15#include <QStringList>
16
17#include <memory>
18
19namespace Akonadi
20{
21namespace Search
22{
23namespace PIM
24{
25class EmailQueryPrivate;
26
27/** Email query. */
28class AKONADI_SEARCH_PIM_EXPORT EmailQuery : public Query
29{
30public:
31 EmailQuery();
32 ~EmailQuery() override;
33
34 enum OpType {
35 OpAnd = 0,
36 OpOr,
37 };
38
39 void setSplitSearchMatchString(bool split);
40
41 void setSearchType(OpType op);
42
43 void setInvolves(const QStringList &involves);
44 void addInvolves(const QString &email);
45
46 void setTo(const QStringList &to);
47 void addTo(const QString &to);
48
49 void setFrom(const QString &from);
50 void addFrom(const QString &from);
51
52 void setCc(const QStringList &cc);
53 void addCc(const QString &cc);
54
55 void setBcc(const QStringList &bcc);
56 void addBcc(const QString &bcc);
57
58 void setCollection(const QList<Akonadi::Collection::Id> &collections);
59 void addCollection(Akonadi::Collection::Id id);
60
61 /**
62 * By default the importance is ignored
63 */
64 void setImportant(bool important = true);
65
66 /**
67 * By default the read status is ignored
68 */
69 void setRead(bool read = true);
70
71 /**
72 * By default the attachment status is ignored
73 */
74 void setAttachment(bool hasAttachment = true);
75
76 /**
77 * Matches the string \p match anywhere in the entire email
78 * body
79 */
80 void matches(const QString &match);
81
82 /**
83 * Matches the string \p subjectMatch specifically in the
84 * email subject
85 */
86 void subjectMatches(const QString &subjectMatch);
87
88 /**
89 * Matches the string \p bodyMatch specifically in the body email
90 */
91 void bodyMatches(const QString &bodyMatch);
92
93 void setLimit(int limit);
94 [[nodiscard]] int limit() const;
95
96 /**
97 * Execute the query and return an iterator to fetch
98 * the results
99 */
100 [[nodiscard]] ResultIterator exec() override;
101
102private:
103 //@cond PRIVATE
104 std::unique_ptr<EmailQueryPrivate> const d;
105 //@endcond
106};
107}
108}
109}
Query base class.
Definition lib/query.h:24
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Mon Nov 18 2024 12:10:52 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.