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

akonadi

  • sources
  • kde-4.14
  • kdepimlibs
  • 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 
27 namespace Akonadi
28 {
29 
39 class AKONADI_EXPORT SearchTerm
40 {
41 public:
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 
118 private:
119  class Private;
120  QSharedDataPointer<Private> d;
121 };
122 
128 class AKONADI_EXPORT SearchQuery
129 {
130 public:
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 
181 private:
182  class Private;
183  QSharedDataPointer<Private> d;
184 
185 };
186 
194 class AKONADI_EXPORT EmailSearchTerm : public SearchTerm
195 {
196 public:
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 
249 class AKONADI_EXPORT ContactSearchTerm : public SearchTerm
250 {
251 public:
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
QByteArray
QString
QList
Akonadi::SearchQuery
A query that can be passed to ItemSearchJob or others.
Definition: searchquery.h:128
Akonadi::MessageStatus
Akonadi KMime Message Status.
Definition: messagestatus.h:51
Akonadi::SearchTerm
Search term represents the actual condition within query.
Definition: searchquery.h:39
Akonadi::EmailSearchTerm
A search term for an email field.
Definition: searchquery.h:194
Akonadi::ContactSearchTerm
A search term for a contact field.
Definition: searchquery.h:249
QSharedDataPointer< Private >
QVariant
Akonadi::EmailSearchTerm::EmailSearchField
EmailSearchField
All fields expect a search string unless noted otherwise.
Definition: searchquery.h:201
This file is part of the KDE documentation.
Documentation copyright © 1996-2020 The KDE developers.
Generated on Mon Jun 22 2020 13:38:03 by doxygen 1.8.7 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
  • Modules
  • Related Pages

kdepimlibs API Reference

Skip menu "kdepimlibs 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

Search



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