~ubuntu-branches/ubuntu/oneiric/kdepim/oneiric-updates

« back to all changes in this revision

Viewing changes to kmail/networkaccount.h

  • Committer: Package Import Robot
  • Author(s): Philip Muškovac
  • Date: 2011-06-28 19:33:24 UTC
  • mfrom: (0.2.13) (0.1.13 sid)
  • Revision ID: package-import@ubuntu.com-20110628193324-8yvjs8sdv9rdoo6c
Tags: 4:4.7.0-0ubuntu1
* New upstream release
  - update install files
  - add missing kdepim-doc package to control file
  - Fix Vcs lines
  - kontact breaks/replaces korganizer << 4:4.6.80
  - tighten the dependency of kdepim-dev on libkdepim4 to fix lintian error

Show diffs side-by-side

added added

removed removed

Lines of Context:
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 "kmaccount.h"
29
 
 
30
 
#include "sieveconfig.h"
31
 
 
32
 
#include <kio/slave.h>
33
 
 
34
 
#include <QString>
35
 
 
36
 
class AccountManager;
37
 
class KConfig/*Base*/;
38
 
class KUrl;
39
 
namespace KIO {
40
 
  class MetaData;
41
 
}
42
 
 
43
 
namespace KMail {
44
 
 
45
 
  class NetworkAccount : public KMAccount {
46
 
    Q_OBJECT
47
 
  protected:
48
 
    NetworkAccount( AccountManager * parent, const QString & name, uint id );
49
 
  public:
50
 
    virtual ~NetworkAccount();
51
 
 
52
 
    /** Set the config options to a decent state */
53
 
    virtual void init();
54
 
 
55
 
    /** A weak assignment operator */
56
 
    virtual void pseudoAssign( const KMAccount * a );
57
 
 
58
 
    /** User login name */
59
 
    QString login() const { return mLogin; }
60
 
    virtual void setLogin( const QString & login );
61
 
 
62
 
    /** User password */
63
 
    QString passwd() const;
64
 
    virtual void setPasswd( const QString & passwd, bool storeInConfig=false );
65
 
 
66
 
    /**
67
 
     * Set the password to "" (empty string)
68
 
     */
69
 
    virtual void clearPasswd();
70
 
 
71
 
    /** authentication method */
72
 
    QString auth() const { return mAuth; }
73
 
    virtual void setAuth( const QString & auth );
74
 
 
75
 
    /** @return whether to store the password in the config file */
76
 
    bool storePasswd() const { return mStorePasswd; }
77
 
    virtual void setStorePasswd( bool store );
78
 
 
79
 
    /** Server hostname */
80
 
    QString host() const { return mHost; }
81
 
    virtual void setHost( const QString & host );
82
 
 
83
 
    /** Server port number */
84
 
    unsigned short int port() const { return mPort; }
85
 
    virtual void setPort( unsigned short int port );
86
 
 
87
 
    /** @return whether to use SSL */
88
 
    bool useSSL() const { return mUseSSL; }
89
 
    virtual void setUseSSL( bool use );
90
 
 
91
 
    /** @return whether to use TLS */
92
 
    bool useTLS() const { return mUseTLS; }
93
 
    virtual void setUseTLS( bool use );
94
 
 
95
 
    /** @return the SieveConfig for this account */
96
 
    KMail::SieveConfig sieveConfig() const { return mSieveConfig; }
97
 
    virtual void setSieveConfig( const KMail::SieveConfig & config );
98
 
 
99
 
    /** Configure the slave by adding to the meta data map */
100
 
    virtual KIO::MetaData slaveConfig() const;
101
 
 
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 );
107
 
 
108
 
    /** @return an URL for this account */
109
 
    virtual KUrl getUrl() const;
110
 
 
111
 
    /** @return the KIO slave for this account */
112
 
    KIO::Slave * slave() const { return mSlave; }
113
 
 
114
 
    /** Kill all jobs that are currently in progress */
115
 
    virtual void killAllJobs( bool disconnectSlave = false ) = 0;
116
 
 
117
 
    /** Read password from wallet, used for on-demand wallet opening */
118
 
    void readPassword();
119
 
 
120
 
    virtual bool mailCheckCanProceed() const;
121
 
 
122
 
    virtual void setCheckingMail( bool checking );
123
 
 
124
 
    /** Reset connection list for the account */
125
 
    static void resetConnectionList( NetworkAccount* acct );
126
 
  protected:
127
 
    virtual QString protocol() const = 0;
128
 
    virtual unsigned short int defaultPort() const = 0;
129
 
 
130
 
  protected:
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;
136
 
    bool mUseSSL : 1;
137
 
    bool mUseTLS : 1;
138
 
    bool mAskAgain : 1;
139
 
    bool mPasswdDirty : 1, mStorePasswdInConfig : 1;
140
 
  };
141
 
 
142
 
} // namespace KMail
143
 
 
144
 
#endif // __KMAIL_NETWORKACCOUNT_H__