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

KIMAP Library

  • sources
  • kde-4.14
  • kdepimlibs
  • kimap
searchjob.h
1 /*
2  Copyright (c) 2009 Andras Mantia <amantia@kde.org>
3  Copyright (c) 2014 Christian Mollekopf <mollekopf@kolabsys.com>
4 
5  This library is free software; you can redistribute it and/or modify it
6  under the terms of the GNU Library General Public License as published by
7  the Free Software Foundation; either version 2 of the License, or (at your
8  option) any later version.
9 
10  This library is distributed in the hope that it will be useful, but WITHOUT
11  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12  FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public
13  License for more details.
14 
15  You should have received a copy of the GNU Library General Public License
16  along with this library; see the file COPYING.LIB. If not, write to the
17  Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
18  02110-1301, USA.
19 */
20 
21 #ifndef KIMAP_SEARCHJOB_H
22 #define KIMAP_SEARCHJOB_H
23 
24 #include "kimap_export.h"
25 
26 #include "job.h"
27 
28 class QDate;
29 
30 namespace KIMAP {
31 
32 class ImapSet;
33 
34 class Session;
35 struct Message;
36 class SearchJobPrivate;
37 
43 class KIMAP_EXPORT Term
44 {
45  public:
46  enum Relation {
47  And,
48  Or
49  };
50 
51  enum SearchKey {
52  All,
53  Bcc,
54  Body,
55  Cc,
56  From,
57  Subject,
58  Text,
59  To,
60  Keyword
61  };
62 
63  enum BooleanSearchKey {
64  New,
65  Old,
66  Recent,
67  Seen,
68  Draft,
69  Deleted,
70  Flagged,
71  Answered
72  };
73 
74  enum DateSearchKey {
75  Before,
76  On,
77  Since,
78  SentBefore,
79  SentOn,
80  SentSince
81  };
82  enum NumberSearchKey {
83  Larger,
84  Smaller
85  };
86  enum SequenceSearchKey {
87  Uid,
88  SequenceNumber
89  };
90 
91  Term();
92  Term( Relation relation, const QVector<Term> &subterms );
93  Term( SearchKey key, const QString &value );
94  Term( BooleanSearchKey key );
95  Term( DateSearchKey key, const QDate &date );
96  Term( NumberSearchKey key, int value );
97  Term( SequenceSearchKey key, const KIMAP::ImapSet & );
98  Term( const QString &header, const QString &value );
99 
100  Term( const Term &other );
101 
102  Term& operator=( const Term &other );
103  bool operator==( const Term &other ) const;
104 
105  bool isNull() const;
106 
107  Term &setFuzzy( bool fuzzy );
108  Term &setNegated( bool negated );
109 
110  QByteArray serialize() const;
111 
112  private:
113  class Private;
114  QSharedPointer<Private> d;
115 };
116 
117 class KIMAP_EXPORT SearchJob : public Job
118 {
119  Q_OBJECT
120  Q_DECLARE_PRIVATE( SearchJob )
121 
122  friend class SessionPrivate;
123 
124  public:
125  enum SearchLogic {
126  And = 0,
127  Or,
128  Not
129  };
130 
131  enum SearchCriteria {
132  All = 0,
133  Answered,
134  BCC,
135  Before,
136  Body,
137  CC,
138  Deleted,
139  Draft,
140  Flagged,
141  From,
142  Header,
143  Keyword,
144  Larger,
145  New,
146  Old,
147  On,
148  Recent,
149  Seen,
150  SentBefore,
151  SentOn,
152  SentSince,
153  Since,
154  Smaller,
155  Subject,
156  Text,
157  To,
158  Uid,
159  Unanswered,
160  Undeleted,
161  Undraft,
162  Unflagged,
163  Unkeyword,
164  Unseen
165  };
166 
167  explicit SearchJob( Session *session );
168  virtual ~SearchJob();
169 
170  void setUidBased(bool uidBased);
171  bool isUidBased() const;
172 
173  void setCharset( const QByteArray &charSet );
174  QByteArray charset() const;
175 
181  KIMAP_DEPRECATED QList<int> foundItems();
182 
188  QList<qint64> results() const;
189 
196  KIMAP_DEPRECATED void addSearchCriteria( SearchCriteria criteria );
197 
206  KIMAP_DEPRECATED void addSearchCriteria( SearchCriteria criteria, const QByteArray &argument );
207 
216  KIMAP_DEPRECATED void addSearchCriteria( SearchCriteria criteria, int argument );
217 
226  KIMAP_DEPRECATED void addSearchCriteria( SearchCriteria criteria, const QDate& argument );
227 
234  KIMAP_DEPRECATED void addSearchCriteria( const QByteArray &searchCriteria );
235 
241  KIMAP_DEPRECATED void setSearchLogic(SearchLogic logic);
242 
248  void setTerm( const Term & );
249 
250  protected:
251  virtual void doStart();
252  virtual void handleResponse(const Message &response);
253 };
254 
255 }
256 
257 #endif
QByteArray
KIMAP::Term
A query term.
Definition: searchjob.h:43
QSharedPointer< Private >
QDate
QString
QList
KIMAP::ImapSet
Represents a set of natural numbers (1-> ) in a as compact as possible form.
Definition: imapset.h:140
QVector
This file is part of the KDE documentation.
Documentation copyright © 1996-2020 The KDE developers.
Generated on Mon Jun 22 2020 13:37:03 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

KIMAP Library

Skip menu "KIMAP Library"
  • Main Page
  • Namespace List
  • Namespace Members
  • Alphabetical List
  • Class List
  • Class Hierarchy
  • Class Members
  • File List
  • 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