kmail

networkaccount.h

Go to the documentation of this file.
00001 /* -*- c++ -*-
00002  * networkaccount.h
00003  *
00004  * Copyright (c) 2000-2002 Michael Haeckel <haeckel@kde.org>
00005  * Copyright (c) 2002 Marc Mutz <mutz@kde.org>
00006  *
00007  * This file is based on work on pop3 and imap account implementations
00008  * by Don Sanders <sanders@kde.org> and Michael Haeckel <haeckel@kde.org>
00009  *
00010  *  This program is free software; you can redistribute it and/or modify
00011  *  it under the terms of the GNU General Public License as published by
00012  *  the Free Software Foundation; version 2 of the License
00013  *
00014  *  This program is distributed in the hope that it will be useful,
00015  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
00016  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00017  *  GNU General Public License for more details.
00018  *
00019  *  You should have received a copy of the GNU General Public License
00020  *  along with this program; if not, write to the Free Software
00021  *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
00022  */
00023 
00024 
00025 #ifndef __KMAIL_NETWORKACCOUNT_H__
00026 #define __KMAIL_NETWORKACCOUNT_H__
00027 
00028 #include <qguardedptr.h>
00029 
00030 #include "kmaccount.h"
00031 
00032 #include "sieveconfig.h"
00033 
00034 #include <qstring.h>
00035 
00036 class AccountManager;
00037 class KConfig/*Base*/;
00038 class KURL;
00039 namespace KIO {
00040   class Slave;
00041   class MetaData;
00042 }
00043 
00044 namespace KMail {
00045 
00046   class NetworkAccount : public KMAccount {
00047     Q_OBJECT
00048   protected:
00049     NetworkAccount( AccountManager * parent, const QString & name, uint id );
00050   public:
00051     virtual ~NetworkAccount();
00052 
00054     virtual void init();
00055 
00057     virtual void pseudoAssign( const KMAccount * a );
00058 
00060     QString login() const { return mLogin; }
00061     virtual void setLogin( const QString & login );
00062 
00064     QString passwd() const;
00065     virtual void setPasswd( const QString & passwd, bool storeInConfig=false );
00066 
00070     virtual void clearPasswd();
00071 
00073     QString auth() const { return mAuth; }
00074     virtual void setAuth( const QString & auth );
00075 
00077     bool storePasswd() const { return mStorePasswd; }
00078     virtual void setStorePasswd( bool store );
00079 
00081     QString host() const { return mHost; }
00082     virtual void setHost( const QString & host );
00083 
00085     unsigned short int port() const { return mPort; }
00086     virtual void setPort( unsigned short int port );
00087 
00089     bool useSSL() const { return mUseSSL; }
00090     virtual void setUseSSL( bool use );
00091 
00093     bool useTLS() const { return mUseTLS; }
00094     virtual void setUseTLS( bool use );
00095 
00097     KMail::SieveConfig sieveConfig() const { return mSieveConfig; }
00098     virtual void setSieveConfig( const KMail::SieveConfig & config );
00099 
00101     virtual KIO::MetaData slaveConfig() const;
00102 
00103     virtual void readConfig( /*const*/ KConfig/*Base*/ & config );
00104     virtual void writeConfig( KConfig/*Base*/ & config ) /*const*/;
00105 
00107     virtual KURL getUrl() const;
00108 
00110     KIO::Slave * slave() const { return mSlave; }
00111 
00113     virtual void killAllJobs( bool disconnectSlave = false ) = 0;
00114 
00116     void readPassword();
00117 
00118     virtual bool mailCheckCanProceed() const;
00119 
00120     virtual void setCheckingMail( bool checking );
00121 
00123     static void resetConnectionList( NetworkAccount* acct );
00124   protected:
00125     virtual QString protocol() const = 0;
00126     virtual unsigned short int defaultPort() const = 0;
00127 
00128   protected:
00129     KMail::SieveConfig mSieveConfig;
00130     QGuardedPtr<KIO::Slave> mSlave;
00131     QString mLogin, mPasswd, mAuth, mHost;
00132     unsigned short int mPort;
00133     bool mStorePasswd : 1;
00134     bool mUseSSL : 1;
00135     bool mUseTLS : 1;
00136     bool mAskAgain : 1;
00137     bool mPasswdDirty, mStorePasswdInConfig;
00138   };
00139 
00140 } // namespace KMail
00141 
00142 #endif // __KMAIL_NETWORKACCOUNT_H__