kmail

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