KIMAP

fetchjob.h
1 /*
2  Copyright (c) 2009 Kevin Ottens <[email protected]>
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 KIMAP_FETCHJOB_H
21 #define KIMAP_FETCHJOB_H
22 
23 #include "kimap_export.h"
24 
25 #include "imapset.h"
26 #include "job.h"
27 
28 #include <kmime/kmime_content.h>
29 #include <kmime/kmime_message.h>
30 
31 namespace KIMAP
32 {
33 
34 class Session;
35 struct Response;
36 class FetchJobPrivate;
37 
38 typedef QSharedPointer<KMime::Content> ContentPtr;
39 typedef QMap<QByteArray, ContentPtr> MessageParts;
40 
41 typedef QSharedPointer<KMime::Message> MessagePtr;
42 typedef QList<QByteArray> MessageFlags;
43 
44 typedef QPair<QByteArray, QVariant> MessageAttribute;
45 
46 struct Message
47 {
48  qint64 uid;
49  qint64 size;
50  MessageFlags flags;
51  QMap<QByteArray, QVariant> attributes;
52  MessageParts parts;
53  MessagePtr message;
54 };
55 
56 
68 class KIMAP_EXPORT FetchJob : public Job
69 {
70  Q_OBJECT
71  Q_DECLARE_PRIVATE(FetchJob)
72 
73  friend class SessionPrivate;
74 
75 public:
83  class KIMAP_EXPORT FetchScope
84  {
85  public:
86  FetchScope();
87 
91  enum Mode {
143 
152  FullHeaders
153  };
154 
176 
186  quint64 changedSince;
187  };
188 
189  explicit FetchJob(Session *session);
190  ~FetchJob() override;
191 
200  void setSequenceSet(const ImapSet &set);
204  ImapSet sequenceSet() const;
205 
213  void setUidBased(bool uidBased);
221  bool isUidBased() const;
222 
231  void setScope(const FetchScope &scope);
235  FetchScope scope() const;
236 
237  // TODO: KF5: Move this to FetchScope
249  void setGmailExtensionsEnabled(bool enabled);
250 
257  bool setGmailExtensionsEnabled() const;
258 
267  QString mailBox() const;
268 
269 Q_SIGNALS:
302  KIMAP_DEPRECATED
303  void headersReceived(const QString &mailBox,
304  const QMap<qint64, qint64> &uids,
305  const QMap<qint64, qint64> &sizes,
307  const QMap<qint64, KIMAP::MessagePtr> &messages);
308 
335  KIMAP_DEPRECATED
336  void headersReceived(const QString &mailBox,
337  const QMap<qint64, qint64> &uids,
338  const QMap<qint64, qint64> &sizes,
341  const QMap<qint64, KIMAP::MessagePtr> &messages);
342 
363  KIMAP_DEPRECATED
364  void messagesReceived(const QString &mailBox,
365  const QMap<qint64, qint64> &uids,
366  const QMap<qint64, KIMAP::MessagePtr> &messages);
367 
385  KIMAP_DEPRECATED
386  void messagesReceived(const QString &mailBox,
387  const QMap<qint64, qint64> &uids,
389  const QMap<qint64, KIMAP::MessagePtr> &messages);
409  KIMAP_DEPRECATED
410  void partsReceived(const QString &mailBox,
411  const QMap<qint64, qint64> &uids,
412  const QMap<qint64, KIMAP::MessageParts> &parts);
413 
430  KIMAP_DEPRECATED
431  void partsReceived(const QString &mailBox,
432  const QMap<qint64, qint64> &uids,
434  const QMap<qint64, KIMAP::MessageParts> &parts);
435 
447  void messagesAvailable(const QMap<qint64, KIMAP::Message> &messages);
448 
449 protected:
450  void doStart() override;
451  void handleResponse(const Response &response) override;
452 
453 private:
454  Q_PRIVATE_SLOT(d_func(), void emitPendings())
455 };
456 
457 }
458 
459 #endif
KCOREADDONS_EXPORT void message(KMessage::MessageType messageType, const QString &text, const QString &caption=QString())
Mode
Used to indicate what part of the message should be fetched.
Definition: fetchjob.h:91
Fetch the message content (the UID is also fetched)
Definition: fetchjob.h:120
QList< QByteArray > parts
Specify which message parts to operate on.
Definition: fetchjob.h:171
quint64 changedSince
Specify to fetch only items with mod-sequence higher then changedSince.
Definition: fetchjob.h:186
Fetch the complete message.
Definition: fetchjob.h:124
Fetch the MIME message body structure (the UID is also fetched)
Definition: fetchjob.h:113
Mode mode
Specify what message data should be fetched.
Definition: fetchjob.h:175
Fetch RFC-2822 or MIME message headers.
Definition: fetchjob.h:105
Fetch message data from the server.
Definition: fetchjob.h:68
Fetch the message MIME headers and the content of parts specified in the parts field.
Definition: fetchjob.h:142
Fetch the message flags (the UID is also fetched)
Definition: fetchjob.h:109
Represents a set of natural numbers (1->∞) in a as compact as possible form.
Definition: imapset.h:141
Definition: acl.cpp:25
Used to indicate what message data should be fetched.
Definition: fetchjob.h:83
This file is part of the KDE documentation.
Documentation copyright © 1996-2020 The KDE developers.
Generated on Fri Jun 5 2020 23:04:45 by doxygen 1.8.11 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.