kmail

networkaccount.h
1 /* -*- c++ -*-
2  * networkaccount.h
3  *
4  * Copyright (c) 2000-2002 Michael Haeckel <haeckel@kde.org>
5  * Copyright (c) 2002 Marc Mutz <mutz@kde.org>
6  *
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>
9  *
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
13  *
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.
18  *
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.
22  */
23 
24 
25 #ifndef __KMAIL_NETWORKACCOUNT_H__
26 #define __KMAIL_NETWORKACCOUNT_H__
27 
28 #include <tqguardedptr.h>
29 
30 #include "kmaccount.h"
31 
32 #include "sieveconfig.h"
33 
34 #include <tqstring.h>
35 
36 class AccountManager;
37 class KConfig/*Base*/;
38 class KURL;
39 namespace KIO {
40  class Slave;
41  class MetaData;
42 }
43 
44 namespace KMail {
45 
46  class NetworkAccount : public KMAccount {
47  Q_OBJECT
48  TQ_OBJECT
49  protected:
50  NetworkAccount( AccountManager * parent, const TQString & name, uint id );
51  public:
52  virtual ~NetworkAccount();
53 
55  virtual void init();
56 
58  virtual void pseudoAssign( const KMAccount * a );
59 
61  TQString login() const { return mLogin; }
62  virtual void setLogin( const TQString & login );
63 
65  TQString passwd() const;
66  virtual void setPasswd( const TQString & passwd, bool storeInConfig=false );
67 
71  virtual void clearPasswd();
72 
74  TQString auth() const { return mAuth; }
75  virtual void setAuth( const TQString & auth );
76 
78  bool storePasswd() const { return mStorePasswd; }
79  virtual void setStorePasswd( bool store );
80 
82  TQString host() const { return mHost; }
83  virtual void setHost( const TQString & host );
84 
86  unsigned short int port() const { return mPort; }
87  virtual void setPort( unsigned short int port );
88 
90  bool useSSL() const { return mUseSSL; }
91  virtual void setUseSSL( bool use );
92 
94  bool useTLS() const { return mUseTLS; }
95  virtual void setUseTLS( bool use );
96 
98  KMail::SieveConfig sieveConfig() const { return mSieveConfig; }
99  virtual void setSieveConfig( const KMail::SieveConfig & config );
100 
102  virtual KIO::MetaData slaveConfig() const;
103 
104  virtual void readConfig( /*const*/ KConfig/*Base*/ & config );
105  virtual void writeConfig( KConfig/*Base*/ & config ) /*const*/;
106 
108  virtual KURL getUrl() const;
109 
111  KIO::Slave * slave() const { return mSlave; }
112 
114  virtual void killAllJobs( bool disconnectSlave = false ) = 0;
115 
117  void readPassword();
118 
119  virtual bool mailCheckCanProceed() const;
120 
121  virtual void setCheckingMail( bool checking );
122 
124  static void resetConnectionList( NetworkAccount* acct );
125  protected:
126  virtual TQString protocol() const = 0;
127  virtual unsigned short int defaultPort() const = 0;
128 
129  protected:
130  KMail::SieveConfig mSieveConfig;
131  TQGuardedPtr<KIO::Slave> mSlave;
132  TQString mLogin, mPasswd, mAuth, mHost;
133  unsigned short int mPort;
134  bool mStorePasswd : 1;
135  bool mUseSSL : 1;
136  bool mUseTLS : 1;
137  bool mAskAgain : 1;
138  bool mPasswdDirty, mStorePasswdInConfig;
139  };
140 
141 } // namespace KMail
142 
143 #endif // __KMAIL_NETWORKACCOUNT_H__