kmail

kmacctimap.h

Go to the documentation of this file.
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 <qdict.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   friend class KMail::ImapJob;
00044 
00045 public:
00046   virtual ~KMAcctImap();
00047 
00049   virtual void pseudoAssign( const KMAccount * a );
00050 
00054   virtual QString type(void) const;
00055   virtual void processNewMail(bool);
00056   ConnectionState makeConnection();
00057 
00061   virtual void ignoreJobsForMessage( KMMessage * msg );
00062   virtual void ignoreJobsForFolder( KMFolder * folder );
00063   virtual void removeSlaveJobsForFolder( KMFolder * folder );
00064 
00068   virtual void killAllJobs( bool disconnectSlave=false );
00069 
00073   virtual void setImapFolder(KMFolderImap *);
00074 
00078   virtual void listDirectory();
00079 
00085   virtual void readConfig(KConfig& config);
00086 
00090   virtual FolderStorage* const rootFolder() const;
00091 
00095   void execFilters(Q_UINT32 serNum);
00096     
00097 public slots:
00101   void slotFiltered(Q_UINT32 serNum);
00102   void slotUpdateFolderList();
00103 
00104 protected:
00105   friend class ::AccountManager;
00106   KMAcctImap(AccountManager* owner, const QString& accountName, uint id);
00111   virtual bool handleError( int error, const QString &errorMsg, KIO::Job* job, const QString& context, bool abortSync = false );
00112   virtual void cancelMailCheck();
00113 
00114   QPtrList<KMail::ImapJob> mJobList;
00115   QGuardedPtr<KMFolderImap> mFolder;
00116 
00117 protected slots:
00119   void postProcessNewMail(KMFolderImap*, bool);
00124   void postProcessNewMail( KMFolder * f );
00125 
00130   void slotMailCheckCanceled();
00131 
00135   void slotResetConnectionError();
00136     
00140   void slotFolderSelected( KMFolderImap*, bool );
00141   int slotFilterMsg( KMMessage* );
00142 
00143 private:
00144   int mCountRemainChecks;
00146   QTimer mErrorTimer;
00147   QValueList<Q_UINT32> mFilterSerNums;
00148   QDict<int> mFilterSerNumsToSave;
00149   KMail::ActionScheduler *mScheduler;
00150 };
00151 
00152 #endif /*KMAcctImap_h*/