KIMAP Library
fetchjob.h
00001 /* 00002 Copyright (c) 2009 Kevin Ottens <ervin@kde.org> 00003 00004 This library is free software; you can redistribute it and/or modify it 00005 under the terms of the GNU Library General Public License as published by 00006 the Free Software Foundation; either version 2 of the License, or (at your 00007 option) any later version. 00008 00009 This library is distributed in the hope that it will be useful, but WITHOUT 00010 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 00011 FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public 00012 License for more details. 00013 00014 You should have received a copy of the GNU Library General Public License 00015 along with this library; see the file COPYING.LIB. If not, write to the 00016 Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 00017 02110-1301, USA. 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, 00127 HeaderAndContent 00128 }; 00129 00146 QList<QByteArray> parts; 00150 Mode mode; 00151 }; 00152 00153 explicit FetchJob( Session *session ); 00154 virtual ~FetchJob(); 00155 00164 void setSequenceSet( const ImapSet &set ); 00168 ImapSet sequenceSet() const; 00169 00177 void setUidBased(bool uidBased); 00185 bool isUidBased() const; 00186 00195 void setScope( const FetchScope &scope ); 00199 FetchScope scope() const; 00200 00201 // XXX: [alexmerry, 2010-07-24]: BIC? Behaviour change 00203 KDE_DEPRECATED QMap<qint64, MessagePtr> messages() const; 00205 KDE_DEPRECATED QMap<qint64, MessageParts> parts() const; 00207 KDE_DEPRECATED QMap<qint64, MessageFlags> flags() const; 00209 KDE_DEPRECATED QMap<qint64, qint64> sizes() const; 00211 KDE_DEPRECATED QMap<qint64, qint64> uids() const; 00212 00213 Q_SIGNALS: 00244 void headersReceived( const QString &mailBox, 00245 const QMap<qint64, qint64> &uids, 00246 const QMap<qint64, qint64> &sizes, 00247 const QMap<qint64, KIMAP::MessageFlags> &flags, 00248 const QMap<qint64, KIMAP::MessagePtr> &messages ); 00249 00268 void messagesReceived( const QString &mailBox, 00269 const QMap<qint64, qint64> &uids, 00270 const QMap<qint64, KIMAP::MessagePtr> &messages ); 00271 00289 void partsReceived( const QString &mailBox, 00290 const QMap<qint64, qint64> &uids, 00291 const QMap<qint64, KIMAP::MessageParts> &parts ); 00292 00293 protected: 00294 virtual void doStart(); 00295 virtual void handleResponse(const Message &response); 00296 00297 private: 00298 Q_PRIVATE_SLOT( d_func(), void emitPendings() ) 00299 }; 00300 00301 } 00302 00303 #endif