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 "sieveconfig.h"
00031 
00032 #include <qstring.h>
00033 
00034 class AccountManager;
00035 class KConfig/*Base*/;
00036 class KURL;
00037 namespace KIO {
00038   class Slave;
00039   class MetaData;
00040 }
00041 
00042 namespace KMail {
00043 
00044   class NetworkAccount : public KMAccount {
00045     Q_OBJECT
00046   protected:
00047     NetworkAccount( AccountManager * parent, const QString & name, uint id );
00048   public:
00049     virtual ~NetworkAccount();
00050 
00052     virtual void init();
00053 
00055     virtual void pseudoAssign( const KMAccount * a );
00056 
00058     QString login() const { return mLogin; }
00059     virtual void setLogin( const QString & login );
00060 
00062     QString passwd() const;
00063     virtual void setPasswd( const QString & passwd, bool storeInConfig=false );
00064 
00068     virtual void clearPasswd();
00069 
00071     QString auth() const { return mAuth; }
00072     virtual void setAuth( const QString & auth );
00073 
00075     bool storePasswd() const { return mStorePasswd; }
00076     virtual void setStorePasswd( bool store );
00077 
00079     QString host() const { return mHost; }
00080     virtual void setHost( const QString & host );
00081 
00083     unsigned short int port() const { return mPort; }
00084     virtual void setPort( unsigned short int port );
00085 
00087     bool useSSL() const { return mUseSSL; }
00088     virtual void setUseSSL( bool use );
00089 
00091     bool useTLS() const { return mUseTLS; }
00092     virtual void setUseTLS( bool use );
00093 
00095     KMail::SieveConfig sieveConfig() const { return mSieveConfig; }
00096     virtual void setSieveConfig( const KMail::SieveConfig & config );
00097 
00099     virtual KIO::MetaData slaveConfig() const;
00100 
00101     virtual void readConfig( /*const*/ KConfig/*Base*/ & config );
00102     virtual void writeConfig( KConfig/*Base*/ & config ) /*const*/;
00103 
00105     virtual KURL getUrl() const;
00106 
00108     KIO::Slave * slave() const { return mSlave; }
00109 
00111     virtual void killAllJobs( bool disconnectSlave = false ) = 0;
00112 
00114     void readPassword();
00115 
00116     virtual bool mailCheckCanProceed() const;
00117 
00118     virtual void setCheckingMail( bool checking );
00119 
00121     static void resetConnectionList( NetworkAccount* acct );
00122   protected:
00123     virtual QString protocol() const = 0;
00124     virtual unsigned short int defaultPort() const = 0;
00125 
00126   protected:
00127     KMail::SieveConfig mSieveConfig;
00128     KIO::Slave * mSlave;
00129     QString mLogin, mPasswd, mAuth, mHost;
00130     unsigned short int mPort;
00131     bool mStorePasswd : 1;
00132     bool mUseSSL : 1;
00133     bool mUseTLS : 1;
00134     bool mAskAgain : 1;
00135     bool mPasswdDirty, mStorePasswdInConfig;
00136   };
00137 
00138 } // namespace KMail
00139 
00140 #endif // __KMAIL_NETWORKACCOUNT_H__
KDE Home | KDE Accessibility Home | Description of Access Keys