summaryrefslogtreecommitdiffabout
path: root/libkdepim
authorzautrix <zautrix>2005-06-10 10:31:22 (UTC)
committer zautrix <zautrix>2005-06-10 10:31:22 (UTC)
commite5ca8e0d8d6d08b597253f43de401aa1a99a6abe (patch) (unidiff)
treec319ba89abbe5cd90647bc38deb0ab1ce46f48e5 /libkdepim
parent89c5159208fd982f527117e49d67ea1f90553dbe (diff)
downloadkdepimpi-e5ca8e0d8d6d08b597253f43de401aa1a99a6abe.zip
kdepimpi-e5ca8e0d8d6d08b597253f43de401aa1a99a6abe.tar.gz
kdepimpi-e5ca8e0d8d6d08b597253f43de401aa1a99a6abe.tar.bz2
config dialog fixes
Diffstat (limited to 'libkdepim') (more/less context) (ignore whitespace changes)
-rw-r--r--libkdepim/kprefsdialog.cpp30
-rw-r--r--libkdepim/kprefsdialog.h26
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
@@ -2,102 +2,104 @@
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 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
60KPrefsDialogWidBool::KPrefsDialogWidBool(const QString &text,bool *reference, 62KPrefsDialogWidBool::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
68void KPrefsDialogWidBool::readConfig() 70void KPrefsDialogWidBool::readConfig()
69{ 71{
70 mCheck->setChecked(*mReference); 72 mCheck->setChecked(*mReference);
71} 73}
72 74
73void KPrefsDialogWidBool::writeConfig() 75void KPrefsDialogWidBool::writeConfig()
74{ 76{
75 *mReference = mCheck->isChecked(); 77 *mReference = mCheck->isChecked();
76} 78}
77 79
78QCheckBox *KPrefsDialogWidBool::checkBox() 80QCheckBox *KPrefsDialogWidBool::checkBox()
79{ 81{
80 return mCheck; 82 return mCheck;
81} 83}
82 84
83 85
84KPrefsDialogWidColor::KPrefsDialogWidColor(const QString &text,QColor *reference, 86KPrefsDialogWidColor::KPrefsDialogWidColor(const QString &text,QColor *reference,
85 QWidget *parent) 87 QWidget *parent)
86{ 88{
87 mReference = reference; 89 mReference = reference;
88 90
89 mButton = new KColorButton(parent); 91 mButton = new KColorButton(parent);
90 mLabel = new QLabel(mButton, text, parent); 92 mLabel = new QLabel(mButton, text, parent);
91 mButton->setColor( *mReference ); 93 mButton->setColor( *mReference );
92 mButton->setColor( Qt::red ); 94 mButton->setColor( Qt::red );
93 95
94} 96}
95 97
96KPrefsDialogWidColor::~KPrefsDialogWidColor() 98KPrefsDialogWidColor::~KPrefsDialogWidColor()
97{ 99{
98// kdDebug(5300) << "KPrefsDialogWidColor::~KPrefsDialogWidColor()" << endl; 100// kdDebug(5300) << "KPrefsDialogWidColor::~KPrefsDialogWidColor()" << endl;
99} 101}
100 102
101void KPrefsDialogWidColor::readConfig() 103void KPrefsDialogWidColor::readConfig()
102{ 104{
103 mButton->setColor(*mReference); 105 mButton->setColor(*mReference);
@@ -363,48 +365,76 @@ void KPrefsDialog::readConfig()
363 } 365 }
364 366
365 usrReadConfig(); 367 usrReadConfig();
366} 368}
367 369
368void KPrefsDialog::writeConfig() 370void KPrefsDialog::writeConfig()
369{ 371{
370// kdDebug(5300) << "KPrefsDialog::writeConfig()" << endl; 372// kdDebug(5300) << "KPrefsDialog::writeConfig()" << endl;
371 373
372 KPrefsDialogWid *wid; 374 KPrefsDialogWid *wid;
373 for(wid = mPrefsWids.first();wid;wid=mPrefsWids.next()) { 375 for(wid = mPrefsWids.first();wid;wid=mPrefsWids.next()) {
374 wid->writeConfig(); 376 wid->writeConfig();
375 } 377 }
376 378
377 usrWriteConfig(); 379 usrWriteConfig();
378 380
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
387void KPrefsDialog::slotApply() 389void KPrefsDialog::slotApply()
388{ 390{
389 writeConfig(); 391 writeConfig();
390 emit configChanged(); 392 emit configChanged();
391} 393}
392 394
393void KPrefsDialog::slotOk() 395void KPrefsDialog::slotOk()
394{ 396{
395 slotApply(); 397 slotApply();
396 QDialog::accept(); 398 QDialog::accept();
397} 399}
398void KPrefsDialog::accept() 400void KPrefsDialog::accept()
399{ 401{
400 slotOk(); 402 slotOk();
401} 403}
402 404
403void KPrefsDialog::slotDefault() 405void 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
414KPimPrefsGlobalDialog::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}
427void KPimPrefsGlobalDialog::showTZconfig()
428{
429 kdelibcfg->showTimeZoneTab() ;
430}
431void KPimPrefsGlobalDialog::usrReadConfig()
432{
433 kdelibcfg->readConfig();
434}
435
436void 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
@@ -397,49 +397,75 @@ class KPrefsDialog : public KDialogBase
397 /** 397 /**
398 Register a @ref KPrefsDialogWidFont object. 398 Register a @ref KPrefsDialogWidFont object.
399 399
400 @param sampleText Sample text of font widget. 400 @param sampleText Sample text of font widget.
401 @param buttonText Button text of font widget. 401 @param buttonText Button text of font widget.
402 @param reference Reference to variable storing the setting. 402 @param reference Reference to variable storing the setting.
403 @param parent Parent widget. 403 @param parent Parent widget.
404 */ 404 */
405 KPrefsDialogWidFont *addWidFont(const QString &sampleText,const QString &buttonText, 405 KPrefsDialogWidFont *addWidFont(const QString &sampleText,const QString &buttonText,
406 QFont *reference,QWidget *parent); 406 QFont *reference,QWidget *parent);
407 407
408 public slots: 408 public slots:
409 /** Set all widgets to default values. */ 409 /** Set all widgets to default values. */
410 void setDefaults(); 410 void setDefaults();
411 411
412 /** Read preferences from config file. */ 412 /** Read preferences from config file. */
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"
447class 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