• Skip to content
  • Skip to link menu
  • KDE API Reference
  • kdepimlibs-4.13.3 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 
21 #ifndef AKONADI_SEARCHQUERY_H
22 #define AKONADI_SEARCHQUERY_H
23 
24 #include <QSharedPointer>
25 
26 #include "akonadi_export.h"
27 
28 namespace Akonadi
29 {
30 
40 class AKONADI_EXPORT SearchTerm
41 {
42  public:
43  enum Relation {
44  RelAnd,
45  RelOr
46  };
47 
48  enum Condition {
49  CondEqual,
50  CondGreaterThan,
51  CondGreaterOrEqual,
52  CondLessThan,
53  CondLessOrEqual,
54  CondContains
55  };
56 
60  SearchTerm( SearchTerm::Relation relation = SearchTerm::RelAnd );
61 
65  SearchTerm( const QString &key, const QVariant &value, SearchTerm::Condition condition = SearchTerm::CondEqual );
66 
67  SearchTerm( const SearchTerm &other );
68  ~SearchTerm();
69 
70  SearchTerm& operator=( const SearchTerm &other );
71  bool operator==( const SearchTerm &other ) const;
72 
73  bool isNull() const;
74 
78  QString key() const;
79 
83  QVariant value() const;
84 
88  SearchTerm::Condition condition() const;
89 
97  void addSubTerm( const SearchTerm &term );
98 
102  QList<SearchTerm> subTerms() const;
103 
107  SearchTerm::Relation relation() const;
108 
112  void setIsNegated( bool negated );
113 
117  bool isNegated() const;
118 
119  private:
120  class Private;
121  QSharedDataPointer<Private> d;
122 };
123 
129 class AKONADI_EXPORT SearchQuery
130 {
131  public:
135  SearchQuery( SearchTerm::Relation rel = SearchTerm::RelAnd );
136 
137  ~SearchQuery();
138  SearchQuery( const SearchQuery &other );
139  SearchQuery& operator=( const SearchQuery &other );
140  bool operator==( const SearchQuery &other ) const;
141 
142  bool isNull() const;
143 
147  void addTerm( const QString &key, const QVariant &value, SearchTerm::Condition condition = SearchTerm::CondEqual );
148 
152  void addTerm( const SearchTerm &term );
153 
157  void setTerm( const SearchTerm &term );
158 
162  SearchTerm term() const;
163 
170  void setLimit( int limit );
171 
177  int limit() const;
178 
179  QByteArray toJSON() const;
180  static SearchQuery fromJSON( const QByteArray &json );
181 
182  private:
183  class Private;
184  QSharedDataPointer<Private> d;
185 
186 };
187 
195 class AKONADI_EXPORT EmailSearchTerm : public SearchTerm
196 {
197  public:
198 
202  enum EmailSearchField {
203  Unknown,
204  Subject,
205  Body,
206  Message, //Complete message including headers, body and attachment
207  Headers, //All headers
208  HeaderFrom,
209  HeaderTo,
210  HeaderCC,
211  HeaderBCC,
212  HeaderReplyTo,
213  HeaderOrganization,
214  HeaderListId,
215  HeaderResentFrom,
216  HeaderXLoop,
217  HeaderXMailingList,
218  HeaderXSpamFlag,
219  HeaderDate, //Expects QDateTime
220  HeaderOnlyDate, //Expectes QDate
221  MessageStatus, //Expects message flag from Akonadi::MessageFlags. Boolean filter.
222  ByteSize, //Expects int
223  Attachment, //Textsearch on attachment
224  MessageTag
225  };
226 
230  EmailSearchTerm( EmailSearchField field, const QVariant &value, SearchTerm::Condition condition = SearchTerm::CondEqual );
231 
235  static QString toKey( EmailSearchField );
236 
240  static EmailSearchField fromKey( const QString &key );
241 };
242 
250 class AKONADI_EXPORT ContactSearchTerm : public SearchTerm
251 {
252  public:
253  enum ContactSearchField {
254  Unknown,
255  Name,
256  Email,
257  Nickname,
258  Uid,
259  All //Special field: matches all contacts.
260  };
261 
262  ContactSearchTerm( ContactSearchField field, const QVariant &value, SearchTerm::Condition condition = SearchTerm::CondEqual );
263 
267  static QString toKey( ContactSearchField );
268 
272  static ContactSearchField fromKey( const QString &key );
273 };
274 
275 }
276 
277 #endif // AKONADI_SEARCHQUERY_H
Akonadi::SearchQuery
A query that can be passed to ItemSearchJob or others.
Definition: searchquery.h:129
Akonadi::MessageStatus
Akonadi KMime Message Status.
Definition: messagestatus.h:51
Akonadi::SearchTerm
Search term represents the actual condition within query.
Definition: searchquery.h:40
Akonadi::EmailSearchTerm
A search term for an email field.
Definition: searchquery.h:195
Akonadi::ContactSearchTerm
A search term for a contact field.
Definition: searchquery.h:250
Akonadi::EmailSearchTerm::EmailSearchField
EmailSearchField
All fields expect a search string unless noted otherwise.
Definition: searchquery.h:202
This file is part of the KDE documentation.
Documentation copyright © 1996-2014 The KDE developers.
Generated on Mon Jul 21 2014 08:03:55 by doxygen 1.8.6 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-4.13.3 API Reference

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