• Skip to content
  • Skip to link menu
KDE 4.2 API Reference
  • KDE API Reference
  • kdepim
  • Sitemap
  • Contact Us
 

kmail

kmaccount.h

Go to the documentation of this file.
00001 /* -*- mode: C++ -*-
00002  * kmail: KDE mail client
00003  * Copyright (c) 1996-1998 Stefan Taferner <taferner@kde.org>
00004  *
00005  * This program is free software; you can redistribute it and/or modify
00006  * it under the terms of the GNU General Public License as published by
00007  * the Free Software Foundation; either version 2 of the License, or
00008  * (at your option) any later version.
00009  *
00010  * This program is distributed in the hope that it will be useful,
00011  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00012  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00013  * GNU General Public License for more details.
00014  *
00015  * You should have received a copy of the GNU General Public License
00016  * along with this program; if not, write to the Free Software
00017  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
00018  *
00019  */
00020 #ifndef kmaccount_h
00021 #define kmaccount_h
00022 
00023 #include "kmmessage.h"
00024 #include "kmacctfolder.h"
00025 
00026 #include <kprocess.h>
00027 #include <kaccount.h>
00028 
00029 #include <QList>
00030 #include <QMap>
00031 #include <QPointer>
00032 #include <QString>
00033 
00034 class QTimer;
00035 
00036 class KMFolder;
00037 class KMAcctFolder;
00038 class KMFolderCachedImap;
00039 class AccountsPageReceivingTab;
00040 
00041 namespace  KMail {
00042   class FolderJob;
00043   class AccountManager;
00044 }
00045 using KMail::AccountManager;
00046 using KMail::FolderJob;
00047 namespace KPIM { class ProgressItem; }
00048 using KPIM::ProgressItem;
00049 using KPIM::KAccount;
00050 
00051 class KMAccount;
00052 typedef QList< ::KMAccount* > AccountList;
00053 
00054 class KMPrecommand : public QObject
00055 {
00056   Q_OBJECT
00057 
00058 public:
00059   explicit KMPrecommand(const QString &precommand, QObject *parent = 0);
00060   virtual ~KMPrecommand();
00061   bool start();
00062 
00063 signals:
00064   void finished(bool);
00065 
00066 private slots:
00067   void precommandExited(int errorCode, QProcess::ExitStatus status);
00068 
00069 private:
00070   KProcess mPrecommandProcess;
00071   QString mPrecommand;
00072 };
00073 
00074 
00075 class KMAccount: public QObject, public KAccount
00076 {
00077   Q_OBJECT
00078   friend class KMail::AccountManager;
00079   friend class ::KMail::FolderJob;
00080   friend class ::AccountsPageReceivingTab; // part of the config dialog
00081   friend class ::KMFolderCachedImap; /* HACK for processNewMSg() */
00082 
00083 public:
00084   virtual ~KMAccount();
00085 
00086   enum CheckStatus { CheckOK, CheckIgnored, CheckCanceled, CheckAborted,
00087                      CheckError };
00088 
00090   static const int DefaultCheckInterval = 5;
00091 
00095   virtual void setName(const QString&);
00096 
00100   virtual QString name() const { return KAccount::name(); }
00101 
00105   virtual void clearPasswd();
00106 
00110   virtual void init();
00111 
00115   virtual void pseudoAssign(const KMAccount * a );
00116 
00120   KMFolder* folder(void) const { return ((KMFolder*)((KMAcctFolder*)mFolder)); }
00121   virtual void setFolder(KMFolder*, bool addAccount = false);
00122 
00126   QString trash() const { return mTrash; }
00127   virtual void setTrash(const QString& aTrash) { mTrash = aTrash; }
00128 
00134   virtual void processNewMail(bool interactive) = 0;
00135 
00140   virtual void readConfig(KConfigGroup& config);
00141   void readTimerConfig();
00142 
00146   virtual void writeConfig(KConfigGroup& config);
00147 
00152   virtual void setCheckInterval(int aInterval);
00153   int checkInterval() const;
00154 
00158   inline int defaultCheckInterval(void) const { return DefaultCheckInterval; }
00159 
00163   void deleteFolderJobs();
00164 
00168   virtual void ignoreJobsForMessage( KMMessage* );
00173   virtual void setCheckExclude(bool aExclude);
00174   bool checkExclude(void) const { return mExclude; }
00175 
00179   const QString& precommand(void) const { return mPrecommand; }
00180   virtual void setPrecommand(const QString &cmd) { mPrecommand = cmd; }
00181 
00188   bool runPrecommand(const QString &precommand);
00189 
00190   static QString importPassword(const QString &);
00191 
00193   bool hasInbox() const { return mHasInbox; }
00194   virtual void setHasInbox( bool has ) { mHasInbox = has; }
00195 
00199   virtual void invalidateIMAPFolders();
00200 
00207   virtual bool mailCheckCanProceed() const { return true; }
00208 
00212   bool checkingMail() { return mCheckingMail; }
00213   virtual void setCheckingMail( bool checking ) { mCheckingMail = checking; }
00214 
00220   void checkDone( bool newMail, CheckStatus status );
00221 
00227   virtual void cancelMailCheck() {}
00228 
00233   ProgressItem *mailCheckProgressItem() const {
00234     return mMailCheckProgressItem;
00235   }
00236 
00242   void setIdentityId( uint identityId ) { mIdentityId = identityId; }
00243   uint identityId() const;
00244 
00249   void setUseDefaultIdentity( bool useDefaultIdentity ) {
00250     mUseDefaultIdentity = useDefaultIdentity;  }
00251   bool useDefaultIdentity() const { return mUseDefaultIdentity; }
00252 
00253 signals:
00259   void finishedCheck( bool newMail, CheckStatus status );
00260 
00265   void newMailsProcessed( const QMap<QString, int> & newInFolder );
00266 
00267 protected slots:
00268   virtual void mailCheck();
00269   virtual void sendReceipts();
00270   virtual void precommandExited(bool);
00271   void slotIdentitiesChanged();
00272 
00273 protected:
00274   KMAccount( AccountManager* owner, const QString& accountName, uint id);
00275 
00281   virtual bool processNewMsg(KMMessage* msg);
00282 
00289   virtual void sendReceipt(KMMessage* msg);
00290 
00294   virtual void installTimer();
00295   virtual void deinstallTimer();
00296 
00303   void addToNewInFolder( const QString &folderId, int num );
00304 
00305 protected:
00306   QString       mPrecommand;
00307   QString       mTrash;
00308   AccountManager*    mOwner;
00309   QPointer<KMAcctFolder> mFolder;
00310   QTimer *mTimer;
00311   int mInterval; // this is a switch and a scalar at the same time. If it is 0,
00312   // interval mail checking is turned off and the interval spinbox proposes a
00313   // default value. If it is non-null, it is the count of minutes between two
00314   // automated mail checks. This means that as soon as you disable interval
00315   // mail checking, the value in the spin box returns to a default value.
00316   bool mExclude;
00317   bool mCheckingMail : 1;
00318   bool mPrecommandSuccess;
00319   bool mUseDefaultIdentity;
00320   QList<KMMessage*> mReceipts;
00321   QList<FolderJob*>  mJobList;
00322   bool mHasInbox : 1;
00323   ProgressItem *mMailCheckProgressItem;
00324   uint mIdentityId;
00325 private:
00326   // for detailed (per folder) new mail notification
00327   QMap<QString, int> mNewInFolder;
00328   QEventLoop *mPrecommandEventLoop;
00329 };
00330 
00331 #endif /*kmaccount_h*/

kmail

Skip menu "kmail"
  • Main Page
  • Namespace List
  • Class Hierarchy
  • Alphabetical List
  • Class List
  • File List
  • Namespace Members
  • Class Members
  • Related Pages

kdepim

Skip menu "kdepim"
  • akonadi
  •   clients
  •   kabc
  •   kcal
  •   kcm
  • akregator
  • console
  •   kabcclient
  •   konsolekalendar
  • kaddressbook
  • kalarm
  •   lib
  • kdgantt
  • kdgantt1
  • kjots
  • kleopatra
  • kmail
  • kmobiletools
  • knode
  • knotes
  • kontact
  • kontactinterfaces
  • korganizer
  •   korgac
  • kpilot
  • ktimetracker
  • libkdepim
  • libkholidays
  • libkleo
  • libkpgp
  • maildir
Generated for kdepim by doxygen 1.5.4
This website is maintained by Adriaan de Groot and Allen Winter.
KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal