kmacctcachedimap.h
00001 /* 00002 * kmacctcachedimap.h 00003 * 00004 * Copyright (c) 2002-2004 Bo Thorsen <bo@sonofthor.dk> 00005 * Copyright (c) 2002-2003 Steffen Hansen <steffen@klaralvdalens-datakonsult.se> 00006 * 00007 * This program is free software; you can redistribute it and/or modify 00008 * it under the terms of the GNU General Public License as published by 00009 * the Free Software Foundation; version 2 of the License 00010 * 00011 * This program is distributed in the hope that it will be useful, 00012 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00013 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00014 * GNU General Public License for more details. 00015 * 00016 * You should have received a copy of the GNU General Public License 00017 * along with this program; if not, write to the Free Software 00018 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 00019 * 00020 * In addition, as a special exception, the copyright holders give 00021 * permission to link the code of this program with any edition of 00022 * the TQt library by Trolltech AS, Norway (or with modified versions 00023 * of TQt that use the same license as TQt), and distribute linked 00024 * combinations including the two. You must obey the GNU General 00025 * Public License in all respects for all of the code used other than 00026 * TQt. If you modify this file, you may extend this exception to 00027 * your version of the file, but you are not obligated to do so. If 00028 * you do not wish to do so, delete this exception statement from 00029 * your version. 00030 */ 00031 00032 #ifndef KMAcctCachedImap_h 00033 #define KMAcctCachedImap_h 00034 00035 #include "imapaccountbase.h" 00036 00037 #include <tqguardedptr.h> 00038 00039 class KMFolderCachedImap; 00040 class KMFolderTreeItem; 00041 class KMFolder; 00042 namespace KMail { 00043 class FolderJob; 00044 class ImapJob; 00045 class CachedImapJob; 00046 } 00047 using KMail::ImapJob; 00048 using KMail::CachedImapJob; 00049 00050 namespace TDEIO { 00051 class Job; 00052 } 00053 00054 class KMAcctCachedImap: public KMail::ImapAccountBase 00055 { 00056 Q_OBJECT 00057 00058 friend class ::KMail::ImapJob; 00059 friend class ::KMail::CachedImapJob; 00060 00061 public: 00062 virtual ~KMAcctCachedImap(); 00063 virtual void init(); 00064 00066 virtual void pseudoAssign( const KMAccount * a ); 00067 00071 virtual void setAutoExpunge(bool); 00072 00076 virtual TQString type() const; 00077 virtual void processNewMail( bool interactive ); 00078 00082 virtual void killAllJobs( bool disconnectSlave=false ); 00083 00087 virtual void cancelMailCheck(); 00088 00092 virtual void setImapFolder(KMFolderCachedImap *); 00093 KMFolderCachedImap* imapFolder() const { return mFolder; } 00094 00095 virtual void readConfig( /*const*/ TDEConfig/*Base*/ & config ); 00096 virtual void writeConfig( TDEConfig/*Base*/ & config ) /*const*/; 00097 00101 virtual void invalidateIMAPFolders(); 00102 virtual void invalidateIMAPFolders( KMFolderCachedImap* ); 00103 00107 void addDeletedFolder( KMFolder* folder ); 00108 00113 void addDeletedFolder( const TQString& imapPath ); 00114 00118 bool isDeletedFolder( const TQString& subFolderPath ) const; 00119 00123 bool isPreviouslyDeletedFolder( const TQString& subFolderPath ) const; 00124 00128 TQStringList deletedFolderPaths( const TQString& subFolderPath ) const; 00129 00133 void removeDeletedFolder( const TQString& subFolderPath ); 00134 00138 void addRenamedFolder( const TQString& subFolderPath, 00139 const TQString& oldLabel, const TQString& newName ); 00140 00145 void removeRenamedFolder( const TQString& subFolderPath ); 00146 00147 struct RenamedFolder { 00148 RenamedFolder() {} // for TQMap 00149 RenamedFolder( const TQString& oldLabel, const TQString& newName ) 00150 : mOldLabel( oldLabel ), mNewName( newName ) {} 00151 TQString mOldLabel; 00152 TQString mNewName; 00153 }; 00154 00158 TQString renamedFolder( const TQString& imapPath ) const; 00162 const TQMap<TQString, RenamedFolder>& renamedFolders() const { return mRenamedFolders; } 00163 00167 void addUnreadMsgCount( const KMFolderCachedImap *folder, int countUnread ); 00168 00172 void addLastUnreadMsgCount( const KMFolderCachedImap *folder, 00173 int countLastUnread ); 00174 00178 virtual FolderStorage* rootFolder() const; 00179 00181 bool annotationCheckPassed(){ return mAnnotationCheckPassed;}; 00182 void setAnnotationCheckPassed( bool a ){ mAnnotationCheckPassed = a; }; 00183 00185 enum GroupwareType 00186 { 00187 GroupwareNone, 00188 GroupwareKolab, 00189 GroupwareScalix 00190 }; 00191 00192 void setGroupwareType( GroupwareType type ){ mGroupwareType = type; } 00193 GroupwareType groupwareType() const { return mGroupwareType; } 00194 00195 void setSentCustomLoginCommand( bool value ){ mSentCustomLoginCommand = value; } 00196 bool sentCustomLoginCommand() const { return mSentCustomLoginCommand; } 00197 00198 protected: 00199 friend class ::AccountManager; 00200 KMAcctCachedImap(AccountManager* owner, const TQString& accountName, uint id); 00201 00202 protected slots: 00204 void postProcessNewMail(KMFolderCachedImap*, bool); 00205 00206 void slotProgressItemCanceled( KPIM::ProgressItem* ); 00207 00208 virtual void slotCheckQueuedFolders(); 00209 00210 private: 00211 TQValueList<KMFolderCachedImap*> killAllJobsInternal( bool disconnectSlave ); 00212 void processNewMail( KMFolderCachedImap* folder, bool recurse ); 00213 00214 private: 00215 TQPtrList<CachedImapJob> mJobList; 00216 KMFolderCachedImap *mFolder; 00217 TQStringList mDeletedFolders; // folders deleted in this session 00218 TQStringList mPreviouslyDeletedFolders; // folders deleted in a previous session 00219 TQMap<TQString, RenamedFolder> mRenamedFolders; 00220 bool mAnnotationCheckPassed; 00221 00222 GroupwareType mGroupwareType; 00223 bool mSentCustomLoginCommand; 00224 }; 00225 00226 #endif /*KMAcctCachedImap_h*/