From 460c52653ab0dcca6f19a4f492ed2c5e4e963ab0 Mon Sep 17 00:00:00 2001 From: toma Date: Wed, 25 Nov 2009 17:56:58 +0000 Subject: Copy the KDE 3.5 branch to branches/trinity for new KDE 3.5 features. BUG:215923 git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdepim@1054174 283d02a7-25f6-0310-bc7c-ecb5cbfe19da --- kmail/networkaccount.h | 142 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 142 insertions(+) create mode 100644 kmail/networkaccount.h (limited to 'kmail/networkaccount.h') diff --git a/kmail/networkaccount.h b/kmail/networkaccount.h new file mode 100644 index 000000000..616de6711 --- /dev/null +++ b/kmail/networkaccount.h @@ -0,0 +1,142 @@ +/* -*- c++ -*- + * networkaccount.h + * + * Copyright (c) 2000-2002 Michael Haeckel + * Copyright (c) 2002 Marc Mutz + * + * This file is based on work on pop3 and imap account implementations + * by Don Sanders and Michael Haeckel + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; version 2 of the License + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + + +#ifndef __KMAIL_NETWORKACCOUNT_H__ +#define __KMAIL_NETWORKACCOUNT_H__ + +#include + +#include "kmaccount.h" + +#include "sieveconfig.h" + +#include + +class AccountManager; +class KConfig/*Base*/; +class KURL; +namespace KIO { + class Slave; + class MetaData; +} + +namespace KMail { + + class NetworkAccount : public KMAccount { + Q_OBJECT + protected: + NetworkAccount( AccountManager * parent, const QString & name, uint id ); + public: + virtual ~NetworkAccount(); + + /** Set the config options to a decent state */ + virtual void init(); + + /** A weak assignment operator */ + virtual void pseudoAssign( const KMAccount * a ); + + /** User login name */ + QString login() const { return mLogin; } + virtual void setLogin( const QString & login ); + + /** User password */ + QString passwd() const; + virtual void setPasswd( const QString & passwd, bool storeInConfig=false ); + + /** + * Set the password to "" (empty string) + */ + virtual void clearPasswd(); + + /** authentication method */ + QString auth() const { return mAuth; } + virtual void setAuth( const QString & auth ); + + /** @return whether to store the password in the config file */ + bool storePasswd() const { return mStorePasswd; } + virtual void setStorePasswd( bool store ); + + /** Server hostname */ + QString host() const { return mHost; } + virtual void setHost( const QString & host ); + + /** Server port number */ + unsigned short int port() const { return mPort; } + virtual void setPort( unsigned short int port ); + + /** @return whether to use SSL */ + bool useSSL() const { return mUseSSL; } + virtual void setUseSSL( bool use ); + + /** @return whether to use TLS */ + bool useTLS() const { return mUseTLS; } + virtual void setUseTLS( bool use ); + + /** @return the SieveConfig for this account */ + KMail::SieveConfig sieveConfig() const { return mSieveConfig; } + virtual void setSieveConfig( const KMail::SieveConfig & config ); + + /** Configure the slave by adding to the meta data map */ + virtual KIO::MetaData slaveConfig() const; + + virtual void readConfig( /*const*/ KConfig/*Base*/ & config ); + virtual void writeConfig( KConfig/*Base*/ & config ) /*const*/; + + /** @return an URL for this account */ + virtual KURL getUrl() const; + + /** @return the KIO slave for this account */ + KIO::Slave * slave() const { return mSlave; } + + /** Kill all jobs that are currently in progress */ + virtual void killAllJobs( bool disconnectSlave = false ) = 0; + + /** Read password from wallet, used for on-demand wallet opening */ + void readPassword(); + + virtual bool mailCheckCanProceed() const; + + virtual void setCheckingMail( bool checking ); + + /** Reset connection list for the account */ + static void resetConnectionList( NetworkAccount* acct ); + protected: + virtual QString protocol() const = 0; + virtual unsigned short int defaultPort() const = 0; + + protected: + KMail::SieveConfig mSieveConfig; + QGuardedPtr mSlave; + QString mLogin, mPasswd, mAuth, mHost; + unsigned short int mPort; + bool mStorePasswd : 1; + bool mUseSSL : 1; + bool mUseTLS : 1; + bool mAskAgain : 1; + bool mPasswdDirty, mStorePasswdInConfig; + }; + +} // namespace KMail + +#endif // __KMAIL_NETWORKACCOUNT_H__ -- cgit v1.2.1