4
* Copyright (c) 2000-2002 Michael Haeckel <haeckel@kde.org>
5
* Copyright (c) 2002 Marc Mutz <mutz@kde.org>
7
* This file is based on work on pop3 and imap account implementations
8
* by Don Sanders <sanders@kde.org> and Michael Haeckel <haeckel@kde.org>
10
* This program is free software; you can redistribute it and/or modify
11
* it under the terms of the GNU General Public License as published by
12
* the Free Software Foundation; version 2 of the License
14
* This program is distributed in the hope that it will be useful,
15
* but WITHOUT ANY WARRANTY; without even the implied warranty of
16
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17
* GNU General Public License for more details.
19
* You should have received a copy of the GNU General Public License
20
* along with this program; if not, write to the Free Software
21
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
25
#ifndef __KMAIL_NETWORKACCOUNT_H__
26
#define __KMAIL_NETWORKACCOUNT_H__
28
#include "kmaccount.h"
30
#include "sieveconfig.h"
32
#include <kio/slave.h>
37
class KConfig/*Base*/;
45
class NetworkAccount : public KMAccount {
48
NetworkAccount( AccountManager * parent, const QString & name, uint id );
50
virtual ~NetworkAccount();
52
/** Set the config options to a decent state */
55
/** A weak assignment operator */
56
virtual void pseudoAssign( const KMAccount * a );
58
/** User login name */
59
QString login() const { return mLogin; }
60
virtual void setLogin( const QString & login );
63
QString passwd() const;
64
virtual void setPasswd( const QString & passwd, bool storeInConfig=false );
67
* Set the password to "" (empty string)
69
virtual void clearPasswd();
71
/** authentication method */
72
QString auth() const { return mAuth; }
73
virtual void setAuth( const QString & auth );
75
/** @return whether to store the password in the config file */
76
bool storePasswd() const { return mStorePasswd; }
77
virtual void setStorePasswd( bool store );
79
/** Server hostname */
80
QString host() const { return mHost; }
81
virtual void setHost( const QString & host );
83
/** Server port number */
84
unsigned short int port() const { return mPort; }
85
virtual void setPort( unsigned short int port );
87
/** @return whether to use SSL */
88
bool useSSL() const { return mUseSSL; }
89
virtual void setUseSSL( bool use );
91
/** @return whether to use TLS */
92
bool useTLS() const { return mUseTLS; }
93
virtual void setUseTLS( bool use );
95
/** @return the SieveConfig for this account */
96
KMail::SieveConfig sieveConfig() const { return mSieveConfig; }
97
virtual void setSieveConfig( const KMail::SieveConfig & config );
99
/** Configure the slave by adding to the meta data map */
100
virtual KIO::MetaData slaveConfig() const;
102
// This class is the reason that readConfig can't take a const KConfigGroup
103
// (it deletes entries from it when migrating to kwallet),
104
// and writeConfig can't be const (it sets member vars).
105
virtual void readConfig( KConfigGroup & config );
106
virtual void writeConfig( KConfigGroup & config );
108
/** @return an URL for this account */
109
virtual KUrl getUrl() const;
111
/** @return the KIO slave for this account */
112
KIO::Slave * slave() const { return mSlave; }
114
/** Kill all jobs that are currently in progress */
115
virtual void killAllJobs( bool disconnectSlave = false ) = 0;
117
/** Read password from wallet, used for on-demand wallet opening */
120
virtual bool mailCheckCanProceed() const;
122
virtual void setCheckingMail( bool checking );
124
/** Reset connection list for the account */
125
static void resetConnectionList( NetworkAccount* acct );
127
virtual QString protocol() const = 0;
128
virtual unsigned short int defaultPort() const = 0;
131
KMail::SieveConfig mSieveConfig;
132
QPointer<KIO::Slave> mSlave;
133
QString mLogin, mPasswd, mAuth, mHost, mOldPassKey;
134
unsigned short int mPort;
135
bool mStorePasswd : 1;
139
bool mPasswdDirty : 1, mStorePasswdInConfig : 1;
144
#endif // __KMAIL_NETWORKACCOUNT_H__