-rw-r--r-- | libkdepim/kprefsdialog.h | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/libkdepim/kprefsdialog.h b/libkdepim/kprefsdialog.h index 52ec809..cc95dd4 100644 --- a/libkdepim/kprefsdialog.h +++ b/libkdepim/kprefsdialog.h | |||
@@ -1,87 +1,89 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of KOrganizer. | 2 | This file is part of KOrganizer. |
3 | Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org> | 3 | Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org> |
4 | 4 | ||
5 | This program is free software; you can redistribute it and/or modify | 5 | This program is free software; you can redistribute it and/or modify |
6 | it under the terms of the GNU General Public License as published by | 6 | it under the terms of the GNU General Public License as published by |
7 | the Free Software Foundation; either version 2 of the License, or | 7 | the Free Software Foundation; either version 2 of the License, or |
8 | (at your option) any later version. | 8 | (at your option) any later version. |
9 | 9 | ||
10 | This program is distributed in the hope that it will be useful, | 10 | This program is distributed in the hope that it will be useful, |
11 | but WITHOUT ANY WARRANTY; without even the implied warranty of | 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
13 | GNU General Public License for more details. | 13 | GNU General Public License for more details. |
14 | 14 | ||
15 | You should have received a copy of the GNU General Public License | 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 | 16 | along with this program; if not, write to the Free Software |
17 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | 17 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
18 | 18 | ||
19 | As a special exception, permission is given to link this program | 19 | As a special exception, permission is given to link this program |
20 | with any edition of Qt, and distribute the resulting executable, | 20 | with any edition of Qt, and distribute the resulting executable, |
21 | without including the source code for Qt in the source distribution. | 21 | without including the source code for Qt in the source distribution. |
22 | */ | 22 | */ |
23 | #ifndef _KPREFSDIALOG_H | 23 | #ifndef _KPREFSDIALOG_H |
24 | #define _KPREFSDIALOG_H | 24 | #define _KPREFSDIALOG_H |
25 | // $Id$ | 25 | // $Id$ |
26 | 26 | ||
27 | #include <qptrlist.h> | 27 | #include <q3ptrlist.h> |
28 | #include <qlineedit.h> | 28 | #include <qlineedit.h> |
29 | //Added by qt3to4: | ||
30 | #include <QLabel> | ||
29 | 31 | ||
30 | #include <kdialogbase.h> | 32 | #include <kdialogbase.h> |
31 | 33 | ||
32 | class KPrefs; | 34 | class KPrefs; |
33 | class KPrefsDialog; | 35 | class KPrefsDialog; |
34 | 36 | ||
35 | class KColorButton; | 37 | class KColorButton; |
36 | class QCheckBox; | 38 | class QCheckBox; |
37 | class QLabel; | 39 | class QLabel; |
38 | class QSpinBox; | 40 | class QSpinBox; |
39 | class QButtonGroup; | 41 | class Q3ButtonGroup; |
40 | 42 | ||
41 | /** | 43 | /** |
42 | @short Base class for widgets used by @ref KPrefsDialog. | 44 | @short Base class for widgets used by @ref KPrefsDialog. |
43 | @author Cornelius Schumacher | 45 | @author Cornelius Schumacher |
44 | @see KPrefsDialog | 46 | @see KPrefsDialog |
45 | 47 | ||
46 | This class provides the interface for the preferences widgets used by | 48 | This class provides the interface for the preferences widgets used by |
47 | KPrefsDialog. | 49 | KPrefsDialog. |
48 | */ | 50 | */ |
49 | class KPrefsDialogWid : public QObject | 51 | class KPrefsDialogWid : public QObject |
50 | { | 52 | { |
51 | public: | 53 | public: |
52 | /** | 54 | /** |
53 | This function is called to read value of the setting from the | 55 | This function is called to read value of the setting from the |
54 | stored configuration and display it in the widget. | 56 | stored configuration and display it in the widget. |
55 | */ | 57 | */ |
56 | virtual void readConfig() = 0; | 58 | virtual void readConfig() = 0; |
57 | /** | 59 | /** |
58 | This function is called to write the current setting of the widget to the | 60 | This function is called to write the current setting of the widget to the |
59 | stored configuration. | 61 | stored configuration. |
60 | */ | 62 | */ |
61 | virtual void writeConfig() = 0; | 63 | virtual void writeConfig() = 0; |
62 | }; | 64 | }; |
63 | 65 | ||
64 | /** | 66 | /** |
65 | @short Widget for bool settings in @ref KPrefsDialog. | 67 | @short Widget for bool settings in @ref KPrefsDialog. |
66 | 68 | ||
67 | This class provides a widget for configuring bool values. It is meant to be | 69 | This class provides a widget for configuring bool values. It is meant to be |
68 | used by KPrefsDialog. The user is responsible for the layout management. | 70 | used by KPrefsDialog. The user is responsible for the layout management. |
69 | */ | 71 | */ |
70 | class KPrefsDialogWidBool : public KPrefsDialogWid | 72 | class KPrefsDialogWidBool : public KPrefsDialogWid |
71 | { | 73 | { |
72 | public: | 74 | public: |
73 | /** | 75 | /** |
74 | Create a bool widget consisting of a QCheckbox. | 76 | Create a bool widget consisting of a QCheckbox. |
75 | 77 | ||
76 | @param text Text of QCheckBox. | 78 | @param text Text of QCheckBox. |
77 | @param reference Pointer to variable read and written by this widget. | 79 | @param reference Pointer to variable read and written by this widget. |
78 | @param parent Parent widget. | 80 | @param parent Parent widget. |
79 | */ | 81 | */ |
80 | KPrefsDialogWidBool(const QString &text,bool *reference,QWidget *parent); | 82 | KPrefsDialogWidBool(const QString &text,bool *reference,QWidget *parent); |
81 | 83 | ||
82 | /** | 84 | /** |
83 | Return the QCheckbox used by this widget. | 85 | Return the QCheckbox used by this widget. |
84 | */ | 86 | */ |
85 | QCheckBox *checkBox(); | 87 | QCheckBox *checkBox(); |
86 | 88 | ||
87 | void readConfig(); | 89 | void readConfig(); |
@@ -213,105 +215,105 @@ class KPrefsDialogWidFont : public KPrefsDialogWid | |||
213 | void readConfig(); | 215 | void readConfig(); |
214 | void writeConfig(); | 216 | void writeConfig(); |
215 | 217 | ||
216 | protected slots: | 218 | protected slots: |
217 | void selectFont(); | 219 | void selectFont(); |
218 | 220 | ||
219 | private: | 221 | private: |
220 | QFont *mReference; | 222 | QFont *mReference; |
221 | 223 | ||
222 | QLabel *mLabel; | 224 | QLabel *mLabel; |
223 | QLabel *mPreview; | 225 | QLabel *mPreview; |
224 | QPushButton *mButton; | 226 | QPushButton *mButton; |
225 | }; | 227 | }; |
226 | 228 | ||
227 | /** | 229 | /** |
228 | @short Widget for settings represented by a group of radio buttons in | 230 | @short Widget for settings represented by a group of radio buttons in |
229 | @ref KPrefsDialog. | 231 | @ref KPrefsDialog. |
230 | 232 | ||
231 | This class provides a widget for configuring selections. It is meant to be | 233 | This class provides a widget for configuring selections. It is meant to be |
232 | used by KPrefsDialog. The user is responsible for the layout management. The | 234 | used by KPrefsDialog. The user is responsible for the layout management. The |
233 | setting is interpreted as an int value, corresponding to the position of the | 235 | setting is interpreted as an int value, corresponding to the position of the |
234 | radio button. The position of the button is defined by the sequence of @ref | 236 | radio button. The position of the button is defined by the sequence of @ref |
235 | addRadio() calls, starting with 0. | 237 | addRadio() calls, starting with 0. |
236 | */ | 238 | */ |
237 | class KPrefsDialogWidRadios : public KPrefsDialogWid | 239 | class KPrefsDialogWidRadios : public KPrefsDialogWid |
238 | { | 240 | { |
239 | public: | 241 | public: |
240 | /** | 242 | /** |
241 | Create a widget for selection of an option. It consists of a box with | 243 | Create a widget for selection of an option. It consists of a box with |
242 | several radio buttons. | 244 | several radio buttons. |
243 | 245 | ||
244 | @param text Text of main box. | 246 | @param text Text of main box. |
245 | @param reference Pointer to variable read and written by this widget. | 247 | @param reference Pointer to variable read and written by this widget. |
246 | @param parent Parent widget. | 248 | @param parent Parent widget. |
247 | */ | 249 | */ |
248 | KPrefsDialogWidRadios(const QString &text,int *reference,QWidget *parent); | 250 | KPrefsDialogWidRadios(const QString &text,int *reference,QWidget *parent); |
249 | virtual ~KPrefsDialogWidRadios(); | 251 | virtual ~KPrefsDialogWidRadios(); |
250 | 252 | ||
251 | /** | 253 | /** |
252 | Add a radio button. | 254 | Add a radio button. |
253 | 255 | ||
254 | @param text Text of the button. | 256 | @param text Text of the button. |
255 | */ | 257 | */ |
256 | void addRadio(const QString &text); | 258 | void addRadio(const QString &text); |
257 | 259 | ||
258 | /** | 260 | /** |
259 | Return the box widget used by this widget. | 261 | Return the box widget used by this widget. |
260 | */ | 262 | */ |
261 | QButtonGroup *groupBox(); | 263 | Q3ButtonGroup *groupBox(); |
262 | 264 | ||
263 | void readConfig(); | 265 | void readConfig(); |
264 | void writeConfig(); | 266 | void writeConfig(); |
265 | 267 | ||
266 | private: | 268 | private: |
267 | int *mReference; | 269 | int *mReference; |
268 | 270 | ||
269 | QButtonGroup *mBox; | 271 | Q3ButtonGroup *mBox; |
270 | }; | 272 | }; |
271 | 273 | ||
272 | 274 | ||
273 | /** | 275 | /** |
274 | @short Widget for string settings in @ref KPrefsDialog. | 276 | @short Widget for string settings in @ref KPrefsDialog. |
275 | 277 | ||
276 | This class provides a widget for configuring string values. It is meant to be | 278 | This class provides a widget for configuring string values. It is meant to be |
277 | used by KPrefsDialog. The user is responsible for the layout management. | 279 | used by KPrefsDialog. The user is responsible for the layout management. |
278 | */ | 280 | */ |
279 | class KPrefsDialogWidString : public KPrefsDialogWid | 281 | class KPrefsDialogWidString : public KPrefsDialogWid |
280 | { | 282 | { |
281 | public: | 283 | public: |
282 | /** | 284 | /** |
283 | Create a string widget consisting of a test label and a line edit. | 285 | Create a string widget consisting of a test label and a line edit. |
284 | 286 | ||
285 | @param text Text of label. | 287 | @param text Text of label. |
286 | @param reference Pointer to variable read and written by this widget. | 288 | @param reference Pointer to variable read and written by this widget. |
287 | @param parent Parent widget. | 289 | @param parent Parent widget. |
288 | */ | 290 | */ |
289 | KPrefsDialogWidString(const QString &text,QString *reference,QWidget *parent,QLineEdit::EchoMode echomode=QLineEdit::Normal); | 291 | KPrefsDialogWidString(const QString &text,QString *reference,QWidget *parent,QLineEdit::EchoMode echomode=QLineEdit::Normal); |
290 | /** | 292 | /** |
291 | Destructor. | 293 | Destructor. |
292 | */ | 294 | */ |
293 | virtual ~KPrefsDialogWidString(); | 295 | virtual ~KPrefsDialogWidString(); |
294 | 296 | ||
295 | /** | 297 | /** |
296 | Return label used by this widget. | 298 | Return label used by this widget. |
297 | */ | 299 | */ |
298 | QLabel *label(); | 300 | QLabel *label(); |
299 | /** | 301 | /** |
300 | Return QLineEdit used by this widget. | 302 | Return QLineEdit used by this widget. |
301 | */ | 303 | */ |
302 | QLineEdit *lineEdit(); | 304 | QLineEdit *lineEdit(); |
303 | 305 | ||
304 | void readConfig(); | 306 | void readConfig(); |
305 | void writeConfig(); | 307 | void writeConfig(); |
306 | 308 | ||
307 | private: | 309 | private: |
308 | QString *mReference; | 310 | QString *mReference; |
309 | 311 | ||
310 | QLabel *mLabel; | 312 | QLabel *mLabel; |
311 | QLineEdit *mEdit; | 313 | QLineEdit *mEdit; |
312 | }; | 314 | }; |
313 | 315 | ||
314 | 316 | ||
315 | /** | 317 | /** |
316 | @short Base class for a preferences dialog. | 318 | @short Base class for a preferences dialog. |
317 | 319 | ||
@@ -394,78 +396,78 @@ class KPrefsDialog : public KDialogBase | |||
394 | @param parent Parent widget. | 396 | @param parent Parent widget. |
395 | */ | 397 | */ |
396 | KPrefsDialogWidString *addWidPassword (const QString &text,QString *reference,QWidget *parent); | 398 | KPrefsDialogWidString *addWidPassword (const QString &text,QString *reference,QWidget *parent); |
397 | /** | 399 | /** |
398 | Register a @ref KPrefsDialogWidFont object. | 400 | Register a @ref KPrefsDialogWidFont object. |
399 | 401 | ||
400 | @param sampleText Sample text of font widget. | 402 | @param sampleText Sample text of font widget. |
401 | @param buttonText Button text of font widget. | 403 | @param buttonText Button text of font widget. |
402 | @param reference Reference to variable storing the setting. | 404 | @param reference Reference to variable storing the setting. |
403 | @param parent Parent widget. | 405 | @param parent Parent widget. |
404 | */ | 406 | */ |
405 | KPrefsDialogWidFont *addWidFont(const QString &sampleText,const QString &buttonText, | 407 | KPrefsDialogWidFont *addWidFont(const QString &sampleText,const QString &buttonText, |
406 | QFont *reference,QWidget *parent); | 408 | QFont *reference,QWidget *parent); |
407 | 409 | ||
408 | public slots: | 410 | public slots: |
409 | /** Set all widgets to default values. */ | 411 | /** Set all widgets to default values. */ |
410 | void setDefaults(); | 412 | void setDefaults(); |
411 | 413 | ||
412 | /** Read preferences from config file. */ | 414 | /** Read preferences from config file. */ |
413 | void readConfig(); | 415 | void readConfig(); |
414 | 416 | ||
415 | /** Write preferences to config file. */ | 417 | /** Write preferences to config file. */ |
416 | void writeConfig(); | 418 | void writeConfig(); |
417 | 419 | ||
418 | signals: | 420 | signals: |
419 | /** Emitted when the a changed configuration has been stored. */ | 421 | /** Emitted when the a changed configuration has been stored. */ |
420 | void configChanged(); | 422 | void configChanged(); |
421 | 423 | ||
422 | protected slots: | 424 | protected slots: |
423 | /** Apply changes to preferences */ | 425 | /** Apply changes to preferences */ |
424 | void slotApply(); | 426 | void slotApply(); |
425 | 427 | ||
426 | void accept(); | 428 | void accept(); |
427 | /** Accept changes to preferences and close dialog */ | 429 | /** Accept changes to preferences and close dialog */ |
428 | void slotOk(); | 430 | void slotOk(); |
429 | 431 | ||
430 | /** Set preferences to default values */ | 432 | /** Set preferences to default values */ |
431 | void slotDefault(); | 433 | void slotDefault(); |
432 | 434 | ||
433 | protected: | 435 | protected: |
434 | /** Implement this to read custom configuration widgets. */ | 436 | /** Implement this to read custom configuration widgets. */ |
435 | virtual void usrReadConfig() {} | 437 | virtual void usrReadConfig() {} |
436 | /** Implement this to write custom configuration widgets. */ | 438 | /** Implement this to write custom configuration widgets. */ |
437 | virtual void usrWriteConfig() {} | 439 | virtual void usrWriteConfig() {} |
438 | 440 | ||
439 | private: | 441 | private: |
440 | KPrefs *mPrefs; | 442 | KPrefs *mPrefs; |
441 | 443 | ||
442 | QPtrList<KPrefsDialogWid> mPrefsWids; | 444 | Q3PtrList<KPrefsDialogWid> mPrefsWids; |
443 | }; | 445 | }; |
444 | 446 | ||
445 | 447 | ||
446 | #include "kcmconfigs/kdepimconfigwidget.h" | 448 | #include "kcmconfigs/kdepimconfigwidget.h" |
447 | class KPimPrefsGlobalDialog : public KPrefsDialog | 449 | class KPimPrefsGlobalDialog : public KPrefsDialog |
448 | { | 450 | { |
449 | Q_OBJECT | 451 | Q_OBJECT |
450 | public: | 452 | public: |
451 | KPimPrefsGlobalDialog(QWidget *parent=0,char *name=0,bool modal=true); | 453 | KPimPrefsGlobalDialog(QWidget *parent=0,char *name=0,bool modal=true); |
452 | /** | 454 | /** |
453 | Destructor. | 455 | Destructor. |
454 | */ | 456 | */ |
455 | void showTZconfig(); | 457 | void showTZconfig(); |
456 | 458 | ||
457 | public slots: | 459 | public slots: |
458 | 460 | ||
459 | signals: | 461 | signals: |
460 | protected slots: | 462 | protected slots: |
461 | 463 | ||
462 | protected: | 464 | protected: |
463 | void usrReadConfig(); | 465 | void usrReadConfig(); |
464 | virtual void usrWriteConfig() ; | 466 | virtual void usrWriteConfig() ; |
465 | 467 | ||
466 | private: | 468 | private: |
467 | KDEPIMConfigWidget* kdelibcfg; | 469 | KDEPIMConfigWidget* kdelibcfg; |
468 | 470 | ||
469 | }; | 471 | }; |
470 | 472 | ||
471 | #endif | 473 | #endif |