kmail
popaccount.hGo to the documentation of this file.00001
00002 #ifndef KMAcctExpPop_h
00003 #define KMAcctExpPop_h
00004
00005 #include "networkaccount.h"
00006
00007 #include <qvaluelist.h>
00008 #include <qstringlist.h>
00009 #include <qvaluevector.h>
00010 #include <qtimer.h>
00011 #include <qdict.h>
00012
00013 class KMPopHeaders;
00014 class KMMessage;
00015 class QDataStream;
00016 namespace KIO {
00017 class MetaData;
00018 class Slave;
00019 class SimpleJob;
00020 class Job;
00021 }
00022
00024 namespace KMail {
00028 class PopAccount: public NetworkAccount {
00029 Q_OBJECT
00030
00031 public:
00032 virtual ~PopAccount();
00033 virtual void init(void);
00034
00035 virtual KIO::MetaData slaveConfig() const;
00036
00038 virtual void pseudoAssign( const KMAccount * a );
00039
00040 virtual QString protocol() const;
00041 virtual unsigned short int defaultPort() const;
00042
00046 bool usePipelining(void) const { return mUsePipelining; }
00047 virtual void setUsePipelining(bool);
00048
00053 bool leaveOnServer(void) const { return mLeaveOnServer; }
00054 virtual void setLeaveOnServer(bool);
00055
00059 int leaveOnServerDays(void) const { return mLeaveOnServerDays; }
00060 virtual void setLeaveOnServerDays(int);
00061
00065 int leaveOnServerCount(void) const { return mLeaveOnServerCount; }
00066 virtual void setLeaveOnServerCount(int);
00067
00071 int leaveOnServerSize(void) const { return mLeaveOnServerSize; }
00072 virtual void setLeaveOnServerSize(int);
00073
00078 bool filterOnServer(void) const { return mFilterOnServer; }
00079 virtual void setFilterOnServer(bool);
00080
00085 unsigned int filterOnServerCheckSize(void) const { return mFilterOnServerCheckSize; }
00086 virtual void setFilterOnServerCheckSize(unsigned int);
00087
00091 virtual QString type(void) const;
00092 virtual void readConfig(KConfig&);
00093 virtual void writeConfig(KConfig&);
00094 virtual void processNewMail(bool _interactive);
00095
00096 virtual void killAllJobs( bool disconnectSlave=false );
00097
00098 protected:
00099 enum Stage { Idle, List, Uidl, Head, Retr, Dele, Quit };
00100 friend class ::AccountManager;
00101 PopAccount(AccountManager* owner, const QString& accountName, uint id);
00102
00106 void startJob();
00107
00111 void connectJob();
00112
00116 void processRemainingQueuedMessages();
00117
00121 void saveUidList();
00122
00123 bool mUsePipelining;
00124 bool mLeaveOnServer;
00125 int mLeaveOnServerDays;
00126 int mLeaveOnServerCount;
00127 int mLeaveOnServerSize;
00128 bool gotMsgs;
00129 bool mFilterOnServer;
00130 unsigned int mFilterOnServerCheckSize;
00131
00132 KIO::SimpleJob *job;
00133
00134 QMap<QString, int> mMsgsPendingDownload;
00135
00136 QPtrList<KMPopHeaders> headersOnServer;
00137 QPtrListIterator<KMPopHeaders> headerIt;
00138 bool headers;
00139
00140 QMap<QString, bool> mHeaderDeleteUids;
00141 QMap<QString, bool> mHeaderDownUids;
00142 QMap<QString, bool> mHeaderLaterUids;
00143
00144 QStringList idsOfMsgs;
00145 QValueList<int> lensOfMsgs;
00146 QMap<QString, QString> mUidForIdMap;
00147 QDict<int> mUidsOfSeenMsgsDict;
00148 QDict<int> mUidsOfNextSeenMsgsDict;
00149 QValueVector<int> mTimeOfSeenMsgsVector;
00150 QMap<QString, int> mTimeOfNextSeenMsgsMap;
00151 QDict<int> mSizeOfNextSeenMsgsDict;
00152 QStringList idsOfMsgsToDelete;
00153 QStringList idsOfForcedDeletes;
00154 int indexOfCurrentMsg;
00155
00156 QValueList<KMMessage*> msgsAwaitingProcessing;
00157 QStringList msgIdsAwaitingProcessing;
00158 QStringList msgUidsAwaitingProcessing;
00159
00160 QByteArray curMsgData;
00161 QDataStream *curMsgStrm;
00162
00163 int curMsgLen;
00164 Stage stage;
00165 QTimer processMsgsTimer;
00166 int processingDelay;
00167 int numMsgs, numBytes, numBytesToRead, numBytesRead, numMsgBytesRead;
00168 bool interactive;
00169 bool mProcessing;
00170 bool mUidlFinished;
00171 int dataCounter;
00172
00173 protected slots:
00184 void slotProcessPendingMsgs();
00185
00190 void slotGetNextMsg();
00191
00196 void slotMsgRetrieved(KIO::Job*, const QString &);
00197
00201 void slotData( KIO::Job*, const QByteArray &);
00202
00208 void slotResult( KIO::Job* );
00209
00213 void slotCancel();
00214
00218 void slotAbortRequested();
00219
00224 void slotJobFinished();
00225
00229 void slotSlaveError(KIO::Slave *, int, const QString &);
00230
00235 void slotGetNextHdr();
00236 };
00237
00238 }
00239
00240
00241
00242 #endif
|