1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
|
/*
* kmtransport.h
*
* Copyright (c) 2001-2002 Michael Haeckel <haeckel@kde.org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2
* as published by the Free Software Foundation
*
* 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 _KMTRANSPORT_H_
#define _KMTRANSPORT_H_
#include <kdialogbase.h>
class QCheckBox;
class QLabel;
class QLineEdit;
class QRadioButton;
class KMServerTest;
class QButtonGroup;
class KMTransportInfo : public QObject
{
public:
KMTransportInfo();
virtual ~KMTransportInfo();
void readConfig(int id);
void writeConfig(int id);
static int findTransport(const QString &name);
static QStringList availableTransports();
uint id() const { return mId; }
/** Get/set password for this account */
QString passwd() const;
void setPasswd( const QString& passwd );
/** Get/set password storage flag */
bool storePasswd() const { return mStorePasswd; }
void setStorePasswd( bool store );
/** Read password from wallet */
void readPassword() const;
QString type, name, host, port, user, precommand, encryption, authType;
QString localHostname;
bool auth, specifyHostname;
private:
mutable QString mPasswd;
bool mPasswdDirty, mStorePasswd, mStorePasswdInConfig;
uint mId;
};
class KMTransportSelDlg : public KDialogBase
{
Q_OBJECT
public:
KMTransportSelDlg( QWidget *parent=0, const char *name=0, bool modal=TRUE );
int selected() const;
private slots:
void buttonClicked( int id );
private:
int mSelectedButton;
};
class KMTransportDialog : public KDialogBase
{
Q_OBJECT
public:
KMTransportDialog( const QString & caption, KMTransportInfo *transportInfo,
QWidget *parent=0, const char *name=0, bool modal=TRUE );
virtual ~KMTransportDialog();
private slots:
virtual void slotOk();
void slotSendmailChooser();
void slotRequiresAuthClicked();
void slotSmtpEncryptionChanged(int);
void slotCheckSmtpCapabilities();
void slotSmtpCapabilities( const QStringList &, const QStringList &,
const QString &, const QString &,
const QString & );
void slotSendmailEditPath(const QString &);
private:
struct SendmailWidgets
{
QLabel *titleLabel;
QLineEdit *nameEdit;
QLineEdit *locationEdit;
QPushButton *chooseButton;
};
struct SmtpWidgets
{
QLabel *titleLabel;
QLineEdit *nameEdit;
QLineEdit *hostEdit;
QLineEdit *portEdit;
QCheckBox *authCheck;
QLabel *loginLabel;
QLineEdit *loginEdit;
QLabel *passwordLabel;
QLineEdit *passwordEdit;
QLineEdit *precommand;
QButtonGroup *encryptionGroup;
QRadioButton *encryptionNone;
QRadioButton *encryptionSSL;
QRadioButton *encryptionTLS;
QButtonGroup *authGroup;
QRadioButton *authPlain;
QRadioButton *authLogin;
QRadioButton *authCramMd5;
QRadioButton *authDigestMd5;
QRadioButton *authNTLM;
QRadioButton *authGSSAPI;
QPushButton *checkCapabilities;
QCheckBox *storePasswordCheck;
QCheckBox *specifyHostnameCheck;
QLineEdit *localHostnameEdit;
QLabel *localHostnameLabel;
};
void makeSendmailPage();
void makeSmtpPage();
void setupSettings();
void saveSettings();
void checkHighest( QButtonGroup * );
void enableAuthMethods( unsigned int which );
bool sanityCheckSmtpInput();
static unsigned int authMethodsFromString( const QString & s );
static unsigned int authMethodsFromStringList( const QStringList & sl );
KMServerTest *mServerTest;
SmtpWidgets mSmtp;
SendmailWidgets mSendmail;
KMTransportInfo *mTransportInfo;
enum EncryptionMethods {
NoEncryption = 0,
SSL = 1,
TLS = 2
};
enum AuthMethods {
NoAuth = 0,
LOGIN = 1,
PLAIN = 2,
CRAM_MD5 = 4,
DIGEST_MD5 = 8,
NTLM = 16,
GSSAPI = 32,
AllAuth = 0xffffffff
};
unsigned int mAuthNone, mAuthSSL, mAuthTLS;
};
#endif
|