kmail

kmacctcachedimap.h
1 /*
2  * kmacctcachedimap.h
3  *
4  * Copyright (c) 2002-2004 Bo Thorsen <bo@sonofthor.dk>
5  * Copyright (c) 2002-2003 Steffen Hansen <steffen@klaralvdalens-datakonsult.se>
6  *
7  * This program is free software; you can redistribute it and/or modify
8  * it under the terms of the GNU General Public License as published by
9  * the Free Software Foundation; version 2 of the License
10  *
11  * This program is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with this program; if not, write to the Free Software
18  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
19  *
20  * In addition, as a special exception, the copyright holders give
21  * permission to link the code of this program with any edition of
22  * the TQt library by Trolltech AS, Norway (or with modified versions
23  * of TQt that use the same license as TQt), and distribute linked
24  * combinations including the two. You must obey the GNU General
25  * Public License in all respects for all of the code used other than
26  * TQt. If you modify this file, you may extend this exception to
27  * your version of the file, but you are not obligated to do so. If
28  * you do not wish to do so, delete this exception statement from
29  * your version.
30  */
31 
32 #ifndef KMAcctCachedImap_h
33 #define KMAcctCachedImap_h
34 
35 #include "imapaccountbase.h"
36 
37 #include <tqguardedptr.h>
38 
39 class KMFolderCachedImap;
40 class KMFolderTreeItem;
41 class KMFolder;
42 namespace KMail {
43  class FolderJob;
44  class ImapJob;
45  class CachedImapJob;
46 }
47 using KMail::ImapJob;
48 using KMail::CachedImapJob;
49 
50 namespace TDEIO {
51  class Job;
52 }
53 
54 class KMAcctCachedImap: public KMail::ImapAccountBase
55 {
56  TQ_OBJECT
57 
58  friend class ::KMail::ImapJob;
59  friend class ::KMail::CachedImapJob;
60 
61 public:
62  virtual ~KMAcctCachedImap();
63  virtual void init();
64 
66  virtual void pseudoAssign( const KMAccount * a );
67 
71  virtual void setAutoExpunge(bool);
72 
76  virtual TQString type() const;
77  virtual void processNewMail( bool interactive );
78 
82  virtual void killAllJobs( bool disconnectSlave=false );
83 
87  virtual void cancelMailCheck();
88 
92  virtual void setImapFolder(KMFolderCachedImap *);
93  KMFolderCachedImap* imapFolder() const { return mFolder; }
94 
95  virtual void readConfig( /*const*/ TDEConfig/*Base*/ & config );
96  virtual void writeConfig( TDEConfig/*Base*/ & config ) /*const*/;
97 
101  virtual void invalidateIMAPFolders();
102  virtual void invalidateIMAPFolders( KMFolderCachedImap* );
103 
107  void addDeletedFolder( KMFolder* folder );
108 
113  void addDeletedFolder( const TQString& imapPath );
114 
118  bool isDeletedFolder( const TQString& subFolderPath ) const;
119 
123  bool isPreviouslyDeletedFolder( const TQString& subFolderPath ) const;
124 
128  TQStringList deletedFolderPaths( const TQString& subFolderPath ) const;
129 
133  void removeDeletedFolder( const TQString& subFolderPath );
134 
138  void addRenamedFolder( const TQString& subFolderPath,
139  const TQString& oldLabel, const TQString& newName );
140 
145  void removeRenamedFolder( const TQString& subFolderPath );
146 
147  struct RenamedFolder {
148  RenamedFolder() {} // for TQMap
149  RenamedFolder( const TQString& oldLabel, const TQString& newName )
150  : mOldLabel( oldLabel ), mNewName( newName ) {}
151  TQString mOldLabel;
152  TQString mNewName;
153  };
154 
158  TQString renamedFolder( const TQString& imapPath ) const;
162  const TQMap<TQString, RenamedFolder>& renamedFolders() const { return mRenamedFolders; }
163 
167  void addUnreadMsgCount( const KMFolderCachedImap *folder, int countUnread );
168 
172  void addLastUnreadMsgCount( const KMFolderCachedImap *folder,
173  int countLastUnread );
174 
178  virtual FolderStorage* rootFolder() const;
179 
181  bool annotationCheckPassed(){ return mAnnotationCheckPassed;};
182  void setAnnotationCheckPassed( bool a ){ mAnnotationCheckPassed = a; };
183 
185  enum GroupwareType
186  {
187  GroupwareNone,
188  GroupwareKolab,
189  GroupwareScalix
190  };
191 
192  void setGroupwareType( GroupwareType type ){ mGroupwareType = type; }
193  GroupwareType groupwareType() const { return mGroupwareType; }
194 
195  void setSentCustomLoginCommand( bool value ){ mSentCustomLoginCommand = value; }
196  bool sentCustomLoginCommand() const { return mSentCustomLoginCommand; }
197 
198 protected:
199  friend class ::AccountManager;
200  KMAcctCachedImap(AccountManager* owner, const TQString& accountName, uint id);
201 
202 protected slots:
204  void postProcessNewMail(KMFolderCachedImap*, bool);
205 
206  void slotProgressItemCanceled( KPIM::ProgressItem* );
207 
208  virtual void slotCheckQueuedFolders();
209 
210 private:
211  TQValueList<KMFolderCachedImap*> killAllJobsInternal( bool disconnectSlave );
212  void processNewMail( KMFolderCachedImap* folder, bool recurse );
213 
214 private:
215  TQPtrList<CachedImapJob> mJobList;
216  KMFolderCachedImap *mFolder;
217  TQStringList mDeletedFolders; // folders deleted in this session
218  TQStringList mPreviouslyDeletedFolders; // folders deleted in a previous session
219  TQMap<TQString, RenamedFolder> mRenamedFolders;
220  bool mAnnotationCheckPassed;
221 
222  GroupwareType mGroupwareType;
223  bool mSentCustomLoginCommand;
224 };
225 
226 #endif /*KMAcctCachedImap_h*/
The FolderStorage class is the bass class for the storage related aspects of a collection of mail (a ...
Definition: folderstorage.h:80
Mail folder.
Definition: kmfolder.h:69
The account manager is responsible for creating accounts of various types via the factory method crea...
folderdiaquotatab.h
Definition: aboutdata.cpp:40