• Skip to content
  • Skip to link menu
  • KDE API Reference
  • kdepimlibs-4.14.10 API Reference
  • KDE Home
  • Contact Us
 

akonadi

  • akonadi
searchquery.h
1/*
2 Copyright (c) 2014 Daniel Vrátil <dvratil@redhat.com>
3
4 This library is free software; you can redistribute it and/or modify it
5 under the terms of the GNU Library General Public License as published by
6 the Free Software Foundation; either version 2 of the License, or (at your
7 option) any later version.
8
9 This library is distributed in the hope that it will be useful, but WITHOUT
10 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public
12 License for more details.
13
14 You should have received a copy of the GNU Library General Public License
15 along with this library; see the file COPYING.LIB. If not, write to the
16 Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
17 02110-1301, USA.
18*/
19
20#ifndef AKONADI_SEARCHQUERY_H
21#define AKONADI_SEARCHQUERY_H
22
23#include <QSharedPointer>
24
25#include "akonadi_export.h"
26
27namespace Akonadi
28{
29
39class AKONADI_EXPORT SearchTerm
40{
41public:
42 enum Relation {
43 RelAnd,
44 RelOr
45 };
46
47 enum Condition {
48 CondEqual,
49 CondGreaterThan,
50 CondGreaterOrEqual,
51 CondLessThan,
52 CondLessOrEqual,
53 CondContains
54 };
55
59 SearchTerm(SearchTerm::Relation relation = SearchTerm::RelAnd);
60
64 SearchTerm(const QString &key, const QVariant &value, SearchTerm::Condition condition = SearchTerm::CondEqual);
65
66 SearchTerm(const SearchTerm &other);
67 ~SearchTerm();
68
69 SearchTerm &operator=(const SearchTerm &other);
70 bool operator==(const SearchTerm &other) const;
71
72 bool isNull() const;
73
77 QString key() const;
78
82 QVariant value() const;
83
87 SearchTerm::Condition condition() const;
88
96 void addSubTerm(const SearchTerm &term);
97
101 QList<SearchTerm> subTerms() const;
102
106 SearchTerm::Relation relation() const;
107
111 void setIsNegated(bool negated);
112
116 bool isNegated() const;
117
118private:
119 class Private;
120 QSharedDataPointer<Private> d;
121};
122
128class AKONADI_EXPORT SearchQuery
129{
130public:
134 SearchQuery(SearchTerm::Relation rel = SearchTerm::RelAnd);
135
136 ~SearchQuery();
137 SearchQuery(const SearchQuery &other);
138 SearchQuery &operator=(const SearchQuery &other);
139 bool operator==(const SearchQuery &other) const;
140
141 bool isNull() const;
142
146 void addTerm(const QString &key, const QVariant &value, SearchTerm::Condition condition = SearchTerm::CondEqual);
147
151 void addTerm(const SearchTerm &term);
152
156 void setTerm(const SearchTerm &term);
157
161 SearchTerm term() const;
162
169 void setLimit(int limit);
170
176 int limit() const;
177
178 QByteArray toJSON() const;
179 static SearchQuery fromJSON(const QByteArray &json);
180
181private:
182 class Private;
183 QSharedDataPointer<Private> d;
184
185};
186
194class AKONADI_EXPORT EmailSearchTerm : public SearchTerm
195{
196public:
197
201 enum EmailSearchField {
202 Unknown,
203 Subject,
204 Body,
205 Message, //Complete message including headers, body and attachment
206 Headers, //All headers
207 HeaderFrom,
208 HeaderTo,
209 HeaderCC,
210 HeaderBCC,
211 HeaderReplyTo,
212 HeaderOrganization,
213 HeaderListId,
214 HeaderResentFrom,
215 HeaderXLoop,
216 HeaderXMailingList,
217 HeaderXSpamFlag,
218 HeaderDate, //Expects QDateTime
219 HeaderOnlyDate, //Expectes QDate
220 MessageStatus, //Expects message flag from Akonadi::MessageFlags. Boolean filter.
221 ByteSize, //Expects int
222 Attachment, //Textsearch on attachment
223 MessageTag
224 };
225
229 EmailSearchTerm(EmailSearchField field, const QVariant &value, SearchTerm::Condition condition = SearchTerm::CondEqual);
230
234 static QString toKey(EmailSearchField);
235
239 static EmailSearchField fromKey(const QString &key);
240};
241
249class AKONADI_EXPORT ContactSearchTerm : public SearchTerm
250{
251public:
252 enum ContactSearchField {
253 Unknown,
254 Name,
255 Email,
256 Nickname,
257 Uid,
258 All //Special field: matches all contacts.
259 };
260
261 ContactSearchTerm(ContactSearchField field, const QVariant &value, SearchTerm::Condition condition = SearchTerm::CondEqual);
262
266 static QString toKey(ContactSearchField);
267
271 static ContactSearchField fromKey(const QString &key);
272};
273
274}
275
276#endif // AKONADI_SEARCHQUERY_H
Akonadi::ContactSearchTerm::fromKey
static ContactSearchField fromKey(const QString &key)
Translates key to field.
Definition searchquery.cpp:376
Akonadi::ContactSearchTerm::toKey
static QString toKey(ContactSearchField)
Translates field to key.
Definition searchquery.cpp:371
Akonadi::EmailSearchTerm
A search term for an email field.
Definition searchquery.h:195
Akonadi::EmailSearchTerm::EmailSearchTerm
EmailSearchTerm(EmailSearchField field, const QVariant &value, SearchTerm::Condition condition=SearchTerm::CondEqual)
Constructs an email end term.
Definition searchquery.cpp:336
Akonadi::EmailSearchTerm::EmailSearchField
EmailSearchField
All fields expect a search string unless noted otherwise.
Definition searchquery.h:201
Akonadi::SearchQuery::setTerm
void setTerm(const SearchTerm &term)
Sets the root term.
Definition searchquery.cpp:265
Akonadi::SearchQuery::addTerm
void addTerm(const QString &key, const QVariant &value, SearchTerm::Condition condition=SearchTerm::CondEqual)
Adds a new term.
Definition searchquery.cpp:255
Akonadi::SearchQuery::setLimit
void setLimit(int limit)
Sets the maximum number of results.
Definition searchquery.cpp:270
Akonadi::SearchQuery::limit
int limit() const
Returns the maximum number of results.
Definition searchquery.cpp:275
Akonadi::SearchQuery::SearchQuery
SearchQuery(SearchTerm::Relation rel=SearchTerm::RelAnd)
Constructs query where all added terms will be in given relation.
Definition searchquery.cpp:219
Akonadi::SearchQuery::term
SearchTerm term() const
Returns the root term.
Definition searchquery.cpp:250
Akonadi::SearchTerm
Search term represents the actual condition within query.
Definition searchquery.h:40
Akonadi::SearchTerm::value
QVariant value() const
Returns value of this end term.
Definition searchquery.cpp:184
Akonadi::SearchTerm::key
QString key() const
Returns key of this end term.
Definition searchquery.cpp:179
Akonadi::SearchTerm::addSubTerm
void addSubTerm(const SearchTerm &term)
Adds a new subterm to this term.
Definition searchquery.cpp:204
Akonadi::SearchTerm::setIsNegated
void setIsNegated(bool negated)
Sets whether the entire term is negated.
Definition searchquery.cpp:194
Akonadi::SearchTerm::condition
SearchTerm::Condition condition() const
Returns relation between key and value.
Definition searchquery.cpp:189
Akonadi::SearchTerm::SearchTerm
SearchTerm(SearchTerm::Relation relation=SearchTerm::RelAnd)
Constructs a term where all subterms will be in given relation.
Definition searchquery.cpp:139
Akonadi::SearchTerm::isNegated
bool isNegated() const
Returns whether the entire term is negated.
Definition searchquery.cpp:199
Akonadi::SearchTerm::subTerms
QList< SearchTerm > subTerms() const
Returns all subterms, or an empty list if this is an end term.
Definition searchquery.cpp:209
Akonadi::SearchTerm::relation
SearchTerm::Relation relation() const
Returns relation in which all subterms are.
Definition searchquery.cpp:214
Akonadi
FreeBusyManager::Singleton.
Definition actionstatemanager_p.h:28
This file is part of the KDE documentation.
Documentation copyright © 1996-2025 The KDE developers.
Generated on Fri Jan 17 2025 00:00:00 by doxygen 1.13.2 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

akonadi

Skip menu "akonadi"
  • Main Page
  • Namespace List
  • Namespace Members
  • Alphabetical List
  • Class List
  • Class Hierarchy
  • Class Members
  • File List
  • Related Pages

kdepimlibs-4.14.10 API Reference

Skip menu "kdepimlibs-4.14.10 API Reference"
  • akonadi
  •   contact
  •   kmime
  •   socialutils
  • kabc
  • kalarmcal
  • kblog
  • kcal
  • kcalcore
  • kcalutils
  • kholidays
  • kimap
  • kioslave
  •   imap4
  •   mbox
  •   nntp
  • kldap
  • kmbox
  • kmime
  • kontactinterface
  • kpimidentities
  • kpimtextedit
  • kpimutils
  • kresources
  • ktnef
  • kxmlrpcclient
  • mailtransport
  • microblog
  • qgpgme
  • syndication
  •   atom
  •   rdf
  •   rss2
Report problems with this website to our bug tracking system.
Contact the specific authors with questions and comments about the page contents.

KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal