kmail

kmacctimap.h

00001 /* -*- mode: C++ -*-
00002  * kmacctimap.h
00003  *
00004  * Copyright (c) 2000-2002 Michael Haeckel <haeckel@kde.org>
00005  *
00006  * This file is based on popaccount.h by Don Sanders
00007  *
00008  *  This program is free software; you can redistribute it and/or modify
00009  *  it under the terms of the GNU General Public License as published by
00010  *  the Free Software Foundation; version 2 of the License
00011  *
00012  *  This program is distributed in the hope that it will be useful,
00013  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
00014  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00015  *  GNU General Public License for more details.
00016  *
00017  *  You should have received a copy of the GNU General Public License
00018  *  along with this program; if not, write to the Free Software
00019  *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
00020  */
00021 
00022 #ifndef KMAcctImap_h
00023 #define KMAcctImap_h
00024 
00025 #include "imapaccountbase.h"
00026 #include <tqdict.h>
00027 
00028 class KMFolderImap;
00029 class KMFolderTreeItem;
00030 namespace KMail {
00031   class ImapJob;
00032   class ActionScheduler;
00033 }
00034 namespace KIO {
00035   class Job;
00036 }
00037 class FolderStorage;
00038 
00039 //-----------------------------------------------------------------------------
00040 class KMAcctImap: public KMail::ImapAccountBase
00041 {
00042   Q_OBJECT
00043   TQ_OBJECT
00044   friend class KMail::ImapJob;
00045 
00046 public:
00047   virtual ~KMAcctImap();
00048 
00050   virtual void pseudoAssign( const KMAccount * a );
00051 
00055   virtual TQString type(void) const;
00056   virtual void processNewMail(bool);
00057   ConnectionState makeConnection();
00058 
00062   virtual void ignoreJobsForMessage( KMMessage * msg );
00063   virtual void ignoreJobsForFolder( KMFolder * folder );
00064   virtual void removeSlaveJobsForFolder( KMFolder * folder );
00065 
00069   virtual void killAllJobs( bool disconnectSlave=false );
00070 
00074   virtual void setImapFolder(KMFolderImap *);
00075 
00079   virtual void listDirectory();
00080 
00086   virtual void readConfig(KConfig& config);
00087 
00091   virtual FolderStorage* rootFolder() const;
00092 
00096   void execFilters(TQ_UINT32 serNum);
00097     
00098 public slots:
00102   void slotFiltered(TQ_UINT32 serNum);
00103   void slotUpdateFolderList();
00104 
00105 protected:
00106   friend class ::AccountManager;
00107   KMAcctImap(AccountManager* owner, const TQString& accountName, uint id);
00112   virtual bool handleError( int error, const TQString &errorMsg, KIO::Job* job, const TQString& context, bool abortSync = false );
00113   virtual void cancelMailCheck();
00114 
00115   TQPtrList<KMail::ImapJob> mJobList;
00116   TQGuardedPtr<KMFolderImap> mFolder;
00117 
00118 protected slots:
00120   void postProcessNewMail(KMFolderImap*, bool);
00125   void postProcessNewMail( KMFolder * f );
00126 
00131   void slotMailCheckCanceled();
00132 
00136   void slotResetConnectionError();
00137     
00141   void slotFolderSelected( KMFolderImap*, bool );
00142   int slotFilterMsg( KMMessage* );
00143 
00144 private:
00145   int mCountRemainChecks;
00147   TQTimer mErrorTimer;
00148   TQValueList<TQ_UINT32> mFilterSerNums;
00149   TQDict<int> mFilterSerNumsToSave;
00150   KMail::ActionScheduler *mScheduler;
00151 };
00152 
00153 #endif /*KMAcctImap_h*/