kmail
networkaccount.h
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 "kmaccount.h" 00029 00030 #include <qguardedptr.h> 00031 #include "sieveconfig.h" 00032 00033 #include <qstring.h> 00034 00035 class AccountManager; 00036 class KConfig/*Base*/; 00037 class KURL; 00038 namespace KIO { 00039 class Slave; 00040 class MetaData; 00041 } 00042 00043 namespace KMail { 00044 00045 class NetworkAccount : public KMAccount { 00046 Q_OBJECT 00047 protected: 00048 NetworkAccount( AccountManager * parent, const QString & name, uint id ); 00049 public: 00050 virtual ~NetworkAccount(); 00051 00053 virtual void init(); 00054 00056 virtual void pseudoAssign( const KMAccount * a ); 00057 00059 QString login() const { return mLogin; } 00060 virtual void setLogin( const QString & login ); 00061 00063 QString passwd() const; 00064 virtual void setPasswd( const QString & passwd, bool storeInConfig=false ); 00065 00069 virtual void clearPasswd(); 00070 00072 QString auth() const { return mAuth; } 00073 virtual void setAuth( const QString & auth ); 00074 00076 bool storePasswd() const { return mStorePasswd; } 00077 virtual void setStorePasswd( bool store ); 00078 00080 QString host() const { return mHost; } 00081 virtual void setHost( const QString & host ); 00082 00084 unsigned short int port() const { return mPort; } 00085 virtual void setPort( unsigned short int port ); 00086 00088 bool useSSL() const { return mUseSSL; } 00089 virtual void setUseSSL( bool use ); 00090 00092 bool useTLS() const { return mUseTLS; } 00093 virtual void setUseTLS( bool use ); 00094 00096 KMail::SieveConfig sieveConfig() const { return mSieveConfig; } 00097 virtual void setSieveConfig( const KMail::SieveConfig & config ); 00098 00100 virtual KIO::MetaData slaveConfig() const; 00101 00102 virtual void readConfig( /*const*/ KConfig/*Base*/ & config ); 00103 virtual void writeConfig( KConfig/*Base*/ & config ) /*const*/; 00104 00106 virtual KURL getUrl() const; 00107 00109 KIO::Slave * slave() const { return mSlave; } 00110 00112 virtual void killAllJobs( bool disconnectSlave = false ) = 0; 00113 00115 void readPassword(); 00116 00117 virtual bool mailCheckCanProceed() const; 00118 00119 virtual void setCheckingMail( bool checking ); 00120 00122 static void resetConnectionList( NetworkAccount* acct ); 00123 protected: 00124 virtual QString protocol() const = 0; 00125 virtual unsigned short int defaultPort() const = 0; 00126 00127 protected: 00128 KMail::SieveConfig mSieveConfig; 00129 QGuardedPtr<KIO::Slave> mSlave; 00130 QString mLogin, mPasswd, mAuth, mHost; 00131 unsigned short int mPort; 00132 bool mStorePasswd : 1; 00133 bool mUseSSL : 1; 00134 bool mUseTLS : 1; 00135 bool mAskAgain : 1; 00136 bool mPasswdDirty, mStorePasswdInConfig; 00137 }; 00138 00139 } // namespace KMail 00140 00141 #endif // __KMAIL_NETWORKACCOUNT_H__