kmail Library API Documentation

kmfoldercachedimap.h

00001 00032 #ifndef kmfoldercachedimap_h 00033 #define kmfoldercachedimap_h 00034 00035 #include <kdialogbase.h> 00036 #include <kstandarddirs.h> 00037 #include <qvaluelist.h> 00038 #include <qvaluevector.h> 00039 #include <qptrlist.h> 00040 #include <qdialog.h> 00041 00042 #include "kmfoldermaildir.h" 00043 #include "kmfolderimap.h" 00044 #include "kmacctimap.h" 00045 #include "kmfoldertype.h" 00046 #include "folderjob.h" 00047 #include "cachedimapjob.h" 00048 00049 using KMail::FolderJob; 00050 class KMAcctCachedImap; 00051 00052 namespace KMail { 00053 class AttachmentStrategy; 00054 struct ACLListEntry; 00055 } 00056 using KMail::AttachmentStrategy; 00057 00058 class DImapTroubleShootDialog : public KDialogBase 00059 { 00060 Q_OBJECT 00061 public: 00062 DImapTroubleShootDialog( QWidget* parent=0, const char* name=0 ); 00063 00064 static int run(); 00065 00066 private slots: 00067 void slotRebuildIndex(); 00068 void slotRebuildCache(); 00069 00070 private: 00071 int rc; 00072 }; 00073 00074 class KMFolderCachedImap : public KMFolderMaildir 00075 { 00076 Q_OBJECT 00077 00078 public: 00079 static QString cacheLocation() { 00080 return locateLocal("data", "kmail/dimap" ); 00081 } 00082 00086 KMFolderCachedImap(KMFolder* folder, const char* name=0); 00087 virtual ~KMFolderCachedImap(); 00088 00090 void initializeFrom( KMFolderCachedImap* parent ); 00091 00092 virtual void readConfig(); 00093 00095 virtual KMFolderType folderType() const { return KMFolderTypeCachedImap; } 00096 00098 virtual void remove(); 00099 00101 virtual void serverSync( bool recurse ); 00102 00104 void resetSyncState(); 00105 00106 void checkUidValidity(); 00107 00108 enum imapState { imapNoInformation=0, imapInProgress=1, imapFinished=2 }; 00109 00110 virtual imapState getContentState() { return mContentState; } 00111 virtual void setContentState(imapState state) { mContentState = state; } 00112 00113 virtual imapState getSubfolderState() { return mSubfolderState; } 00114 virtual void setSubfolderState(imapState state); 00115 00117 void setImapPath(const QString &path); 00118 QString imapPath() const { return mImapPath; } 00119 00121 void setLastUid( ulong uid ); 00122 ulong lastUid(); 00123 00125 KMMsgBase* findByUID( ulong uid ); 00126 00128 void setUidValidity(const QString &validity) { mUidValidity = validity; } 00129 QString uidValidity() const { return mUidValidity; } 00130 00132 void setAccount(KMAcctCachedImap *acct); 00133 KMAcctCachedImap* account() const; 00134 00136 QString uidCacheLocation() const; 00137 00139 int readUidCache(); 00140 00142 int writeUidCache(); 00143 00145 int progress() const { return mProgress; } 00146 00147 /* Reimplemented from KMFolder. Moving is not supported, so aParent must be 0 */ 00148 virtual int rename(const QString& aName, KMFolderDir *aParent=0); 00149 00150 /* Reimplemented from KMFolderMaildir */ 00151 virtual KMMessage* take(int idx); 00152 /* Reimplemented from KMFolderMaildir */ 00153 virtual int addMsg(KMMessage* msg, int* index_return = 0); 00154 /* internal version that doesn't remove the X-UID header */ 00155 virtual int addMsgInternal(KMMessage* msg, bool, int* index_return = 0); 00156 virtual int addMsgKeepUID(KMMessage* msg, int* index_return = 0) { 00157 return addMsgInternal(msg, false, index_return); 00158 } 00159 00160 /* Reimplemented from KMFolderMaildir */ 00161 virtual void removeMsg(int i, bool imapQuiet = FALSE); 00162 virtual void removeMsg(QPtrList<KMMessage> msgList, bool imapQuiet = FALSE) 00163 { FolderStorage::removeMsg(msgList, imapQuiet); } 00164 00166 bool isReadOnly() const { return KMFolderMaildir::isReadOnly() || mReadOnly; } 00167 00171 void sendFolderComplete(bool success) 00172 { emit folderComplete(this, success); } 00173 00177 void setSilentUpload( bool silent ) { mSilentUpload = silent; } 00178 bool silentUpload() { return mSilentUpload; } 00179 00180 virtual int createIndexFromContents() 00181 { return KMFolderMaildir::createIndexFromContents(); } 00182 00183 // Mark for resync 00184 void resync() { mResync = true; } 00185 00186 //virtual void holdSyncs( bool hold ) { mHoldSyncs = hold; } 00187 00193 virtual bool listDirectory(bool secondStep = false); 00194 00196 KMFolder* trashFolder() const; 00197 00202 int userRights() const { return mUserRights; } 00203 00205 void setUserRights( unsigned int userRights ); 00206 00208 typedef QValueVector<KMail::ACLListEntry> ACLList; 00209 const ACLList& aclList() const { return mACLList; } 00210 00212 void setACLList( const ACLList& arr ); 00213 00215 void setContentsType( KMail::FolderContentsType type ); 00216 00217 // Reimplemented so the mStatusChangedLocally bool can be set 00218 virtual void setStatus(QValueList<int>& ids, KMMsgStatus status, bool toggle); 00219 00220 protected slots: 00225 void slotListResult(const QStringList&, const QStringList&, 00226 const QStringList&, const QStringList&, const ImapAccountBase::jobData& ); 00227 00228 void slotGetMessagesData(KIO::Job * job, const QByteArray & data); 00229 void getMessagesResult(KMail::FolderJob *, bool lastSet); 00230 void slotGetLastMessagesResult(KMail::FolderJob *); 00231 void slotProgress(unsigned long done, unsigned long total); 00232 void slotPutProgress( unsigned long, unsigned long ); 00233 00234 //virtual void slotCheckValidityResult(KIO::Job * job); 00235 void slotSubFolderComplete(KMFolderCachedImap*, bool); 00236 00237 // Connected to the imap account 00238 void slotConnectionResult( int errorCode, const QString& errorMsg ); 00239 00240 void slotCheckUidValidityResult( KMail::FolderJob* job ); 00241 00242 void slotReceivedUserRights( KMFolder* ); 00243 void slotReceivedACL( KMFolder*, KIO::Job*, const KMail::ACLList& ); 00244 00245 void slotMultiSetACLResult(KIO::Job *); 00246 void slotACLChanged( const QString&, int ); 00247 void slotDeleteMessagesResult(KMail::FolderJob *); 00248 void slotImapStatusChanged(KMFolder* folder, const QString&, bool); 00249 00250 protected: 00251 /* returns true if there were messages to delete 00252 on the server */ 00253 bool deleteMessages(); 00254 void listMessages(); 00255 void uploadNewMessages(); 00256 void uploadFlags(); 00257 void createNewFolders(); 00258 00259 void listDirectory2(); 00260 00261 00264 virtual QValueList<unsigned long> findNewMessages(); 00267 virtual QValueList<KMFolderCachedImap*> findNewFolders(); 00268 00270 virtual bool canRemoveFolder() const; 00271 00273 virtual FolderJob* doCreateJob( KMMessage *msg, FolderJob::JobType jt, KMFolder *folder, 00274 QString partSpecifier, const AttachmentStrategy *as ) const; 00275 virtual FolderJob* doCreateJob( QPtrList<KMMessage>& msgList, const QString& sets, 00276 FolderJob::JobType jt, KMFolder *folder ) const; 00277 00278 virtual void timerEvent( QTimerEvent* ); 00279 00280 /* update progress status */ 00281 void newState( int progress, const QString& syncStatus ); 00282 00283 public slots: 00287 void slotSimpleData(KIO::Job * job, const QByteArray & data); 00288 00292 void slotTroubleshoot(); 00293 00294 private slots: 00295 void serverSyncInternal(); 00296 void slotIncreaseProgress(); 00297 void slotUpdateLastUid(); 00298 00299 signals: 00300 void folderComplete(KMFolderCachedImap *folder, bool success); 00301 void listComplete( KMFolderCachedImap* ); 00302 00306 void syncState( int state, int number ); 00307 00308 private: 00309 QString state2String( int state ) const; 00310 00312 enum { 00313 SYNC_STATE_INITIAL, 00314 SYNC_STATE_PUT_MESSAGES, 00315 SYNC_STATE_UPLOAD_FLAGS, 00316 SYNC_STATE_CREATE_SUBFOLDERS, 00317 SYNC_STATE_LIST_SUBFOLDERS, 00318 SYNC_STATE_LIST_SUBFOLDERS2, 00319 SYNC_STATE_DELETE_SUBFOLDERS, 00320 SYNC_STATE_LIST_MESSAGES, 00321 SYNC_STATE_DELETE_MESSAGES, 00322 SYNC_STATE_EXPUNGE_MESSAGES, 00323 SYNC_STATE_GET_MESSAGES, 00324 SYNC_STATE_HANDLE_INBOX, 00325 SYNC_STATE_GET_USERRIGHTS, 00326 SYNC_STATE_GET_ACLS, 00327 SYNC_STATE_SET_ACLS, 00328 SYNC_STATE_FIND_SUBFOLDERS, 00329 SYNC_STATE_SYNC_SUBFOLDERS, 00330 SYNC_STATE_CHECK_UIDVALIDITY, 00331 SYNC_STATE_RENAME_FOLDER 00332 } mSyncState; 00333 00334 int mProgress; 00335 int mStatusFlagsJobs; 00336 00337 QString mUidValidity; 00338 QString mImapPath; 00339 imapState mContentState, mSubfolderState; 00340 QStringList mSubfolderNames, mSubfolderPaths, 00341 mSubfolderMimeTypes, mSubfolderAttributes; 00342 00343 bool mHasInbox; 00344 bool mIsSelected; 00345 bool mCheckFlags; 00346 bool mReadOnly; 00347 mutable QGuardedPtr<KMAcctCachedImap> mAccount; 00348 00349 QIntDict<int> uidsOnServer; 00350 QValueList<ulong> uidsForDeletionOnServer; 00351 QValueList<KMail::CachedImapJob::MsgForDownload> mMsgsForDownload; 00352 QValueList<ulong> mUidsForDownload; 00353 QStringList foldersForDeletionOnServer; 00354 00355 QValueList<KMFolderCachedImap*> mSubfoldersForSync; 00356 KMFolderCachedImap* mCurrentSubfolder; 00357 00361 QMap<ulong,int> uidMap; 00362 bool uidMapDirty; 00363 void reloadUidMap(); 00364 int uidWriteTimer; 00365 00375 ulong mLastUid; 00380 ulong mTentativeHighestUid; 00381 00382 int mUserRights; 00383 ACLList mACLList; 00384 00385 bool mSilentUpload; 00386 bool mFolderRemoved; 00387 bool mResync; 00388 //bool mHoldSyncs; 00389 bool mRecurse; 00390 bool mCreateInbox; 00391 bool mContentsTypeChanged; 00396 bool mStatusChangedLocally; 00397 }; 00398 00399 #endif /*kmfoldercachedimap_h*/
KDE Logo
This file is part of the documentation for kmail Library Version 3.3.0.
Documentation copyright © 1996-2004 the KDE developers.
Generated on Fri Aug 27 12:52:32 2004 by doxygen 1.3.8 written by Dimitri van Heesch, © 1997-2003