-rw-r--r-- | libkdepim/kprefsdialog.cpp | 30 | ||||
-rw-r--r-- | libkdepim/kprefsdialog.h | 26 |
2 files changed, 56 insertions, 0 deletions
diff --git a/libkdepim/kprefsdialog.cpp b/libkdepim/kprefsdialog.cpp index b6ae775..6dc741d 100644 --- a/libkdepim/kprefsdialog.cpp +++ b/libkdepim/kprefsdialog.cpp | |||
@@ -18,70 +18,72 @@ | |||
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 | 23 | ||
24 | // $Id$ | 24 | // $Id$ |
25 | 25 | ||
26 | #include <qlayout.h> | 26 | #include <qlayout.h> |
27 | #include <qlabel.h> | 27 | #include <qlabel.h> |
28 | #include <qgroupbox.h> | 28 | #include <qgroupbox.h> |
29 | #include <qbuttongroup.h> | 29 | #include <qbuttongroup.h> |
30 | #include <qlineedit.h> | 30 | #include <qlineedit.h> |
31 | #include <qfont.h> | 31 | #include <qfont.h> |
32 | #include <qslider.h> | 32 | #include <qslider.h> |
33 | #include <qfile.h> | 33 | #include <qfile.h> |
34 | #include <qtextstream.h> | 34 | #include <qtextstream.h> |
35 | #include <qvbox.h> | 35 | #include <qvbox.h> |
36 | #include <qhbox.h> | 36 | #include <qhbox.h> |
37 | #include <qspinbox.h> | 37 | #include <qspinbox.h> |
38 | #include <qdatetime.h> | 38 | #include <qdatetime.h> |
39 | #include <qframe.h> | 39 | #include <qframe.h> |
40 | #include <qcombobox.h> | 40 | #include <qcombobox.h> |
41 | #include <qcheckbox.h> | 41 | #include <qcheckbox.h> |
42 | #include <qradiobutton.h> | 42 | #include <qradiobutton.h> |
43 | #include <qpushbutton.h> | 43 | #include <qpushbutton.h> |
44 | #include <qapplication.h> | 44 | #include <qapplication.h> |
45 | 45 | ||
46 | #include <kcolorbutton.h> | 46 | #include <kcolorbutton.h> |
47 | #include <kdebug.h> | 47 | #include <kdebug.h> |
48 | #include <klocale.h> | 48 | #include <klocale.h> |
49 | #include <kglobal.h> | 49 | #include <kglobal.h> |
50 | #include <kglobalsettings.h> | ||
50 | #include <kfontdialog.h> | 51 | #include <kfontdialog.h> |
51 | #include <kmessagebox.h> | 52 | #include <kmessagebox.h> |
52 | #include <kcolordialog.h> | 53 | #include <kcolordialog.h> |
53 | #include <kiconloader.h> | 54 | #include <kiconloader.h> |
54 | 55 | ||
55 | #include "kprefs.h" | 56 | #include "kprefs.h" |
57 | #include "kpimglobalprefs.h" | ||
56 | 58 | ||
57 | #include "kprefsdialog.h" | 59 | #include "kprefsdialog.h" |
58 | //#include "kprefsdialog.moc" | 60 | //#include "kprefsdialog.moc" |
59 | 61 | ||
60 | KPrefsDialogWidBool::KPrefsDialogWidBool(const QString &text,bool *reference, | 62 | KPrefsDialogWidBool::KPrefsDialogWidBool(const QString &text,bool *reference, |
61 | QWidget *parent) | 63 | QWidget *parent) |
62 | { | 64 | { |
63 | mReference = reference; | 65 | mReference = reference; |
64 | 66 | ||
65 | mCheck = new QCheckBox(text,parent); | 67 | mCheck = new QCheckBox(text,parent); |
66 | } | 68 | } |
67 | 69 | ||
68 | void KPrefsDialogWidBool::readConfig() | 70 | void KPrefsDialogWidBool::readConfig() |
69 | { | 71 | { |
70 | mCheck->setChecked(*mReference); | 72 | mCheck->setChecked(*mReference); |
71 | } | 73 | } |
72 | 74 | ||
73 | void KPrefsDialogWidBool::writeConfig() | 75 | void KPrefsDialogWidBool::writeConfig() |
74 | { | 76 | { |
75 | *mReference = mCheck->isChecked(); | 77 | *mReference = mCheck->isChecked(); |
76 | } | 78 | } |
77 | 79 | ||
78 | QCheckBox *KPrefsDialogWidBool::checkBox() | 80 | QCheckBox *KPrefsDialogWidBool::checkBox() |
79 | { | 81 | { |
80 | return mCheck; | 82 | return mCheck; |
81 | } | 83 | } |
82 | 84 | ||
83 | 85 | ||
84 | KPrefsDialogWidColor::KPrefsDialogWidColor(const QString &text,QColor *reference, | 86 | KPrefsDialogWidColor::KPrefsDialogWidColor(const QString &text,QColor *reference, |
85 | QWidget *parent) | 87 | QWidget *parent) |
86 | { | 88 | { |
87 | mReference = reference; | 89 | mReference = reference; |
@@ -379,32 +381,60 @@ void KPrefsDialog::writeConfig() | |||
379 | // kdDebug(5300) << "KPrefsDialog::writeConfig() now writing..." << endl; | 381 | // kdDebug(5300) << "KPrefsDialog::writeConfig() now writing..." << endl; |
380 | 382 | ||
381 | mPrefs->writeConfig(); | 383 | mPrefs->writeConfig(); |
382 | 384 | ||
383 | // kdDebug(5300) << "KPrefsDialog::writeConfig() done" << endl; | 385 | // kdDebug(5300) << "KPrefsDialog::writeConfig() done" << endl; |
384 | } | 386 | } |
385 | 387 | ||
386 | 388 | ||
387 | void KPrefsDialog::slotApply() | 389 | void KPrefsDialog::slotApply() |
388 | { | 390 | { |
389 | writeConfig(); | 391 | writeConfig(); |
390 | emit configChanged(); | 392 | emit configChanged(); |
391 | } | 393 | } |
392 | 394 | ||
393 | void KPrefsDialog::slotOk() | 395 | void KPrefsDialog::slotOk() |
394 | { | 396 | { |
395 | slotApply(); | 397 | slotApply(); |
396 | QDialog::accept(); | 398 | QDialog::accept(); |
397 | } | 399 | } |
398 | void KPrefsDialog::accept() | 400 | void KPrefsDialog::accept() |
399 | { | 401 | { |
400 | slotOk(); | 402 | slotOk(); |
401 | } | 403 | } |
402 | 404 | ||
403 | void KPrefsDialog::slotDefault() | 405 | void KPrefsDialog::slotDefault() |
404 | { | 406 | { |
405 | if (KMessageBox::warningContinueCancel(this, | 407 | if (KMessageBox::warningContinueCancel(this, |
406 | i18n("You are about to set all\npreferences to default values.\nAll " | 408 | i18n("You are about to set all\npreferences to default values.\nAll " |
407 | "custom modifications will be lost."),i18n("Setting Default Preferences"), | 409 | "custom modifications will be lost."),i18n("Setting Default Preferences"), |
408 | i18n("Continue")) | 410 | i18n("Continue")) |
409 | == KMessageBox::Continue) setDefaults(); | 411 | == KMessageBox::Continue) setDefaults(); |
410 | } | 412 | } |
413 | |||
414 | KPimPrefsGlobalDialog::KPimPrefsGlobalDialog(QWidget *parent,char *name,bool modal): KPrefsDialog( KPimGlobalPrefs::instance() ,parent, name, modal ) | ||
415 | { | ||
416 | setFont( KGlobalSettings::generalMaxFont() ); | ||
417 | kdelibcfg = new KDEPIMConfigWidget( KPimGlobalPrefs::instance(), this, "KPrefsGlobalDialog" ); | ||
418 | setMainWidget( kdelibcfg ); | ||
419 | setCaption( i18n("KDE-Pim Global Settings")); | ||
420 | kdelibcfg->readConfig(); | ||
421 | #ifndef DESKTOP_VERSION | ||
422 | if ( QApplication::desktop()->height() <= 480 ) | ||
423 | hideButtons(); | ||
424 | showMaximized(); | ||
425 | #endif | ||
426 | } | ||
427 | void KPimPrefsGlobalDialog::showTZconfig() | ||
428 | { | ||
429 | kdelibcfg->showTimeZoneTab() ; | ||
430 | } | ||
431 | void KPimPrefsGlobalDialog::usrReadConfig() | ||
432 | { | ||
433 | kdelibcfg->readConfig(); | ||
434 | } | ||
435 | |||
436 | void KPimPrefsGlobalDialog::usrWriteConfig() | ||
437 | { | ||
438 | kdelibcfg->writeConfig(); | ||
439 | } | ||
440 | |||
diff --git a/libkdepim/kprefsdialog.h b/libkdepim/kprefsdialog.h index efcb86a..52ec809 100644 --- a/libkdepim/kprefsdialog.h +++ b/libkdepim/kprefsdialog.h | |||
@@ -413,33 +413,59 @@ class KPrefsDialog : public KDialogBase | |||
413 | void readConfig(); | 413 | void readConfig(); |
414 | 414 | ||
415 | /** Write preferences to config file. */ | 415 | /** Write preferences to config file. */ |
416 | void writeConfig(); | 416 | void writeConfig(); |
417 | 417 | ||
418 | signals: | 418 | signals: |
419 | /** Emitted when the a changed configuration has been stored. */ | 419 | /** Emitted when the a changed configuration has been stored. */ |
420 | void configChanged(); | 420 | void configChanged(); |
421 | 421 | ||
422 | protected slots: | 422 | protected slots: |
423 | /** Apply changes to preferences */ | 423 | /** Apply changes to preferences */ |
424 | void slotApply(); | 424 | void slotApply(); |
425 | 425 | ||
426 | void accept(); | 426 | void accept(); |
427 | /** Accept changes to preferences and close dialog */ | 427 | /** Accept changes to preferences and close dialog */ |
428 | void slotOk(); | 428 | void slotOk(); |
429 | 429 | ||
430 | /** Set preferences to default values */ | 430 | /** Set preferences to default values */ |
431 | void slotDefault(); | 431 | void slotDefault(); |
432 | 432 | ||
433 | protected: | 433 | protected: |
434 | /** Implement this to read custom configuration widgets. */ | 434 | /** Implement this to read custom configuration widgets. */ |
435 | virtual void usrReadConfig() {} | 435 | virtual void usrReadConfig() {} |
436 | /** Implement this to write custom configuration widgets. */ | 436 | /** Implement this to write custom configuration widgets. */ |
437 | virtual void usrWriteConfig() {} | 437 | virtual void usrWriteConfig() {} |
438 | 438 | ||
439 | private: | 439 | private: |
440 | KPrefs *mPrefs; | 440 | KPrefs *mPrefs; |
441 | 441 | ||
442 | QPtrList<KPrefsDialogWid> mPrefsWids; | 442 | QPtrList<KPrefsDialogWid> mPrefsWids; |
443 | }; | 443 | }; |
444 | 444 | ||
445 | |||
446 | #include "kcmconfigs/kdepimconfigwidget.h" | ||
447 | class KPimPrefsGlobalDialog : public KPrefsDialog | ||
448 | { | ||
449 | Q_OBJECT | ||
450 | public: | ||
451 | KPimPrefsGlobalDialog(QWidget *parent=0,char *name=0,bool modal=true); | ||
452 | /** | ||
453 | Destructor. | ||
454 | */ | ||
455 | void showTZconfig(); | ||
456 | |||
457 | public slots: | ||
458 | |||
459 | signals: | ||
460 | protected slots: | ||
461 | |||
462 | protected: | ||
463 | void usrReadConfig(); | ||
464 | virtual void usrWriteConfig() ; | ||
465 | |||
466 | private: | ||
467 | KDEPIMConfigWidget* kdelibcfg; | ||
468 | |||
469 | }; | ||
470 | |||
445 | #endif | 471 | #endif |