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