kmail

accountdialog.h
1/*
2 * accountdialog.h
3 *
4 * kmail: KDE mail client
5 * This file: Copyright (C) 2000 Espen Sand, espen@kde.org
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
20 *
21 */
22
23#ifndef _ACCOUNT_DIALOG_H_
24#define _ACCOUNT_DIALOG_H_
25
26#include <kdialogbase.h>
27#include <tdelistview.h>
28#include <klineedit.h>
29#include <tqguardedptr.h>
30#include "imapaccountbase.h"
31
32class TQRegExpValidator;
33class TQCheckBox;
34class TQComboBox;
35class TQPushButton;
36class TQLabel;
37class TQLineEdit;
38class TQRadioButton;
39class TQToolButton;
40class KIntNumInput;
41class KMAccount;
42class KMFolder;
43class KMServerTest;
44class TQButtonGroup;
45
46namespace KPIM {
47class IdentityCombo;
48}
49
50namespace KMail {
51
52class SieveConfigEditor;
53class FolderRequester;
54
55class AccountDialog : public KDialogBase
56{
57 TQ_OBJECT
58
59
60 public:
61 AccountDialog( const TQString & caption, KMAccount *account,
62 TQWidget *parent=0, const char *name=0, bool modal=true );
63 virtual ~AccountDialog();
64 private:
65 struct LocalWidgets
66 {
67 TQLabel *titleLabel;
68 TQLineEdit *nameEdit;
69 TQComboBox *locationEdit;
70 TQRadioButton *lockMutt;
71 TQRadioButton *lockMuttPriv;
72 TQRadioButton *lockProcmail;
73 TQComboBox *procmailLockFileName;
74 TQRadioButton *lockFcntl;
75 TQRadioButton *lockNone;
76 TQLineEdit *precommand;
77#if 0
78 TQCheckBox *resourceCheck;
79 TQPushButton *resourceClearButton;
80 TQPushButton *resourceClearPastButton;
81#endif
82 TQCheckBox *includeInCheck;
83 TQCheckBox *intervalCheck;
84 TQLabel *intervalLabel;
85 KIntNumInput *intervalSpin;
86 TQComboBox *folderCombo;
87 //TQComboBox *identityCombo;
88 KPIM::IdentityCombo *identityCombo;
89 TQLabel *identityLabel;
90 };
91
92 struct MaildirWidgets
93 {
94 TQLabel *titleLabel;
95 TQLineEdit *nameEdit;
96 TQComboBox *locationEdit;
97 TQLineEdit *precommand;
98#if 0
99 TQCheckBox *resourceCheck;
100 TQPushButton *resourceClearButton;
101 TQPushButton *resourceClearPastButton;
102#endif
103 TQCheckBox *includeInCheck;
104 TQCheckBox *intervalCheck;
105 TQLabel *intervalLabel;
106 KIntNumInput *intervalSpin;
107 TQComboBox *folderCombo;
108 //TQComboBox *identityCombo;
109 KPIM::IdentityCombo *identityCombo;
110 TQLabel *identityLabel;
111 };
112
113 struct PopWidgets
114 {
115 TQLabel *titleLabel;
116 TQLineEdit *nameEdit;
117 TQLineEdit *loginEdit;
118 TQLineEdit *passwordEdit;
119 TQLineEdit *hostEdit;
120 TQLineEdit *portEdit;
121 TQLineEdit *precommand;
122 TQButtonGroup *encryptionGroup;
123 TQRadioButton *encryptionNone;
124 TQRadioButton *encryptionSSL;
125 TQRadioButton *encryptionTLS;
126 TQButtonGroup *authGroup;
127 TQRadioButton *authUser;
128 TQRadioButton *authPlain;
129 TQRadioButton *authLogin;
130 TQRadioButton *authCRAM_MD5;
131 TQRadioButton *authDigestMd5;
132 TQRadioButton *authNTLM;
133 TQRadioButton *authGSSAPI;
134 TQRadioButton *authAPOP;
135
136 TQPushButton *checkCapabilities;
137 TQCheckBox *usePipeliningCheck;
138 TQCheckBox *storePasswordCheck;
139 TQCheckBox *leaveOnServerCheck;
140 TQCheckBox *leaveOnServerDaysCheck;
141 KIntNumInput *leaveOnServerDaysSpin;
142 TQCheckBox *leaveOnServerCountCheck;
143 KIntNumInput *leaveOnServerCountSpin;
144 TQCheckBox *leaveOnServerSizeCheck;
145 KIntNumInput *leaveOnServerSizeSpin;
146#if 0
147 TQCheckBox *resourceCheck;
148 TQPushButton *resourceClearButton;
149 TQPushButton *resourceClearPastButton;
150#endif
151 TQCheckBox *includeInCheck;
152 TQCheckBox *intervalCheck;
153 TQCheckBox *filterOnServerCheck;
154 TQLabel *intervalLabel;
155 KIntNumInput *intervalSpin;
156 KIntNumInput *filterOnServerSizeSpin;
157 TQComboBox *folderCombo;
158 //TQComboBox *identityCombo;
159 KPIM::IdentityCombo *identityCombo;
160 TQLabel *identityLabel;
161 };
162
163 struct ImapWidgets
164 {
165 TQLabel *titleLabel;
166 TQLineEdit *nameEdit;
167 TQLineEdit *loginEdit;
168 TQLineEdit *passwordEdit;
169 TQLineEdit *hostEdit;
170 TQLineEdit *portEdit;
171#if 0
172 TQCheckBox *resourceCheck;
173 TQPushButton *resourceClearButton;
174 TQPushButton *resourceClearPastButton;
175#endif
176 TQCheckBox *autoExpungeCheck; // only used by normal (online) IMAP
177 TQCheckBox *hiddenFoldersCheck;
178 TQCheckBox *subscribedFoldersCheck;
179 TQCheckBox *locallySubscribedFoldersCheck;
180 TQCheckBox *loadOnDemandCheck;
181 TQCheckBox *storePasswordCheck;
182 TQCheckBox *progressDialogCheck; // only used by Disconnected IMAP
183 TQCheckBox *includeInCheck;
184 TQCheckBox *intervalCheck;
185 TQCheckBox *listOnlyOpenCheck;
186 TQLabel *intervalLabel;
187 KIntNumInput *intervalSpin;
188 TQButtonGroup *encryptionGroup;
189 TQRadioButton *encryptionNone;
190 TQRadioButton *encryptionSSL;
191 TQRadioButton *encryptionTLS;
192 TQButtonGroup *authGroup;
193 TQRadioButton *authUser;
194 TQRadioButton *authPlain;
195 TQRadioButton *authLogin;
196 TQRadioButton *authCramMd5;
197 TQRadioButton *authDigestMd5;
198 TQRadioButton *authGSSAPI;
199 TQRadioButton *authNTLM;
200 TQRadioButton *authAnonymous;
201 TQPushButton *checkCapabilities;
202 FolderRequester *trashCombo;
203 KLineEdit *personalNS;
204 KLineEdit *otherUsersNS;
205 KLineEdit *sharedNS;
206 TQToolButton *editPNS;
207 TQToolButton *editONS;
208 TQToolButton *editSNS;
209 ImapAccountBase::nsDelimMap nsMap;
210 KPIM::IdentityCombo *identityCombo;
211 TQLabel *identityLabel;
212 };
213
214 private slots:
215 virtual void slotOk();
216 void slotLocationChooser();
217 void slotMaildirChooser();
218 void slotEnablePopInterval( bool state );
219 void slotEnableImapInterval( bool state );
220 void slotEnableLocalInterval( bool state );
221 void slotEnableMaildirInterval( bool state );
222 void slotFontChanged();
223 void slotLeaveOnServerClicked();
224 void slotEnableLeaveOnServerDays( bool state );
225 void slotEnableLeaveOnServerCount( bool state );
226 void slotEnableLeaveOnServerSize( bool state );
227 void slotFilterOnServerClicked();
228 void slotPipeliningClicked();
229 void slotPopEncryptionChanged(int);
230 void slotImapEncryptionChanged(int);
231 void slotCheckPopCapabilities();
232 void slotCheckImapCapabilities();
233 void slotPopCapabilities( const TQStringList &, const TQStringList & );
234 void slotImapCapabilities( const TQStringList &, const TQStringList & );
235 void slotReloadNamespaces();
236 void slotSetupNamespaces( const ImapAccountBase::nsDelimMap& map );
237 void slotEditPersonalNamespace();
238 void slotEditOtherUsersNamespace();
239 void slotEditSharedNamespace();
240 void slotConnectionResult( int errorCode, const TQString& );
241 void slotLeaveOnServerDaysChanged( int value );
242 void slotLeaveOnServerCountChanged( int value );
243 void slotFilterOnServerSizeChanged( int value );
244#if 0
245 // Moc doesn't understand #if 0, so they are also commented out
246 // void slotClearResourceAllocations();
247 // void slotClearPastResourceAllocations();
248#endif
249
250 private:
251 void makeLocalAccountPage();
252 void makeMaildirAccountPage();
253 void makePopAccountPage();
254 void makeImapAccountPage( bool disconnected = false );
255 void setupSettings();
256 void saveSettings();
257 void checkHighest( TQButtonGroup * );
258 static unsigned int popCapabilitiesFromStringList( const TQStringList & );
259 static unsigned int imapCapabilitiesFromStringList( const TQStringList & );
260 void enablePopFeatures( unsigned int );
261 void enableImapAuthMethods( unsigned int );
262 void initAccountForConnect();
263 const TQString namespaceListToString( const TQStringList& list );
264
265 private:
266 LocalWidgets mLocal;
267 MaildirWidgets mMaildir;
268 PopWidgets mPop;
269 ImapWidgets mImap;
270 KMAccount *mAccount;
271 TQValueList<TQGuardedPtr<KMFolder> > mFolderList;
272 TQStringList mFolderNames;
273 KMServerTest *mServerTest;
274 enum EncryptionMethods {
275 NoEncryption = 0,
276 SSL = 1,
277 TLS = 2
278 };
279 enum Capabilities {
280 Plain = 1,
281 Login = 2,
282 CRAM_MD5 = 4,
283 Digest_MD5 = 8,
284 Anonymous = 16,
285 APOP = 32,
286 Pipelining = 64,
287 TOP = 128,
288 UIDL = 256,
289 STLS = 512, // TLS for POP
290 STARTTLS = 512, // TLS for IMAP
291 GSSAPI = 1024,
292 NTLM = 2048,
293 AllCapa = 0xffffffff
294 };
295 unsigned int mCurCapa;
296 unsigned int mCapaNormal;
297 unsigned int mCapaSSL;
298 unsigned int mCapaTLS;
299 KMail::SieveConfigEditor *mSieveConfigEditor;
300 TQRegExpValidator *mValidator;
301};
302
303class NamespaceLineEdit: public KLineEdit
304{
305 TQ_OBJECT
306
307
308 public:
309 NamespaceLineEdit( TQWidget* parent );
310
311 const TQString& lastText() { return mLastText; }
312
313 public slots:
314 virtual void setText ( const TQString & );
315
316 private:
317 TQString mLastText;
318};
319
320class NamespaceEditDialog: public KDialogBase
321{
322 TQ_OBJECT
323
324
325 public:
326 NamespaceEditDialog( TQWidget* parent, ImapAccountBase::imapNamespace type,
327 ImapAccountBase::nsDelimMap* map );
328
329 protected slots:
330 void slotOk();
331 void slotRemoveEntry( int );
332
333 private:
334 ImapAccountBase::imapNamespace mType;
335 ImapAccountBase::nsDelimMap* mNamespaceMap;
336 ImapAccountBase::namespaceDelim mDelimMap;
337 TQMap<int, NamespaceLineEdit*> mLineEditMap;
338 TQButtonGroup* mBg;
339};
340
341} // namespace KMail
342
343#endif
Mail folder.
Definition: kmfolder.h:69
folderdiaquotatab.h
Definition: aboutdata.cpp:40