KIMAP Library
fetchjob.h
00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020 #ifndef KIMAP_FETCHJOB_H
00021 #define KIMAP_FETCHJOB_H
00022
00023 #include "kimap_export.h"
00024
00025 #include "imapset.h"
00026 #include "job.h"
00027
00028 #include "kmime/kmime_content.h"
00029 #include "kmime/kmime_message.h"
00030
00031 #include <boost/shared_ptr.hpp>
00032
00033 namespace KIMAP {
00034
00035 class Session;
00036 struct Message;
00037 class FetchJobPrivate;
00038
00039 typedef boost::shared_ptr<KMime::Content> ContentPtr;
00040 typedef QMap<QByteArray, ContentPtr> MessageParts;
00041
00042 typedef boost::shared_ptr<KMime::Message> MessagePtr;
00043 typedef QList<QByteArray> MessageFlags;
00044
00045 class KIMAP_EXPORT FetchJob : public Job
00046 {
00047 Q_OBJECT
00048 Q_DECLARE_PRIVATE(FetchJob)
00049
00050 friend class SessionPrivate;
00051
00052 public:
00053 struct FetchScope
00054 {
00055 QList<QByteArray> parts;
00056 enum {Headers, Flags, Structure, Content} mode;
00057 };
00058
00059 explicit FetchJob( Session *session );
00060 virtual ~FetchJob();
00061
00062 void setSequenceSet( const ImapSet &set );
00063 ImapSet sequenceSet() const;
00064
00065 void setUidBased(bool uidBased);
00066 bool isUidBased() const;
00067
00068 void setScope( const FetchScope &scope );
00069 FetchScope scope() const;
00070
00071 QMap<qint64, MessagePtr> messages() const;
00072 QMap<qint64, MessageParts> parts() const;
00073 QMap<qint64, MessageFlags> flags() const;
00074 QMap<qint64, qint64> sizes() const;
00075 QMap<qint64, qint64> uids() const;
00076
00077 Q_SIGNALS:
00078 void headersReceived( const QString &mailBox,
00079 const QMap<qint64, qint64> &uids,
00080 const QMap<qint64, qint64> &sizes,
00081 const QMap<qint64, KIMAP::MessageFlags> &flags,
00082 const QMap<qint64, KIMAP::MessagePtr> &messages );
00083
00084 void messagesReceived( const QString &mailBox,
00085 const QMap<qint64, qint64> &uids,
00086 const QMap<qint64, KIMAP::MessagePtr> &messages );
00087
00088 void partsReceived( const QString &mailBox,
00089 const QMap<qint64, qint64> &uids,
00090 const QMap<qint64, KIMAP::MessageParts> &parts );
00091
00092 protected:
00093 virtual void doStart();
00094 virtual void handleResponse(const Message &response);
00095
00096 private:
00097 Q_PRIVATE_SLOT( d_func(), void emitPendings() )
00098 };
00099
00100 }
00101
00102 #endif