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
00056 class KIMAP_EXPORT FetchJob : public Job
00057 {
00058 Q_OBJECT
00059 Q_DECLARE_PRIVATE(FetchJob)
00060
00061 friend class SessionPrivate;
00062
00063 public:
00071 struct FetchScope
00072 {
00076 enum Mode {
00090 Headers,
00094 Flags,
00098 Structure,
00105 Content,
00109 Full
00110 };
00111
00128 QList<QByteArray> parts;
00132 Mode mode;
00133 };
00134
00135 explicit FetchJob( Session *session );
00136 virtual ~FetchJob();
00137
00146 void setSequenceSet( const ImapSet &set );
00150 ImapSet sequenceSet() const;
00151
00159 void setUidBased(bool uidBased);
00167 bool isUidBased() const;
00168
00177 void setScope( const FetchScope &scope );
00181 FetchScope scope() const;
00182
00183
00185 KDE_DEPRECATED QMap<qint64, MessagePtr> messages() const;
00187 KDE_DEPRECATED QMap<qint64, MessageParts> parts() const;
00189 KDE_DEPRECATED QMap<qint64, MessageFlags> flags() const;
00191 KDE_DEPRECATED QMap<qint64, qint64> sizes() const;
00193 KDE_DEPRECATED QMap<qint64, qint64> uids() const;
00194
00195 Q_SIGNALS:
00226 void headersReceived( const QString &mailBox,
00227 const QMap<qint64, qint64> &uids,
00228 const QMap<qint64, qint64> &sizes,
00229 const QMap<qint64, KIMAP::MessageFlags> &flags,
00230 const QMap<qint64, KIMAP::MessagePtr> &messages );
00231
00250 void messagesReceived( const QString &mailBox,
00251 const QMap<qint64, qint64> &uids,
00252 const QMap<qint64, KIMAP::MessagePtr> &messages );
00253
00271 void partsReceived( const QString &mailBox,
00272 const QMap<qint64, qint64> &uids,
00273 const QMap<qint64, KIMAP::MessageParts> &parts );
00274
00275 protected:
00276 virtual void doStart();
00277 virtual void handleResponse(const Message &response);
00278
00279 private:
00280 Q_PRIVATE_SLOT( d_func(), void emitPendings() )
00281 };
00282
00283 }
00284
00285 #endif