KIMAP

fetchjob.h
1 /*
2  SPDX-FileCopyrightText: 2009 Kevin Ottens <[email protected]>
3 
4  SPDX-License-Identifier: LGPL-2.0-or-later
5 */
6 
7 #ifndef KIMAP_FETCHJOB_H
8 #define KIMAP_FETCHJOB_H
9 
10 #include "kimap_export.h"
11 
12 #include "imapset.h"
13 #include "job.h"
14 
15 #include <kmime/kmime_content.h>
16 #include <kmime/kmime_message.h>
17 
18 namespace KIMAP
19 {
20 
21 class Session;
22 struct Response;
23 class FetchJobPrivate;
24 
25 typedef QSharedPointer<KMime::Content> ContentPtr;
26 typedef QMap<QByteArray, ContentPtr> MessageParts;
27 
28 typedef QSharedPointer<KMime::Message> MessagePtr;
29 typedef QList<QByteArray> MessageFlags;
30 
31 typedef QPair<QByteArray, QVariant> MessageAttribute;
32 
33 struct Message
34 {
35  qint64 uid;
36  qint64 size;
37  MessageFlags flags;
38  QMap<QByteArray, QVariant> attributes;
39  MessageParts parts;
40  MessagePtr message;
41 };
42 
43 
55 class KIMAP_EXPORT FetchJob : public Job
56 {
57  Q_OBJECT
58  Q_DECLARE_PRIVATE(FetchJob)
59 
60  friend class SessionPrivate;
61 
62 public:
70  class KIMAP_EXPORT FetchScope
71  {
72  public:
73  FetchScope();
74 
78  enum Mode {
130 
139  FullHeaders
140  };
141 
163 
173  quint64 changedSince;
174  };
175 
176  explicit FetchJob(Session *session);
177  ~FetchJob() override;
178 
187  void setSequenceSet(const ImapSet &set);
191  ImapSet sequenceSet() const;
192 
200  void setUidBased(bool uidBased);
208  bool isUidBased() const;
209 
218  void setScope(const FetchScope &scope);
222  FetchScope scope() const;
223 
224  // TODO: KF5: Move this to FetchScope
236  void setGmailExtensionsEnabled(bool enabled);
237 
244  bool setGmailExtensionsEnabled() const;
245 
254  QString mailBox() const;
255 
256 Q_SIGNALS:
289  KIMAP_DEPRECATED
290  void headersReceived(const QString &mailBox,
291  const QMap<qint64, qint64> &uids,
292  const QMap<qint64, qint64> &sizes,
294  const QMap<qint64, KIMAP::MessagePtr> &messages);
295 
322  KIMAP_DEPRECATED
323  void headersReceived(const QString &mailBox,
324  const QMap<qint64, qint64> &uids,
325  const QMap<qint64, qint64> &sizes,
328  const QMap<qint64, KIMAP::MessagePtr> &messages);
329 
350  KIMAP_DEPRECATED
351  void messagesReceived(const QString &mailBox,
352  const QMap<qint64, qint64> &uids,
353  const QMap<qint64, KIMAP::MessagePtr> &messages);
354 
372  KIMAP_DEPRECATED
373  void messagesReceived(const QString &mailBox,
374  const QMap<qint64, qint64> &uids,
376  const QMap<qint64, KIMAP::MessagePtr> &messages);
396  KIMAP_DEPRECATED
397  void partsReceived(const QString &mailBox,
398  const QMap<qint64, qint64> &uids,
399  const QMap<qint64, KIMAP::MessageParts> &parts);
400 
417  KIMAP_DEPRECATED
418  void partsReceived(const QString &mailBox,
419  const QMap<qint64, qint64> &uids,
421  const QMap<qint64, KIMAP::MessageParts> &parts);
422 
434  void messagesAvailable(const QMap<qint64, KIMAP::Message> &messages);
435 
436 protected:
437  void doStart() override;
438  void handleResponse(const Response &response) override;
439 
440 private:
441  Q_PRIVATE_SLOT(d_func(), void emitPendings())
442 };
443 
444 }
445 
446 #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:78
Fetch the message content (the UID is also fetched)
Definition: fetchjob.h:107
QList< QByteArray > parts
Specify which message parts to operate on.
Definition: fetchjob.h:158
quint64 changedSince
Specify to fetch only items with mod-sequence higher then changedSince.
Definition: fetchjob.h:173
Fetch the complete message.
Definition: fetchjob.h:111
Fetch the MIME message body structure (the UID is also fetched)
Definition: fetchjob.h:100
Mode mode
Specify what message data should be fetched.
Definition: fetchjob.h:162
Fetch RFC-2822 or MIME message headers.
Definition: fetchjob.h:92
Fetch message data from the server.
Definition: fetchjob.h:55
Fetch the message MIME headers and the content of parts specified in the parts field.
Definition: fetchjob.h:129
Fetch the message flags (the UID is also fetched)
Definition: fetchjob.h:96
Represents a set of natural numbers (1->∞) in a as compact as possible form.
Definition: imapset.h:128
Definition: acl.cpp:12
Used to indicate what message data should be fetched.
Definition: fetchjob.h:70
This file is part of the KDE documentation.
Documentation copyright © 1996-2020 The KDE developers.
Generated on Thu Oct 22 2020 23:15:43 by doxygen 1.8.11 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.