summaryrefslogtreecommitdiffstats
path: root/kbiff/setupdlg.h
blob: cf30e522b45766c7fa67fd2da83e200b539bbe16 (plain)
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
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
/*
 * setupdlg.h
 * Copyright (C) 1999-2001 Kurt Granroth <granroth@kde.org>
 *
 * This file contains the setup dialog and related widgets
 * for KBiff.  All user configuration is done here.
 *
 * $Id$
 */
#ifndef SETUPDLG_H
#define SETUPDLG_H

#ifdef HAVE_CONFIG_H
#include <config.h>
#endif //HAVE_CONFIG_H

#include <kbiffurl.h>

#include <ntqlistview.h>

#include <ntqwidget.h>
#include <kdialog.h>
#include <ntqdict.h>
#include <ntqlineedit.h>

class TQLineEdit;
class TQCheckBox;
class TQPushButton;
class TQComboBox;

#include <kicondialog.h>

struct KBiffMailbox
{
  KBiffURL url;
  bool store;
  TQString key;
};

class KBiffGeneralTab;
class KBiffNewMailTab;
class KBiffMailboxTab;
class KBiffAboutTab;
class KBiffNewDlg;

class KBiffSetup : public KDialog
{
	Q_OBJECT
public:
	KBiffSetup(const TQString& name = TQString::null, bool secure = false);
	virtual ~KBiffSetup();

	const TQString getProfile() const;
	const KBiffURL getCurrentMailbox() const;
	const TQList<KBiffMailbox> getMailboxList() const;

	const TQString getMailClient() const;
	const TQString getRunCommandPath() const;
	const TQString getRunResetCommandPath() const;
	const TQString getPlaySoundPath() const;
	const TQString getNoMailIcon() const;
	const TQString getNewMailIcon() const;
	const TQString getOldMailIcon() const;
	const TQString getNoConnIcon() const;
	const TQString getStoppedIcon() const;
	bool getSystemBeep() const;
	bool getRunCommand() const;
	bool getRunResetCommand() const;
	bool getPlaySound() const;
	bool getNotify() const;
	bool getStatus() const;
	bool getDock() const;
	bool getSessionManagement() const;
	bool getCheckStartup() const;
	bool getSecure() const;
	unsigned int getPoll() const;

public slots:
	void invokeHelp();

	void readConfig(const TQString& profile);
	void saveConfig();

protected:
	TQString getSomeProfile() const;

protected slots:
	void slotDone();
	void slotAddNewProfile();
	void slotRenameProfile();
	void slotDeleteProfile();

private:
	bool isSecure;

	// "outer" dialog
	TQComboBox   *comboProfile;

	// tabs
	KBiffGeneralTab *generalTab;
	KBiffNewMailTab *newmailTab;
	KBiffMailboxTab *mailboxTab;
	KBiffAboutTab   *aboutTab;
};

class KBiffGeneralTab : public TQWidget
{
	Q_OBJECT
public:
	KBiffGeneralTab(const TQString& profile = TQString::null, TQWidget *parent=0);
	virtual ~KBiffGeneralTab();

	const TQString getButtonNewMail() const;
	const TQString getButtonOldMail() const;
	const TQString getButtonNoMail() const;
	const TQString getButtonNoConn() const;
	const TQString getButtonStopped() const;
	const TQString getMailClient() const;
	int   getPoll() const;
	bool  getDock() const;
	bool  getSessionManagement() const;
	bool  getCheckStartup() const;

public slots:
	void readConfig(const TQString& profile);
	void saveConfig(const TQString& profile);

private:
	TQLineEdit* editPoll;
	TQLineEdit* editCommand;
	TQCheckBox* checkDock;
	TQCheckBox* checkNoSession;
	TQCheckBox* checkNoStartup;

	TDEIconButton *buttonNoMail;
	TDEIconButton *buttonOldMail;
	TDEIconButton *buttonNewMail;
	TDEIconButton *buttonNoConn;
	TDEIconButton *buttonStopped;
};

class KBiffNewMailTab : public TQWidget
{
	Q_OBJECT
public:
	KBiffNewMailTab(const TQString& profile = TQString::null, TQWidget *parent=0);
	virtual ~KBiffNewMailTab();

	bool getRunCommand() const;
	const TQString getRunCommandPath() const;
	bool getRunResetCommand() const;
	const TQString getRunResetCommandPath() const;
	bool getPlaySound() const;
	const TQString getPlaySoundPath() const;
	bool getSystemBeep() const;
	bool getNotify() const;
	bool getStatus() const;

public slots:
	void readConfig(const TQString& profile);
	void saveConfig(const TQString& profile);

protected slots:
	void enableRunCommand(bool);
	void enableRunResetCommand(bool);
	void enablePlaySound(bool);
	void browseRunCommand();
	void browseRunResetCommand();
	void browsePlaySound();
	void testPlaySound();

private:
	TQLineEdit *editRunCommand;
	TQLineEdit *editRunResetCommand;
	TQLineEdit *editPlaySound;

	TQCheckBox *checkRunCommand;
	TQCheckBox *checkRunResetCommand;
	TQCheckBox *checkPlaySound;
	TQCheckBox *checkBeep;
	TQCheckBox *checkNotify;
	TQCheckBox *checkStatus;

	TQPushButton *buttonBrowsePlaySound;
	TQPushButton *buttonTestPlaySound;
	TQPushButton *buttonBrowseRunCommand;
	TQPushButton *buttonBrowseRunResetCommand;
};

class KBiffMailboxAdvanced : public KDialog
{
	Q_OBJECT
public:
	KBiffMailboxAdvanced();
	virtual ~KBiffMailboxAdvanced();

	const KBiffURL getMailbox() const;
	unsigned int getPort() const;
	bool getPreauth() const;

	void setPort(unsigned int the_port, bool enable = true);
	void setTimeout(unsigned int the_to, bool enable = true);
	void setMailbox(const KBiffURL& url);
	void setPreauth(bool on);
	void setKeepalive(bool on);
	void setAsync(bool on);
	void setDisableApop(bool on);

protected slots:
	void portModified(const TQString& text);
	void timeoutModified(const TQString& text);
	void preauthModified(bool toggled);
	void keepaliveModified(bool toggled);
	void asyncModified(bool toggled);
    void apopModified(bool toggled);

private:
	TQString    password;
	TQLineEdit *mailbox;
	TQLineEdit *port;
	TQLineEdit *timeout;
	TQCheckBox *preauth;
	TQCheckBox *keepalive;
	TQCheckBox *async;
    TQCheckBox *apop;
};

class KBiffMailboxTab : public TQWidget
{
	Q_OBJECT
public:
	KBiffMailboxTab(const TQString& profile = TQString::null, TQWidget *parent=0);
	virtual ~KBiffMailboxTab();

	void setMailbox(const KBiffURL& url);

	const KBiffURL getMailbox() const;
	const TQList<KBiffMailbox> getMailboxList() const;

public slots:
	void readConfig(const TQString& profile);
	void saveConfig(const TQString& profile);

protected slots:
	void slotDeleteMailbox();
	void slotNewMailbox();
	void slotMailboxSelected(TQListViewItem *item);

	void protocolSelected(int protocol);
	void browse();
	void advanced();

	void enableFetchCommand(bool);
	void browseFetchCommand();

protected:
	const KBiffURL defaultMailbox() const;

private:
	TQDict<KBiffMailbox> *mailboxHash;
	TQListViewItem       *oldItem;

	unsigned int port;
	unsigned int timeout;
	bool         preauth;
	bool         keepalive;
	bool         async;
	bool         useApop;
	TQComboBox   *comboProtocol;
	TQLineEdit   *editMailbox;
	TQLineEdit   *editServer;
	TQLineEdit   *editUser;
	TQLineEdit   *editPassword;
	TQLineEdit   *editFetchCommand;
	TQCheckBox   *checkFetchCommand;
	TQCheckBox   *checkStorePassword;
	TQPushButton *buttonBrowse;
	TQListView   *mailboxes;

	TQPushButton *buttonBrowseFetchCommand;
};

class KBiffAboutTab : public TQWidget
{
	Q_OBJECT
public:
	KBiffAboutTab(TQWidget *parent=0);
	virtual ~KBiffAboutTab();

protected slots:
	void mailTo(const TQString&);
	void homepage(const TQString&);
};

class KBiffNewDlg : public KDialog
{
	Q_OBJECT
public:
	KBiffNewDlg(TQWidget* parent = 0, const char * name = 0);

	const TQString getName() const
		{ return editName->text(); }

private:
	TQLineEdit *editName;
};

#endif // SETUPDLG_H