summaryrefslogtreecommitdiffabout
path: root/libkdepim
authorulf69 <ulf69>2004-09-21 19:50:27 (UTC)
committer ulf69 <ulf69>2004-09-21 19:50:27 (UTC)
commit93313aa8d66c01aa0e4562449020af20b5cef0a7 (patch) (unidiff)
tree7bf9930c58b4651a29b5aa4210742340c9439bc8 /libkdepim
parentc2cce86fdb2d0b291c3d3bdfa9fac47452153d1a (diff)
downloadkdepimpi-93313aa8d66c01aa0e4562449020af20b5cef0a7.zip
kdepimpi-93313aa8d66c01aa0e4562449020af20b5cef0a7.tar.gz
kdepimpi-93313aa8d66c01aa0e4562449020af20b5cef0a7.tar.bz2
added edit elements for global prefs
Diffstat (limited to 'libkdepim') (more/less context) (ignore whitespace changes)
-rw-r--r--libkdepim/kcmconfigs/kcmkdepimconfig.cpp17
-rw-r--r--libkdepim/kcmconfigs/kcmkdepimconfig.h2
-rw-r--r--libkdepim/kcmconfigs/kdepimconfigwidget.cpp313
-rw-r--r--libkdepim/kcmconfigs/kdepimconfigwidget.h45
-rw-r--r--libkdepim/kpimglobalprefs.cpp21
-rw-r--r--libkdepim/kpimglobalprefs.h15
-rw-r--r--libkdepim/kpimprefs.cpp6
-rw-r--r--libkdepim/kpimprefs.h2
-rw-r--r--libkdepim/kprefsdialog.cpp106
-rw-r--r--libkdepim/kprefsdialog.h70
-rw-r--r--libkdepim/libkdepimE.pro2
11 files changed, 410 insertions, 189 deletions
diff --git a/libkdepim/kcmconfigs/kcmkdepimconfig.cpp b/libkdepim/kcmconfigs/kcmkdepimconfig.cpp
index f26efe0..e77c5ab 100644
--- a/libkdepim/kcmconfigs/kcmkdepimconfig.cpp
+++ b/libkdepim/kcmconfigs/kcmkdepimconfig.cpp
@@ -1,79 +1,80 @@
1/* 1/*
2 This file is part of KDEPim/Pi. 2 This file is part of KDEPim/Pi.
3 Copyright (c) 2004 Ulf Schenk 3 Copyright (c) 2004 Ulf Schenk
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/* 24/*
25Enhanced Version of the file for platform independent KDE tools. 25Enhanced Version of the file for platform independent KDE tools.
26Copyright (c) 2004 Ulf Schenk 26Copyright (c) 2004 Ulf Schenk
27 27
28$Id$ 28$Id$
29*/ 29*/
30 30
31 31
32#include <qlayout.h> 32#include <qlayout.h>
33 33
34#include <kdebug.h> 34#include <kdebug.h>
35//#include <klocale.h> 35//#include <klocale.h>
36//#include <stdlib.h> 36//#include <stdlib.h>
37 37
38#include "kdepimconfigwidget.h" 38#include "kdepimconfigwidget.h"
39 39
40#include "kcmkdepimconfig.h" 40#include "kcmkdepimconfig.h"
41#include "kprefs.h" 41#include "kprefs.h"
42#include "kpimglobalprefs.h" 42#include "kpimglobalprefs.h"
43 43
44#ifndef _WIN32_ 44#ifndef _WIN32_
45extern "C" 45extern "C"
46{ 46{
47 KCModule *create_kabconfig( KPimGlobalPrefs* prefs, QWidget *parent, const char * ) { 47 KCModule *create_kabconfig(QWidget *parent, const char * ) {
48 return new KCMKdePimConfig( prefs, parent, "kcmkdepimconfig" ); 48 return new KCMKdePimConfig(parent, "kcmkdepimconfig" );
49 } 49 }
50} 50}
51#endif 51#endif
52 52
53KCMKdePimConfig::KCMKdePimConfig( KPimGlobalPrefs* prefs, QWidget *parent, const char *name ) 53KCMKdePimConfig::KCMKdePimConfig(QWidget *parent, const char *name )
54 : KCModule( prefs, parent, name ) 54 : KCModule( KPimGlobalPrefs::instance(), parent, name )
55{ 55{
56 //abort(); 56 //abort();
57 QVBoxLayout *layout = new QVBoxLayout( this ); 57 QVBoxLayout *layout = new QVBoxLayout( this );
58 mConfigWidget = new KDEPIMConfigWidget( this, "mConfigWidget" ); 58 mConfigWidget = new KDEPIMConfigWidget( (KPimGlobalPrefs*)getPreferences(), this, "KDEPIMConfigWidget" );
59 layout->addWidget( mConfigWidget ); 59 layout->addWidget( mConfigWidget );
60 layout->setSpacing( 0 ); 60 layout->setSpacing( 0 );
61 layout->setMargin( 0 ); 61 layout->setMargin( 0 );
62 62
63 connect( mConfigWidget, SIGNAL( changed( bool ) ), SIGNAL( changed( bool ) ) ); 63 connect( mConfigWidget, SIGNAL( changed( bool ) ), SIGNAL( changed( bool ) ) );
64} 64}
65 65
66void KCMKdePimConfig::load() 66void KCMKdePimConfig::load()
67{ 67{
68 mConfigWidget->restoreSettings((KPimGlobalPrefs*)getPreferences()); 68 mConfigWidget->readConfig();
69} 69}
70 70
71void KCMKdePimConfig::save() 71void KCMKdePimConfig::save()
72{ 72{
73 mConfigWidget->saveSettings((KPimGlobalPrefs*)getPreferences()); 73 mConfigWidget->writeConfig();
74} 74}
75 75
76void KCMKdePimConfig::defaults() 76void KCMKdePimConfig::defaults()
77{ 77{
78 mConfigWidget->defaults((KPimGlobalPrefs*)getPreferences()); 78 qDebug("KCMKdePimConfig::defaults()");
79 mConfigWidget->setDefaults();
79} 80}
diff --git a/libkdepim/kcmconfigs/kcmkdepimconfig.h b/libkdepim/kcmconfigs/kcmkdepimconfig.h
index fa96eda..b471e53 100644
--- a/libkdepim/kcmconfigs/kcmkdepimconfig.h
+++ b/libkdepim/kcmconfigs/kcmkdepimconfig.h
@@ -1,54 +1,54 @@
1/* 1/*
2 This file is part of KdePim/Pi. 2 This file is part of KdePim/Pi.
3 Copyright (c) 2004 Ulf Schenk 3 Copyright (c) 2004 Ulf Schenk
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/* 24/*
25Enhanced Version of the file for platform independent KDE tools. 25Enhanced Version of the file for platform independent KDE tools.
26Copyright (c) 2004 Ulf Schenk 26Copyright (c) 2004 Ulf Schenk
27 27
28$Id$ 28$Id$
29*/ 29*/
30 30
31#ifndef KCMKDEPIMCONFIG_H 31#ifndef KCMKDEPIMCONFIG_H
32#define KCMKDEPIMCONFIG_H 32#define KCMKDEPIMCONFIG_H
33 33
34#include <kcmodule.h> 34#include <kcmodule.h>
35 35
36class KDEPIMConfigWidget; 36class KDEPIMConfigWidget;
37class KPimGlobalPrefs; 37class KPimGlobalPrefs;
38 38
39class KCMKdePimConfig : public KCModule 39class KCMKdePimConfig : public KCModule
40{ 40{
41 Q_OBJECT 41 Q_OBJECT
42 42
43 public: 43 public:
44 KCMKdePimConfig( KPimGlobalPrefs* prefs, QWidget *parent = 0, const char *name = 0 ); 44 KCMKdePimConfig( QWidget *parent = 0, const char *name = 0 );
45 45
46 virtual void load(); 46 virtual void load();
47 virtual void save(); 47 virtual void save();
48 virtual void defaults(); 48 virtual void defaults();
49 49
50 private: 50 private:
51 KDEPIMConfigWidget *mConfigWidget; 51 KDEPIMConfigWidget *mConfigWidget;
52}; 52};
53 53
54#endif 54#endif
diff --git a/libkdepim/kcmconfigs/kdepimconfigwidget.cpp b/libkdepim/kcmconfigs/kdepimconfigwidget.cpp
index 703aeb1..00a07d9 100644
--- a/libkdepim/kcmconfigs/kdepimconfigwidget.cpp
+++ b/libkdepim/kcmconfigs/kdepimconfigwidget.cpp
@@ -1,279 +1,458 @@
1/* 1/*
2 This file is part of KdePim/Pi. 2 This file is part of KdePim/Pi.
3 Copyright (c) 2004 Ulf Schenk 3 Copyright (c) 2004 Ulf Schenk
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/* 24/*
25Enhanced Version of the file for platform independent KDE tools. 25Enhanced Version of the file for platform independent KDE tools.
26Copyright (c) 2004 Ulf Schenk 26Copyright (c) 2004 Ulf Schenk
27 27
28$Id$ 28$Id$
29*/ 29*/
30 30
31#include <qlayout.h> 31#include <qlayout.h>
32#include <qtabwidget.h> 32#include <qtabwidget.h>
33#include <qcombobox.h> 33#include <qcombobox.h>
34#include <qgroupbox.h> 34#include <qgroupbox.h>
35#include <qlabel.h> 35#include <qlabel.h>
36#include <qlineedit.h> 36#include <qlineedit.h>
37#include <qbuttongroup.h>
37#include <qfile.h> 38#include <qfile.h>
38 39
39#include <kdialog.h> 40#include <kdialog.h>
40#include <klocale.h> 41#include <klocale.h>
41 42#include <kdateedit.h>
43#include <kglobal.h>
42#include <stdlib.h> 44#include <stdlib.h>
43 45
44/*US 46/*US
45#include <qcheckbox.h> 47#include <qcheckbox.h>
46#include <qframe.h> 48#include <qframe.h>
47#include <qpushbutton.h> 49#include <qpushbutton.h>
48#include <qcombobox.h> 50#include <qcombobox.h>
49#include <qlineedit.h> 51#include <qlineedit.h>
50#include <qlabel.h> 52#include <qlabel.h>
51#include <qfile.h> 53#include <qfile.h>
52 54
53#include <kconfig.h> 55#include <kconfig.h>
54#include <kdebug.h> 56#include <kdebug.h>
55#include <kdialog.h> 57#include <kdialog.h>
56#include <klistview.h> 58#include <klistview.h>
57#include <klocale.h> 59#include <klocale.h>
58#include <kglobal.h> 60#include <kglobal.h>
59#include <kmessagebox.h> 61#include <kmessagebox.h>
60#include <kstandarddirs.h> 62#include <kstandarddirs.h>
61 63
62#ifndef KAB_EMBEDDED 64#ifndef KAB_EMBEDDED
63#include <ktrader.h> 65#include <ktrader.h>
64#else // KAB_EMBEDDED 66#else // KAB_EMBEDDED
65#include <mergewidget.h> 67#include <mergewidget.h>
66#include <distributionlistwidget.h> 68#include <distributionlistwidget.h>
67#endif // KAB_EMBEDDED 69#endif // KAB_EMBEDDED
68 70
69#include "addresseewidget.h" 71#include "addresseewidget.h"
70#include "extensionconfigdialog.h" 72#include "extensionconfigdialog.h"
71#include "extensionwidget.h" 73#include "extensionwidget.h"
72*/ 74*/
73 75
76#include "qapplication.h"
77
74#include "kpimglobalprefs.h" 78#include "kpimglobalprefs.h"
75 79
76#include "kdepimconfigwidget.h" 80#include "kdepimconfigwidget.h"
77 81
78 82
79KDEPIMConfigWidget::KDEPIMConfigWidget( QWidget *parent, const char *name ) 83KDEPIMConfigWidget::KDEPIMConfigWidget(KPimGlobalPrefs *prefs, QWidget *parent, const char *name )
80 : QWidget( parent, name ) 84 : KPrefsWidget(prefs, parent, name )
81{ 85{
82 mExternalAppsMap.insert(ExternalAppHandler::EMAIL, i18n("Email")); 86 mExternalAppsMap.insert(ExternalAppHandler::EMAIL, i18n("Email"));
83 mExternalAppsMap.insert(ExternalAppHandler::PHONE, i18n("Phone")); 87 mExternalAppsMap.insert(ExternalAppHandler::PHONE, i18n("Phone"));
84 mExternalAppsMap.insert(ExternalAppHandler::SMS, i18n("SMS")); 88 mExternalAppsMap.insert(ExternalAppHandler::SMS, i18n("SMS"));
85 mExternalAppsMap.insert(ExternalAppHandler::FAX, i18n("Fax")); 89 mExternalAppsMap.insert(ExternalAppHandler::FAX, i18n("Fax"));
86 mExternalAppsMap.insert(ExternalAppHandler::PAGER, i18n("Pager")); 90 mExternalAppsMap.insert(ExternalAppHandler::PAGER, i18n("Pager"));
87 mExternalAppsMap.insert(ExternalAppHandler::SIP, i18n("SIP")); 91 mExternalAppsMap.insert(ExternalAppHandler::SIP, i18n("SIP"));
88 92
89 93
90 QVBoxLayout *topLayout = new QVBoxLayout( this, 0, 94 QVBoxLayout *topLayout = new QVBoxLayout( this, 0,
91 KDialog::spacingHint() ); 95 KDialog::spacingHint() );
92 96
93 QTabWidget *tabWidget = new QTabWidget( this ); 97 tabWidget = new QTabWidget( this );
94 topLayout->addWidget( tabWidget ); 98 topLayout->addWidget( tabWidget );
95 99
96 100
101 setupLocaleTab();
102 setupLocaleDateTab();
103 setupTimeZoneTab();
104 setupExternalAppTab();
105
106}
97 107
98 // mailclient page 108void KDEPIMConfigWidget::setupExternalAppTab()
109{
99 QWidget *externalAppsPage = new QWidget( this ); 110 QWidget *externalAppsPage = new QWidget( this );
100 QVBoxLayout* layout = new QVBoxLayout( externalAppsPage, KDialog::marginHintSmall(), 111 QVBoxLayout* layout = new QVBoxLayout( externalAppsPage, KDialog::marginHintSmall(),
101 KDialog::spacingHintSmall() ); 112 KDialog::spacingHintSmall() );
102 113
103 mExternalApps = new QComboBox( externalAppsPage ); 114 mExternalApps = new QComboBox( externalAppsPage );
104 115
105 QMap<ExternalAppHandler::Types, QString>::Iterator it; 116 QMap<ExternalAppHandler::Types, QString>::Iterator it;
106 for( it = mExternalAppsMap.begin(); it != mExternalAppsMap.end(); ++it ) 117 for( it = mExternalAppsMap.begin(); it != mExternalAppsMap.end(); ++it )
107 mExternalApps->insertItem( it.data(), it.key() ); 118 mExternalApps->insertItem( it.data(), it.key() );
108 119
109 layout->addWidget( mExternalApps ); 120 layout->addWidget( mExternalApps );
110 121
111 connect( mExternalApps, SIGNAL( activated( int ) ), 122 connect( mExternalApps, SIGNAL( activated( int ) ),
112 this, SLOT (externalapp_changed( int ) ) ); 123 this, SLOT (externalapp_changed( int ) ) );
113 124
114 125
115
116
117 mExternalAppGroupBox = new QGroupBox( 0, Qt::Vertical, i18n( "Used Mail Client" ), externalAppsPage ); 126 mExternalAppGroupBox = new QGroupBox( 0, Qt::Vertical, i18n( "Used Mail Client" ), externalAppsPage );
118 QGridLayout *boxLayout = new QGridLayout( mExternalAppGroupBox->layout(), 4, 2, -1, "gridlayout" ); 127 QGridLayout *boxLayout = new QGridLayout( mExternalAppGroupBox->layout(), 4, 2, -1, "gridlayout" );
119 128
120 129
121 mClient = new QComboBox( mExternalAppGroupBox ); 130 mClient = new QComboBox( mExternalAppGroupBox );
122 boxLayout->addMultiCellWidget( mClient, 0, 0, 0, 1 ); 131 boxLayout->addMultiCellWidget( mClient, 0, 0, 0, 1 );
123 132
124 connect( mClient, SIGNAL( activated( int ) ), 133 connect( mClient, SIGNAL( activated( int ) ),
125 this, SLOT (client_changed( int ) ) ); 134 this, SLOT (client_changed( int ) ) );
126 135
127 QLabel* lab = new QLabel( i18n("Channel:"), mExternalAppGroupBox); 136 QLabel* lab = new QLabel( i18n("Channel:"), mExternalAppGroupBox);
128 boxLayout->addWidget( lab, 1, 0 ); 137 boxLayout->addWidget( lab, 1, 0 );
129 mChannel = new QLineEdit(mExternalAppGroupBox); 138 mChannel = new QLineEdit(mExternalAppGroupBox);
130 mChannel->setReadOnly(true); 139 mChannel->setReadOnly(true);
131 boxLayout->addMultiCellWidget( mChannel, 2 , 2, 0, 1 ); 140 boxLayout->addMultiCellWidget( mChannel, 2 , 2, 0, 1 );
132 141
133 lab = new QLabel( i18n("Message:"), mExternalAppGroupBox); 142 lab = new QLabel( i18n("Message:"), mExternalAppGroupBox);
134 boxLayout->addWidget( lab, 3, 0 ); 143 boxLayout->addWidget( lab, 3, 0 );
135 mMessage = new QLineEdit(mExternalAppGroupBox); 144 mMessage = new QLineEdit(mExternalAppGroupBox);
136 mMessage->setReadOnly(true); 145 mMessage->setReadOnly(true);
137 boxLayout->addWidget( mMessage , 4, 0); 146 boxLayout->addWidget( mMessage , 4, 0);
138 147
139 lab = new QLabel( i18n("Parameters:"), mExternalAppGroupBox); 148 lab = new QLabel( i18n("Parameters:"), mExternalAppGroupBox);
140 boxLayout->addWidget( lab, 3, 1 ); 149 boxLayout->addWidget( lab, 3, 1 );
141 mParameters = new QLineEdit(mExternalAppGroupBox); 150 mParameters = new QLineEdit(mExternalAppGroupBox);
142 mParameters->setReadOnly(true); 151 mParameters->setReadOnly(true);
143 boxLayout->addWidget( mParameters, 4, 1 ); 152 boxLayout->addWidget( mParameters, 4, 1 );
144 153
145 lab = new QLabel( i18n("HINT: Delimiter=; Name=%1,Email=%2"), mExternalAppGroupBox); 154 lab = new QLabel( i18n("HINT: Delimiter=; Name=%1,Email=%2"), mExternalAppGroupBox);
146 boxLayout->addMultiCellWidget( lab, 5, 5, 0, 1 ); 155 boxLayout->addMultiCellWidget( lab, 5, 5, 0, 1 );
147 156
148 lab = new QLabel( i18n("extra Message:"), mExternalAppGroupBox); 157 lab = new QLabel( i18n("extra Message:"), mExternalAppGroupBox);
149 boxLayout->addWidget( lab, 6, 0 ); 158 boxLayout->addWidget( lab, 6, 0 );
150 mMessage2 = new QLineEdit(mExternalAppGroupBox); 159 mMessage2 = new QLineEdit(mExternalAppGroupBox);
151 mMessage2->setReadOnly(true); 160 mMessage2->setReadOnly(true);
152 boxLayout->addWidget( mMessage2 , 7, 0); 161 boxLayout->addWidget( mMessage2 , 7, 0);
153 162
154 lab = new QLabel( i18n("extra Parameters:"), mExternalAppGroupBox); 163 lab = new QLabel( i18n("extra Parameters:"), mExternalAppGroupBox);
155 boxLayout->addWidget( lab, 6, 1 ); 164 boxLayout->addWidget( lab, 6, 1 );
156 mParameters2 = new QLineEdit(mExternalAppGroupBox); 165 mParameters2 = new QLineEdit(mExternalAppGroupBox);
157 mParameters2->setReadOnly(true); 166 mParameters2->setReadOnly(true);
158 boxLayout->addWidget( mParameters2, 7, 1 ); 167 boxLayout->addWidget( mParameters2, 7, 1 );
159 168
160 lab = new QLabel( i18n("HINT: Emails=%1,Attachments=%2"), mExternalAppGroupBox); 169 lab = new QLabel( i18n("HINT: Emails=%1,Attachments=%2"), mExternalAppGroupBox);
161 boxLayout->addMultiCellWidget( lab, 8, 8, 0, 1 ); 170 boxLayout->addMultiCellWidget( lab, 8, 8, 0, 1 );
162 171
163 172
164 connect( mChannel, SIGNAL( textChanged ( const QString & )), this, SLOT( textChanged ( const QString & )) ); 173 connect( mChannel, SIGNAL( textChanged ( const QString & )), this, SLOT( textChanged ( const QString & )) );
165 connect( mMessage, SIGNAL( textChanged ( const QString & )), this, SLOT( textChanged ( const QString & )) ); 174 connect( mMessage, SIGNAL( textChanged ( const QString & )), this, SLOT( textChanged ( const QString & )) );
166 connect( mParameters, SIGNAL( textChanged ( const QString & )), this, SLOT( textChanged ( const QString & )) ); 175 connect( mParameters, SIGNAL( textChanged ( const QString & )), this, SLOT( textChanged ( const QString & )) );
167 connect( mMessage2, SIGNAL( textChanged ( const QString & )), this, SLOT( textChanged ( const QString & )) ); 176 connect( mMessage2, SIGNAL( textChanged ( const QString & )), this, SLOT( textChanged ( const QString & )) );
168 connect( mParameters2, SIGNAL( textChanged ( const QString & )), this, SLOT( textChanged ( const QString & )) ); 177 connect( mParameters2, SIGNAL( textChanged ( const QString & )), this, SLOT( textChanged ( const QString & )) );
169 178
170 179
171
172 layout->addWidget( mExternalAppGroupBox ); 180 layout->addWidget( mExternalAppGroupBox );
173 tabWidget->addTab( externalAppsPage, i18n( "External Apps." ) ); 181 tabWidget->addTab( externalAppsPage, i18n( "External Apps." ) );
174 182
175} 183}
176 184
185
186void KDEPIMConfigWidget::setupLocaleDateTab()
187{
188 QWidget *topFrame = new QWidget( this );
189 QGridLayout *topLayout = new QGridLayout( topFrame, 3, 2);
190
191 topLayout->setSpacing(KDialog::spacingHint());
192 topLayout->setMargin(KDialog::marginHint());
193 int iii = 0;
194
195
196 KPrefsWidRadios *syncPrefsGroup =
197 addWidRadios(i18n("Date Format:"),&(KPimGlobalPrefs::instance()->mPreferredDate),topFrame);
198 QString format;
199 if ( QApplication::desktop()->width() < 480 )
200 format = "(%d.%m.%Y)";
201 else
202 format = "(%d.%m.%Y|%A %d %B %Y)";
203 syncPrefsGroup->addRadio(i18n("24.03.2004 "+format));
204 if ( QApplication::desktop()->width() < 480 )
205 format = "(%m.%d.%Y)";
206 else
207 format = "(%m.%d.%Y|%A %B %d %Y)";
208 syncPrefsGroup->addRadio(i18n("03.24.2004 "+format));
209 if ( QApplication::desktop()->width() < 480 )
210 format = "(%Y-%m-%d)";
211 else
212 format = "(%Y-%m-%d|%A %Y %B %d)";
213 syncPrefsGroup->addRadio(i18n("2004-03-24 "+format));
214 syncPrefsGroup->addRadio(i18n("User defined"));
215 topLayout->addMultiCellWidget( (QWidget*)syncPrefsGroup->groupBox(),iii,iii,0,1);
216 ++iii;
217 ++iii;
218 QLabel * lab;
219 mUserDateFormatLong = new QLineEdit(topFrame);
220 lab = new QLabel(mUserDateFormatLong, i18n("User long date:"), topFrame);
221 topLayout->addWidget(lab ,iii,0);
222 topLayout->addWidget(mUserDateFormatLong,iii,1);
223 ++iii;
224 mUserDateFormatShort = new QLineEdit(topFrame);
225 lab = new QLabel(mUserDateFormatShort, i18n("User short date:"), topFrame);
226 topLayout->addWidget(lab ,iii,0);
227 topLayout->addWidget(mUserDateFormatShort,iii,1);
228 ++iii;
229 lab = new QLabel( i18n("Monday 19 April 2004: %A %d %B %Y"), topFrame);
230 topLayout->addMultiCellWidget(lab ,iii,iii,0,1);
231 ++iii;
232 lab = new QLabel( i18n("Mon 19.04.04: %a %d.%m.%y"), topFrame);
233 topLayout->addMultiCellWidget(lab ,iii,iii,0,1);
234 ++iii;
235 lab = new QLabel( i18n("Mon, 19.Apr.04: %a, %d.%b.%y"), topFrame);
236 topLayout->addMultiCellWidget(lab ,iii,iii,0,1);
237 ++iii;
238
239 connect( mUserDateFormatLong, SIGNAL( textChanged ( const QString & )), this, SLOT( textChanged ( const QString & )) );
240 connect( mUserDateFormatShort, SIGNAL( textChanged ( const QString & )), this, SLOT( textChanged ( const QString & )) );
241
242
243 tabWidget->addTab( topFrame, i18n( "Date Format" ) );
244}
245
246void KDEPIMConfigWidget::setupLocaleTab()
247{
248
249 QWidget *topFrame = new QWidget( this );
250 QGridLayout *topLayout = new QGridLayout(topFrame,4,2);
251
252 topLayout->setSpacing(KDialog::spacingHint());
253 topLayout->setMargin(KDialog::marginHint());
254 int iii = 0;
255 KPrefsWidRadios *syncPrefsGroup =
256 addWidRadios(i18n("Language:(needs restart)"),&(KPimGlobalPrefs::instance()->mPreferredLanguage),topFrame);
257 syncPrefsGroup->addRadio(i18n("English"));
258 syncPrefsGroup->addRadio(i18n("German"));
259 syncPrefsGroup->addRadio(i18n("French"));
260 syncPrefsGroup->addRadio(i18n("User defined (usertranslation.txt)"));
261 if ( QApplication::desktop()->width() < 300 )
262 ;// syncPrefsGroup->groupBox()-> setOrientation (Qt::Vertical);
263 topLayout->addMultiCellWidget( (QWidget*)syncPrefsGroup->groupBox(),iii,iii,0,1);
264 ++iii;
265
266 syncPrefsGroup =
267 addWidRadios(i18n("Time Format(nr):"),&(KPimGlobalPrefs::instance()->mPreferredTime),topFrame);
268 if ( QApplication::desktop()->width() > 300 )
269 syncPrefsGroup->groupBox()->setOrientation (Qt::Vertical);
270 syncPrefsGroup->addRadio(i18n("24:00"));
271 syncPrefsGroup->addRadio(i18n("12:00am"));
272 syncPrefsGroup->groupBox()->setOrientation (Qt::Vertical);
273 topLayout->addMultiCellWidget( syncPrefsGroup->groupBox(),iii,iii,0,1);
274 ++iii;
275
276 KPrefsWidBool *sb = addWidBool(i18n("Week starts on Sunday"),
277 &(KPimGlobalPrefs::instance()->mWeekStartsOnSunday),topFrame);
278 topLayout->addMultiCellWidget((QWidget*)sb->checkBox(), iii,iii,0,1);
279 ++iii;
280
281
282 tabWidget->addTab( topFrame, i18n( "Locale" ) );
283
284}
285
286
287void KDEPIMConfigWidget::setupTimeZoneTab()
288{
289 QWidget *topFrame = new QWidget( this );
290 QGridLayout *topLayout = new QGridLayout( topFrame, 5, 2);
291 topLayout->setSpacing(KDialog::spacingHint());
292 topLayout->setMargin(KDialog::marginHint());
293
294 QHBox *timeZoneBox = new QHBox( topFrame );
295 topLayout->addMultiCellWidget( timeZoneBox, 0, 0, 0, 1 );
296
297 new QLabel( i18n("Timezone:"), timeZoneBox );
298 mTimeZoneCombo = new QComboBox( timeZoneBox );
299 if ( QApplication::desktop()->width() < 300 ) {
300 mTimeZoneCombo->setMaximumWidth(150);
301 }
302
303 QStringList list;
304 list = KGlobal::locale()->timeZoneList();
305 mTimeZoneCombo->insertStringList(list);
306
307 // find the currently set time zone and select it
308 QString sCurrentlySet = KPimGlobalPrefs::instance()->mTimeZoneId;
309 int nCurrentlySet = 11;
310 for (int i = 0; i < mTimeZoneCombo->count(); i++)
311 {
312 if (mTimeZoneCombo->text(i) == sCurrentlySet)
313 {
314 nCurrentlySet = i;
315 break;
316 }
317 }
318 mTimeZoneCombo->setCurrentItem(nCurrentlySet);
319 int iii = 1;
320 KPrefsWidBool *sb =
321 addWidBool(i18n("Timezone has daylight saving"),
322 &(KPimGlobalPrefs::instance()->mUseDaylightsaving),topFrame);
323 topLayout->addMultiCellWidget((QWidget*)sb->checkBox(), iii,iii,0,1);
324 ++iii;
325 QLabel* lab = new QLabel( i18n("Actual start and end is the\nsunday before this date."), topFrame );
326 topLayout->addMultiCellWidget(lab, iii,iii,0,1);
327 ++iii;
328 lab = new QLabel( i18n("The year in the date is ignored."), topFrame );
329 topLayout->addMultiCellWidget(lab, iii,iii,0,1);
330 ++iii;
331 lab = new QLabel( i18n("Daylight start:"), topFrame );
332 topLayout->addWidget(lab, iii,0);
333 mStartDateSavingEdit = new KDateEdit(topFrame);
334 topLayout->addWidget(mStartDateSavingEdit, iii,1);
335 ++iii;
336
337 lab = new QLabel( i18n("Daylight end:"), topFrame );
338 topLayout->addWidget(lab, iii,0);
339 mEndDateSavingEdit = new KDateEdit(topFrame);
340 topLayout->addWidget(mEndDateSavingEdit, iii,1);
341 ++iii;
342 QDate current ( 2001, 1,1);
343 mStartDateSavingEdit->setDate(current.addDays(KPimGlobalPrefs::instance()->mDaylightsavingStart-1));
344 mEndDateSavingEdit->setDate(current.addDays(KPimGlobalPrefs::instance()->mDaylightsavingEnd-1));
345
346 connect( mStartDateSavingEdit, SIGNAL( dateChanged(QDate)), this, SLOT( modified()) );
347 connect( mEndDateSavingEdit, SIGNAL( dateChanged(QDate)), this, SLOT( modified()) );
348 connect( mTimeZoneCombo, SIGNAL( activated( int ) ), this, SLOT (modified() ) );
349
350
351
352 tabWidget->addTab( topFrame, i18n( "Time Zone" ) );
353
354}
355
177void KDEPIMConfigWidget::externalapp_changed( int newApp ) 356void KDEPIMConfigWidget::externalapp_changed( int newApp )
178{ 357{
179 // first store the current data 358 // first store the current data
180 saveEditFieldSettings(); 359 saveEditFieldSettings();
181 360
182 // set mCurrentApp 361 // set mCurrentApp
183 mCurrentApp = (ExternalAppHandler::Types)newApp; 362 mCurrentApp = (ExternalAppHandler::Types)newApp;
184 363
185 // set mCurrentClient 364 // set mCurrentClient
186 switch(mCurrentApp) 365 switch(mCurrentApp)
187 { 366 {
188 case(ExternalAppHandler::EMAIL): 367 case(ExternalAppHandler::EMAIL):
189 mCurrentClient = mEmailClient; 368 mCurrentClient = mEmailClient;
190 break; 369 break;
191 case(ExternalAppHandler::PHONE): 370 case(ExternalAppHandler::PHONE):
192 mCurrentClient = mPhoneClient; 371 mCurrentClient = mPhoneClient;
193 break; 372 break;
194 case(ExternalAppHandler::SMS): 373 case(ExternalAppHandler::SMS):
195 mCurrentClient = mSMSClient; 374 mCurrentClient = mSMSClient;
196 break; 375 break;
197 case(ExternalAppHandler::FAX): 376 case(ExternalAppHandler::FAX):
198 mCurrentClient = mFaxClient; 377 mCurrentClient = mFaxClient;
199 break; 378 break;
200 case(ExternalAppHandler::PAGER): 379 case(ExternalAppHandler::PAGER):
201 mCurrentClient = mPagerClient; 380 mCurrentClient = mPagerClient;
202 break; 381 break;
203 case(ExternalAppHandler::SIP): 382 case(ExternalAppHandler::SIP):
204 mCurrentClient = mSipClient; 383 mCurrentClient = mSipClient;
205 break; 384 break;
206 default: 385 default:
207 return; 386 return;
208 } 387 }
209 388
210 // and at last update the widgets 389 // and at last update the widgets
211 updateClientWidgets(); 390 updateClientWidgets();
212} 391}
213 392
214 393
215 394
216void KDEPIMConfigWidget::client_changed( int newClient ) 395void KDEPIMConfigWidget::client_changed( int newClient )
217{ 396{
218 if (newClient == mCurrentClient) 397 if (newClient == mCurrentClient)
219 return; 398 return;
220 399
221 // first store the current data 400 // first store the current data
222 saveEditFieldSettings(); 401 saveEditFieldSettings();
223 402
224 403
225 //then reset the clientvariable 404 //then reset the clientvariable
226 mCurrentClient = newClient; 405 mCurrentClient = newClient;
227 406
228 // and at last update the widgets 407 // and at last update the widgets
229 updateClientWidgets(); 408 updateClientWidgets();
230 409
231 modified(); 410 KPrefsWidget::modified();
232} 411}
233 412
234void KDEPIMConfigWidget::saveEditFieldSettings() 413void KDEPIMConfigWidget::saveEditFieldSettings()
235{ 414{
236 415
237 switch(mCurrentApp) 416 switch(mCurrentApp)
238 { 417 {
239 case(ExternalAppHandler::EMAIL): 418 case(ExternalAppHandler::EMAIL):
240 mEmailClient = mClient->currentItem(); 419 mEmailClient = mClient->currentItem();
241 break; 420 break;
242 case(ExternalAppHandler::PHONE): 421 case(ExternalAppHandler::PHONE):
243 mPhoneClient= mClient->currentItem(); 422 mPhoneClient= mClient->currentItem();
244 break; 423 break;
245 case(ExternalAppHandler::SMS): 424 case(ExternalAppHandler::SMS):
246 mSMSClient = mClient->currentItem(); 425 mSMSClient = mClient->currentItem();
247 break; 426 break;
248 case(ExternalAppHandler::FAX): 427 case(ExternalAppHandler::FAX):
249 mFaxClient = mClient->currentItem(); 428 mFaxClient = mClient->currentItem();
250 break; 429 break;
251 case(ExternalAppHandler::PAGER): 430 case(ExternalAppHandler::PAGER):
252 mPagerClient = mClient->currentItem(); 431 mPagerClient = mClient->currentItem();
253 break; 432 break;
254 case(ExternalAppHandler::SIP): 433 case(ExternalAppHandler::SIP):
255 mSipClient = mClient->currentItem(); 434 mSipClient = mClient->currentItem();
256 break; 435 break;
257 default: 436 default:
258 return; 437 return;
259 } 438 }
260 439
261 //store the current data back to the apropriate membervariables if we had set it to "other" 440 //store the current data back to the apropriate membervariables if we had set it to "other"
262 if ((mCurrentApp == ExternalAppHandler::EMAIL) && (mCurrentClient == KPimGlobalPrefs::OTHER_EMC)) 441 if ((mCurrentApp == ExternalAppHandler::EMAIL) && (mCurrentClient == KPimGlobalPrefs::OTHER_EMC))
263 { 442 {
264 mEmailOtherChannel = mChannel->text(); 443 mEmailOtherChannel = mChannel->text();
265 mEmailOtherMessage = mMessage->text(); 444 mEmailOtherMessage = mMessage->text();
266 mEmailOtherMessageParameters = mParameters->text(); 445 mEmailOtherMessageParameters = mParameters->text();
267 mEmailOtherMessage2 = mMessage2->text(); 446 mEmailOtherMessage2 = mMessage2->text();
268 mEmailOtherMessageParameters2 = mParameters2->text(); 447 mEmailOtherMessageParameters2 = mParameters2->text();
269 } 448 }
270 else if ((mCurrentApp == ExternalAppHandler::PHONE) && (mCurrentClient == KPimGlobalPrefs::OTHER_PHC)) 449 else if ((mCurrentApp == ExternalAppHandler::PHONE) && (mCurrentClient == KPimGlobalPrefs::OTHER_PHC))
271 { 450 {
272 mPhoneOtherChannel = mChannel->text(); 451 mPhoneOtherChannel = mChannel->text();
273 mPhoneOtherMessage = mMessage->text(); 452 mPhoneOtherMessage = mMessage->text();
274 mPhoneOtherMessageParameters = mParameters->text(); 453 mPhoneOtherMessageParameters = mParameters->text();
275 } 454 }
276 else if ((mCurrentApp == ExternalAppHandler::SMS) && (mCurrentClient == KPimGlobalPrefs::OTHER_SMC)) 455 else if ((mCurrentApp == ExternalAppHandler::SMS) && (mCurrentClient == KPimGlobalPrefs::OTHER_SMC))
277 { 456 {
278 mSMSOtherChannel = mChannel->text(); 457 mSMSOtherChannel = mChannel->text();
279 mSMSOtherMessage = mMessage->text(); 458 mSMSOtherMessage = mMessage->text();
@@ -399,206 +578,194 @@ void KDEPIMConfigWidget::updateClientWidgets()
399 ||((mCurrentApp == ExternalAppHandler::PAGER) && (mCurrentClient == KPimGlobalPrefs::NONE_PAC)) 578 ||((mCurrentApp == ExternalAppHandler::PAGER) && (mCurrentClient == KPimGlobalPrefs::NONE_PAC))
400 ||((mCurrentApp == ExternalAppHandler::SIP) && (mCurrentClient == KPimGlobalPrefs::NONE_SIC))) 579 ||((mCurrentApp == ExternalAppHandler::SIP) && (mCurrentClient == KPimGlobalPrefs::NONE_SIC)))
401 { 580 {
402 enabled = false; 581 enabled = false;
403 } 582 }
404 else 583 else
405 { 584 {
406 enabled = true; 585 enabled = true;
407 } 586 }
408 587
409 588
410 mChannel->setReadOnly(readonly); 589 mChannel->setReadOnly(readonly);
411 mMessage->setReadOnly(readonly); 590 mMessage->setReadOnly(readonly);
412 mParameters->setReadOnly(readonly); 591 mParameters->setReadOnly(readonly);
413 mMessage2->setReadOnly(readonly); 592 mMessage2->setReadOnly(readonly);
414 mParameters2->setReadOnly(readonly); 593 mParameters2->setReadOnly(readonly);
415 594
416 mChannel->setEnabled(enabled); 595 mChannel->setEnabled(enabled);
417 mMessage->setEnabled(enabled); 596 mMessage->setEnabled(enabled);
418 mParameters->setEnabled(enabled); 597 mParameters->setEnabled(enabled);
419 mMessage2->setEnabled(enabled); 598 mMessage2->setEnabled(enabled);
420 mParameters2->setEnabled(enabled); 599 mParameters2->setEnabled(enabled);
421 600
422 601
423 602
424 mClient->setCurrentItem(mCurrentClient); 603 mClient->setCurrentItem(mCurrentClient);
425 604
426 605
427 // enable/disable the extra message/parameter field 606 // enable/disable the extra message/parameter field
428 if (mCurrentApp == ExternalAppHandler::EMAIL) 607 if (mCurrentApp == ExternalAppHandler::EMAIL)
429 { 608 {
430 } 609 }
431 else 610 else
432 { 611 {
433 mMessage2->setText( "" ); 612 mMessage2->setText( "" );
434 mParameters2->setText( "" ); 613 mParameters2->setText( "" );
435 } 614 }
436 615
437 if (enabled == true) { 616 if (enabled == true) {
438 mMessage2->setEnabled(mCurrentApp == ExternalAppHandler::EMAIL); 617 mMessage2->setEnabled(mCurrentApp == ExternalAppHandler::EMAIL);
439 mParameters2->setEnabled(mCurrentApp == ExternalAppHandler::EMAIL); 618 mParameters2->setEnabled(mCurrentApp == ExternalAppHandler::EMAIL);
440 } 619 }
441 620
442 621
443 blockSignals( blocked ); 622 blockSignals( blocked );
444 623
445} 624}
446 625
447 626void KDEPIMConfigWidget::usrReadConfig()
448
449
450void KDEPIMConfigWidget::restoreSettings(KPimGlobalPrefs* prefs)
451{ 627{
628 KPimGlobalPrefs* prefs = KPimGlobalPrefs::instance();
629
452 bool blocked = signalsBlocked(); 630 bool blocked = signalsBlocked();
453 blockSignals( true ); 631 blockSignals( true );
454 632
633 QString dummy = prefs->mUserDateFormatLong;
634 mUserDateFormatLong->setText(dummy.replace( QRegExp("K"), QString(",") ));
635 dummy = prefs->mUserDateFormatShort;
636 mUserDateFormatShort->setText(dummy.replace( QRegExp("K"), QString(",") ));
637
638 QDate current ( 2001, 1,1);
639 mStartDateSavingEdit->setDate(current.addDays(prefs->mDaylightsavingStart-1));
640 mEndDateSavingEdit->setDate(current.addDays(prefs->mDaylightsavingEnd-1));
641 setCombo(mTimeZoneCombo,i18n(prefs->mTimeZoneId));
642
643
644
645
455 mEmailClient = prefs->mEmailClient; 646 mEmailClient = prefs->mEmailClient;
456 mEmailOtherChannel = prefs->mEmailOtherChannel; 647 mEmailOtherChannel = prefs->mEmailOtherChannel;
457 mEmailOtherMessage = prefs->mEmailOtherMessage; 648 mEmailOtherMessage = prefs->mEmailOtherMessage;
458 mEmailOtherMessageParameters = prefs->mEmailOtherMessageParameters; 649 mEmailOtherMessageParameters = prefs->mEmailOtherMessageParameters;
459 mEmailOtherMessage2 = prefs->mEmailOtherMessage2; 650 mEmailOtherMessage2 = prefs->mEmailOtherMessage2;
460 mEmailOtherMessageParameters2 = prefs->mEmailOtherMessageParameters2; 651 mEmailOtherMessageParameters2 = prefs->mEmailOtherMessageParameters2;
461 652
462 mPhoneClient = prefs->mPhoneClient; 653 mPhoneClient = prefs->mPhoneClient;
463 mPhoneOtherChannel = prefs->mPhoneOtherChannel; 654 mPhoneOtherChannel = prefs->mPhoneOtherChannel;
464 mPhoneOtherMessage = prefs->mPhoneOtherMessage; 655 mPhoneOtherMessage = prefs->mPhoneOtherMessage;
465 mPhoneOtherMessageParameters = prefs->mPhoneOtherMessageParameters; 656 mPhoneOtherMessageParameters = prefs->mPhoneOtherMessageParameters;
466 657
467 mFaxClient = prefs->mFaxClient; 658 mFaxClient = prefs->mFaxClient;
468 mFaxOtherChannel = prefs->mFaxOtherChannel; 659 mFaxOtherChannel = prefs->mFaxOtherChannel;
469 mFaxOtherMessage = prefs->mFaxOtherMessage; 660 mFaxOtherMessage = prefs->mFaxOtherMessage;
470 mFaxOtherMessageParameters = prefs->mFaxOtherMessageParameters; 661 mFaxOtherMessageParameters = prefs->mFaxOtherMessageParameters;
471 662
472 mSMSClient = prefs->mSMSClient; 663 mSMSClient = prefs->mSMSClient;
473 mSMSOtherChannel = prefs->mSMSOtherChannel; 664 mSMSOtherChannel = prefs->mSMSOtherChannel;
474 mSMSOtherMessage = prefs->mSMSOtherMessage; 665 mSMSOtherMessage = prefs->mSMSOtherMessage;
475 mSMSOtherMessageParameters = prefs->mSMSOtherMessageParameters; 666 mSMSOtherMessageParameters = prefs->mSMSOtherMessageParameters;
476 667
477 mPagerClient = prefs->mPagerClient; 668 mPagerClient = prefs->mPagerClient;
478 mPagerOtherChannel = prefs->mPagerOtherChannel; 669 mPagerOtherChannel = prefs->mPagerOtherChannel;
479 mPagerOtherMessage = prefs->mPagerOtherMessage; 670 mPagerOtherMessage = prefs->mPagerOtherMessage;
480 mPagerOtherMessageParameters = prefs->mPagerOtherMessageParameters; 671 mPagerOtherMessageParameters = prefs->mPagerOtherMessageParameters;
481 672
482 mSipClient = prefs->mPagerClient; 673 mSipClient = prefs->mPagerClient;
483 mSipOtherChannel = prefs->mSipOtherChannel; 674 mSipOtherChannel = prefs->mSipOtherChannel;
484 mSipOtherMessage = prefs->mSipOtherMessage; 675 mSipOtherMessage = prefs->mSipOtherMessage;
485 mSipOtherMessageParameters = prefs->mSipOtherMessageParameters; 676 mSipOtherMessageParameters = prefs->mSipOtherMessageParameters;
486 677
487 mCurrentApp = ExternalAppHandler::EMAIL; 678 mCurrentApp = ExternalAppHandler::EMAIL;
488 mCurrentClient = mEmailClient; 679 mCurrentClient = mEmailClient;
489 680
490 updateClientWidgets(); 681 updateClientWidgets();
491 682
492 blockSignals( blocked ); 683 blockSignals( blocked );
493 684
494 emit changed( false );
495
496} 685}
497 686
498void KDEPIMConfigWidget::saveSettings(KPimGlobalPrefs* prefs) 687void KDEPIMConfigWidget::usrWriteConfig()
499{ 688{
689 KPimGlobalPrefs* prefs = KPimGlobalPrefs::instance();
690
500 saveEditFieldSettings(); 691 saveEditFieldSettings();
501 692
693
694 prefs->mUserDateFormatShort = mUserDateFormatShort->text().replace( QRegExp(","), QString("K") );
695 prefs->mUserDateFormatLong = mUserDateFormatLong->text().replace( QRegExp(","), QString("K") );
696
697 prefs->mTimeZoneId = mTimeZoneCombo->currentText();
698 QDate date;
699 date = mStartDateSavingEdit->date();
700 int sub = 0;
701 if ( QDate::leapYear( date.year() ) && date.dayOfYear() > 59 )
702 sub = 1;
703 prefs->mDaylightsavingStart = date.dayOfYear()-sub;
704 date = mEndDateSavingEdit->date();
705 if ( QDate::leapYear( date.year() ) && date.dayOfYear() > 59 )
706 sub = 1;
707 else
708 sub = 0;
709 prefs->mDaylightsavingEnd = date.dayOfYear()-sub;
710
711
502 prefs->mEmailClient = mEmailClient; 712 prefs->mEmailClient = mEmailClient;
503 prefs->mEmailOtherChannel = mEmailOtherChannel; 713 prefs->mEmailOtherChannel = mEmailOtherChannel;
504 prefs->mEmailOtherMessage = mEmailOtherMessage; 714 prefs->mEmailOtherMessage = mEmailOtherMessage;
505 prefs->mEmailOtherMessageParameters = mEmailOtherMessageParameters; 715 prefs->mEmailOtherMessageParameters = mEmailOtherMessageParameters;
506 prefs->mEmailOtherMessage2 = mEmailOtherMessage2; 716 prefs->mEmailOtherMessage2 = mEmailOtherMessage2;
507 prefs->mEmailOtherMessageParameters2 = mEmailOtherMessageParameters2; 717 prefs->mEmailOtherMessageParameters2 = mEmailOtherMessageParameters2;
508 718
509 prefs->mPhoneClient = mPhoneClient; 719 prefs->mPhoneClient = mPhoneClient;
510 prefs->mPhoneOtherChannel = mPhoneOtherChannel; 720 prefs->mPhoneOtherChannel = mPhoneOtherChannel;
511 prefs->mPhoneOtherMessage = mPhoneOtherMessage; 721 prefs->mPhoneOtherMessage = mPhoneOtherMessage;
512 prefs->mPhoneOtherMessageParameters = mPhoneOtherMessageParameters; 722 prefs->mPhoneOtherMessageParameters = mPhoneOtherMessageParameters;
513 723
514 prefs->mFaxClient = mFaxClient; 724 prefs->mFaxClient = mFaxClient;
515 prefs->mFaxOtherChannel = mFaxOtherChannel; 725 prefs->mFaxOtherChannel = mFaxOtherChannel;
516 prefs->mFaxOtherMessage = mFaxOtherMessage; 726 prefs->mFaxOtherMessage = mFaxOtherMessage;
517 prefs->mFaxOtherMessageParameters = mFaxOtherMessageParameters; 727 prefs->mFaxOtherMessageParameters = mFaxOtherMessageParameters;
518 728
519 prefs->mSMSClient = mSMSClient; 729 prefs->mSMSClient = mSMSClient;
520 prefs->mSMSOtherChannel = mSMSOtherChannel; 730 prefs->mSMSOtherChannel = mSMSOtherChannel;
521 prefs->mSMSOtherMessage = mSMSOtherMessage; 731 prefs->mSMSOtherMessage = mSMSOtherMessage;
522 prefs->mSMSOtherMessageParameters = mSMSOtherMessageParameters; 732 prefs->mSMSOtherMessageParameters = mSMSOtherMessageParameters;
523 733
524 prefs->mPagerClient = mPagerClient; 734 prefs->mPagerClient = mPagerClient;
525 prefs->mPagerOtherChannel = mPagerOtherChannel; 735 prefs->mPagerOtherChannel = mPagerOtherChannel;
526 prefs->mPagerOtherMessage = mPagerOtherMessage; 736 prefs->mPagerOtherMessage = mPagerOtherMessage;
527 prefs->mPagerOtherMessageParameters = mPagerOtherMessageParameters; 737 prefs->mPagerOtherMessageParameters = mPagerOtherMessageParameters;
528 738
529 739
530 prefs->mSipClient = mSipClient; 740 prefs->mSipClient = mSipClient;
531 prefs->mSipOtherChannel = mSipOtherChannel; 741 prefs->mSipOtherChannel = mSipOtherChannel;
532 prefs->mSipOtherMessage = mSipOtherMessage; 742 prefs->mSipOtherMessage = mSipOtherMessage;
533 prefs->mSipOtherMessageParameters = mSipOtherMessageParameters; 743 prefs->mSipOtherMessageParameters = mSipOtherMessageParameters;
534 744
535 prefs->writeConfig();
536
537 //release the cache that other views can access the changed values instantanious 745 //release the cache that other views can access the changed values instantanious
538 ExternalAppHandler::instance()->loadConfig(); 746 ExternalAppHandler::instance()->loadConfig();
539 747
540 emit changed( false );
541} 748}
542 749
543void KDEPIMConfigWidget::defaults(KPimGlobalPrefs* prefs)
544{
545
546 DefaultAppItem* dai = ExternalAppHandler::instance()->getDefaultItem(ExternalAppHandler::EMAIL, KPimGlobalPrefs::NONE_EMC);
547
548 mEmailClient = dai->_id;
549 mEmailOtherChannel = dai->_channel;
550 mEmailOtherMessage = dai->_message;
551 mEmailOtherMessageParameters = dai->_parameters;
552 mEmailOtherMessage2 = dai->_message2;
553 mEmailOtherMessageParameters2 = dai->_parameters2;
554
555
556 dai = ExternalAppHandler::instance()->getDefaultItem(ExternalAppHandler::PHONE, KPimGlobalPrefs::NONE_PHC);
557
558 mPhoneClient = dai->_id;
559 mPhoneOtherChannel = dai->_channel;
560 mPhoneOtherMessage = dai->_message;
561 mPhoneOtherMessageParameters = dai->_parameters;
562
563 dai = ExternalAppHandler::instance()->getDefaultItem(ExternalAppHandler::FAX, KPimGlobalPrefs::NONE_FAC);
564
565 mFaxClient = dai->_id;
566 mFaxOtherChannel = dai->_channel;
567 mFaxOtherMessage = dai->_message;
568 mFaxOtherMessageParameters = dai->_parameters;
569 750
570 dai = ExternalAppHandler::instance()->getDefaultItem(ExternalAppHandler::SMS, KPimGlobalPrefs::NONE_SMC); 751void KDEPIMConfigWidget::setCombo(QComboBox *combo, const QString & text,
571 752 const QStringList *tags)
572 mSMSClient = dai->_id;
573 mSMSOtherChannel = dai->_channel;
574 mSMSOtherMessage = dai->_message;
575 mSMSOtherMessageParameters = dai->_parameters;
576
577 dai = ExternalAppHandler::instance()->getDefaultItem(ExternalAppHandler::PAGER, KPimGlobalPrefs::NONE_PAC);
578
579 mPagerClient = dai->_id;
580 mPagerOtherChannel = dai->_channel;
581 mPagerOtherMessage = dai->_message;
582 mPagerOtherMessageParameters = dai->_parameters;
583
584
585 dai = ExternalAppHandler::instance()->getDefaultItem(ExternalAppHandler::SIP, KPimGlobalPrefs::NONE_SIC);
586
587 mSipClient = dai->_id;
588 mSipOtherChannel = dai->_channel;
589 mSipOtherMessage = dai->_message;
590 mSipOtherMessageParameters = dai->_parameters;
591
592
593 emit changed( true );
594}
595
596void KDEPIMConfigWidget::modified()
597{ 753{
598 emit changed( true ); 754 if (tags) {
755 int i = tags->findIndex(text);
756 if (i > 0) combo->setCurrentItem(i);
757 } else {
758 for(int i=0;i<combo->count();++i) {
759 if (combo->text(i) == text) {
760 combo->setCurrentItem(i);
761 break;
762 }
763 }
764 }
599} 765}
600 766
767
601void KDEPIMConfigWidget::textChanged( const QString& text ) 768void KDEPIMConfigWidget::textChanged( const QString& text )
602{ 769{
603 emit changed( true ); 770 emit changed( true );
604} 771}
diff --git a/libkdepim/kcmconfigs/kdepimconfigwidget.h b/libkdepim/kcmconfigs/kdepimconfigwidget.h
index e3cfd81..6f26513 100644
--- a/libkdepim/kcmconfigs/kdepimconfigwidget.h
+++ b/libkdepim/kcmconfigs/kdepimconfigwidget.h
@@ -1,130 +1,139 @@
1/* 1/*
2 This file is part of KDEPim/Pi. 2 This file is part of KDEPim/Pi.
3 Copyright (c) 2004 Ulf Schenk 3 Copyright (c) 2004 Ulf Schenk
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/* 24/*
25Enhanced Version of the file for platform independent KDE tools. 25Enhanced Version of the file for platform independent KDE tools.
26Copyright (c) 2004 Ulf Schenk 26Copyright (c) 2004 Ulf Schenk
27 27
28$Id$ 28$Id$
29*/ 29*/
30 30
31#ifndef KDEPIMCONFIGWIDGET_H 31#ifndef KDEPIMCONFIGWIDGET_H
32#define KDEPIMCONFIGWIDGET_H 32#define KDEPIMCONFIGWIDGET_H
33 33
34#include <qwidget.h> 34#include <kprefswidget.h>
35#include <qmap.h> 35#include <qmap.h>
36 36
37#include "externalapphandler.h" 37#include "externalapphandler.h"
38 38
39 39
40/*
41class QCheckBox;
42class QListViewItem;
43class QPushButton;
44class KListView;
45*/
46class QComboBox; 40class QComboBox;
47class QLineEdit; 41class QLineEdit;
48class KPimGlobalPrefs; 42class KPimGlobalPrefs;
49class QGroupBox; 43class QGroupBox;
44class QTabWidget;
45class KDateEdit;
50 46
51class KDEPIMConfigWidget : public QWidget 47class KDEPIMConfigWidget : public KPrefsWidget
52{ 48{
53 Q_OBJECT 49 Q_OBJECT
54 50
55 public: 51 public:
56 KDEPIMConfigWidget( QWidget *parent, const char *name = 0 ); 52 KDEPIMConfigWidget(KPimGlobalPrefs *prefs, QWidget *parent, const char *name = 0 );
57
58 void restoreSettings(KPimGlobalPrefs* prefs);
59 void saveSettings(KPimGlobalPrefs* prefs);
60 void defaults(KPimGlobalPrefs* prefs);
61
62 signals:
63 void changed( bool );
64
65 53
66 public slots: 54 public slots:
67 void modified();
68 void textChanged( const QString& text ); 55 void textChanged( const QString& text );
69 56
57 protected:
58 /** Implement this to read custom configuration widgets. */
59 virtual void usrReadConfig();
60 /** Implement this to write custom configuration widgets. */
61 virtual void usrWriteConfig();
70 62
71 63
72 private slots: 64 private slots:
73// void configureExtension(); 65// void configureExtension();
74// void selectionChanged( QListViewItem* ); 66// void selectionChanged( QListViewItem* );
75// void itemClicked( QListViewItem* ); 67// void itemClicked( QListViewItem* );
76 void client_changed( int newClient ); 68 void client_changed( int newClient );
77 void externalapp_changed( int newApp ); 69 void externalapp_changed( int newApp );
78 70
79 private: 71 private:
72 void setupExternalAppTab();
73 void setupLocaleDateTab();
74 void setupLocaleTab();
75 void setupTimeZoneTab();
76
77 void setCombo(QComboBox *combo,const QString & text, const QStringList *tags = 0);
78
79
80 void saveEditFieldSettings(); 80 void saveEditFieldSettings();
81 void updateClientWidgets(); 81 void updateClientWidgets();
82 82
83 QTabWidget *tabWidget;
84
85
86 QLineEdit* mUserDateFormatShort;
87 QLineEdit* mUserDateFormatLong;
88 QComboBox* mTimeZoneCombo;
89 KDateEdit* mStartDateSavingEdit;
90 KDateEdit* mEndDateSavingEdit;
91
83// void restoreExtensionSettings(); 92// void restoreExtensionSettings();
84// void saveExtensionSettings(); 93// void saveExtensionSettings();
85 94
86// KListView *mExtensionView; 95// KListView *mExtensionView;
87 96
88// QCheckBox *mNameParsing; 97// QCheckBox *mNameParsing;
89// QCheckBox *mViewsSingleClickBox; 98// QCheckBox *mViewsSingleClickBox;
90// QPushButton *mConfigureButton; 99// QPushButton *mConfigureButton;
91 QComboBox* mExternalApps; 100 QComboBox* mExternalApps;
92 QGroupBox* mExternalAppGroupBox; 101 QGroupBox* mExternalAppGroupBox;
93 102
94 103
95 QComboBox* mClient; 104 QComboBox* mClient;
96 QLineEdit* mChannel; 105 QLineEdit* mChannel;
97 QLineEdit* mMessage; 106 QLineEdit* mMessage;
98 QLineEdit* mParameters; 107 QLineEdit* mParameters;
99 QLineEdit* mMessage2; 108 QLineEdit* mMessage2;
100 QLineEdit* mParameters2; 109 QLineEdit* mParameters2;
101 110
102 ExternalAppHandler::Types mCurrentApp; 111 ExternalAppHandler::Types mCurrentApp;
103 int mCurrentClient; 112 int mCurrentClient;
104 113
105 114
106 int mEmailClient; 115 int mEmailClient;
107 QString mEmailOtherChannel; 116 QString mEmailOtherChannel;
108 QString mEmailOtherMessage; 117 QString mEmailOtherMessage;
109 QString mEmailOtherMessageParameters; 118 QString mEmailOtherMessageParameters;
110 QString mEmailOtherMessage2; 119 QString mEmailOtherMessage2;
111 QString mEmailOtherMessageParameters2; 120 QString mEmailOtherMessageParameters2;
112 121
113 int mPhoneClient; 122 int mPhoneClient;
114 QString mPhoneOtherChannel; 123 QString mPhoneOtherChannel;
115 QString mPhoneOtherMessage; 124 QString mPhoneOtherMessage;
116 QString mPhoneOtherMessageParameters; 125 QString mPhoneOtherMessageParameters;
117 126
118 int mFaxClient; 127 int mFaxClient;
119 QString mFaxOtherChannel; 128 QString mFaxOtherChannel;
120 QString mFaxOtherMessage; 129 QString mFaxOtherMessage;
121 QString mFaxOtherMessageParameters; 130 QString mFaxOtherMessageParameters;
122 131
123 int mSMSClient; 132 int mSMSClient;
124 QString mSMSOtherChannel; 133 QString mSMSOtherChannel;
125 QString mSMSOtherMessage; 134 QString mSMSOtherMessage;
126 QString mSMSOtherMessageParameters; 135 QString mSMSOtherMessageParameters;
127 136
128 int mPagerClient; 137 int mPagerClient;
129 QString mPagerOtherChannel; 138 QString mPagerOtherChannel;
130 QString mPagerOtherMessage; 139 QString mPagerOtherMessage;
diff --git a/libkdepim/kpimglobalprefs.cpp b/libkdepim/kpimglobalprefs.cpp
index eb8f1de..12a503d 100644
--- a/libkdepim/kpimglobalprefs.cpp
+++ b/libkdepim/kpimglobalprefs.cpp
@@ -1,93 +1,114 @@
1/* 1/*
2 This file is part of libkdepim. 2 This file is part of libkdepim.
3 Copyright (c) 2002 Cornelius Schumacher <schumacher@kde.org> 3 Copyright (c) 2002 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/* 24/*
25Enhanced Version of the file for platform independent KDE tools. 25Enhanced Version of the file for platform independent KDE tools.
26Copyright (c) 2004 Ulf Schenk 26Copyright (c) 2004 Ulf Schenk
27 27
28$Id$ 28$Id$
29*/ 29*/
30 30
31#include <kglobal.h> 31#include <kglobal.h>
32#include <kconfig.h> 32#include <kconfig.h>
33#include <klocale.h> 33#include <klocale.h>
34#include <kdebug.h> 34#include <kdebug.h>
35#include <kstaticdeleter.h> 35#include <kstaticdeleter.h>
36 36
37#include "kpimglobalprefs.h" 37#include "kpimglobalprefs.h"
38 38
39KPimGlobalPrefs *KPimGlobalPrefs::sInstance = 0; 39KPimGlobalPrefs *KPimGlobalPrefs::sInstance = 0;
40static KStaticDeleter<KPimGlobalPrefs> staticDeleter; 40static KStaticDeleter<KPimGlobalPrefs> staticDeleter;
41 41
42 42
43KPimGlobalPrefs::KPimGlobalPrefs( const QString &name ) 43KPimGlobalPrefs::KPimGlobalPrefs( const QString &name )
44 : KPrefs("microkdeglobalrc") 44 : KPrefs("microkdeglobalrc")
45{ 45{
46
47 KPrefs::setCurrentGroup("Locale");
48 addItemInt("PreferredLanguage",&mPreferredLanguage,0);
49 addItemInt("PreferredTime",&mPreferredTime,0);
50 addItemInt("PreferredDate",&mPreferredDate,0);
51 addItemBool("WeekStartsOnSunday",&mWeekStartsOnSunday,false);
52 //addItemBool("QuickSavingWOUnicode",&mUseQuicksave,false);
53 // addItemBool("ShortDateInViewer",&mShortDateInViewer,false);
54 addItemString("UserDateFormatLong", &mUserDateFormatLong, "%A %d %b %y");
55 addItemString("UserDateFormatShort", &mUserDateFormatShort, "%aK %d.%m.%y");
56
57 KPrefs::setCurrentGroup("Time & Date");
58
59 addItemString("TimeZoneName",&mTimeZoneId,i18n ("+01:00 Europe/Oslo(CET)") );
60 addItemBool("UseDaylightsaving",&mUseDaylightsaving,true);
61 addItemInt("DaylightsavingStart",&mDaylightsavingStart,90);
62 addItemInt("DaylightsavingEnd",&mDaylightsavingEnd,304);
63
64
65
66
46 KPrefs::setCurrentGroup( "ExternalApplications" ); 67 KPrefs::setCurrentGroup( "ExternalApplications" );
47 68
48 addItemInt( "EmailChannelType", &mEmailClient, OMPI_EMC ); 69 addItemInt( "EmailChannelType", &mEmailClient, OMPI_EMC );
49 addItemString( "EmailChannel", &mEmailOtherChannel, "" ); 70 addItemString( "EmailChannel", &mEmailOtherChannel, "" );
50 addItemString( "EmailChannelMessage", &mEmailOtherMessage, "" ); 71 addItemString( "EmailChannelMessage", &mEmailOtherMessage, "" );
51 addItemString( "EmailChannelParameters", &mEmailOtherMessageParameters, "" ); 72 addItemString( "EmailChannelParameters", &mEmailOtherMessageParameters, "" );
52 addItemString( "EmailChannelMessage2", &mEmailOtherMessage2, "" ); 73 addItemString( "EmailChannelMessage2", &mEmailOtherMessage2, "" );
53 addItemString( "EmailChannelParameters2", &mEmailOtherMessageParameters2, "" ); 74 addItemString( "EmailChannelParameters2", &mEmailOtherMessageParameters2, "" );
54 75
55 addItemInt( "PhoneChannelType", &mPhoneClient, KPPI_PHC ); 76 addItemInt( "PhoneChannelType", &mPhoneClient, KPPI_PHC );
56 addItemString( "PhoneChannel", &mPhoneOtherChannel, "" ); 77 addItemString( "PhoneChannel", &mPhoneOtherChannel, "" );
57 addItemString( "PhoneChannelMessage", &mPhoneOtherMessage, "" ); 78 addItemString( "PhoneChannelMessage", &mPhoneOtherMessage, "" );
58 addItemString( "PhoneChannelParameters", &mPhoneOtherMessageParameters, "" ); 79 addItemString( "PhoneChannelParameters", &mPhoneOtherMessageParameters, "" );
59 80
60 addItemInt( "FaxChannelType", &mFaxClient, NONE_FAC ); 81 addItemInt( "FaxChannelType", &mFaxClient, NONE_FAC );
61 addItemString( "FaxChannel", &mFaxOtherChannel, "" ); 82 addItemString( "FaxChannel", &mFaxOtherChannel, "" );
62 addItemString( "FaxChannelMessage", &mFaxOtherMessage, "" ); 83 addItemString( "FaxChannelMessage", &mFaxOtherMessage, "" );
63 addItemString( "FaxChannelParameters", &mFaxOtherMessageParameters, "" ); 84 addItemString( "FaxChannelParameters", &mFaxOtherMessageParameters, "" );
64 85
65 addItemInt( "SMSChannelType", &mSMSClient, NONE_SMC ); 86 addItemInt( "SMSChannelType", &mSMSClient, NONE_SMC );
66 addItemString( "SMSChannel", &mSMSOtherChannel, "" ); 87 addItemString( "SMSChannel", &mSMSOtherChannel, "" );
67 addItemString( "SMSChannelMessage", &mSMSOtherMessage, "" ); 88 addItemString( "SMSChannelMessage", &mSMSOtherMessage, "" );
68 addItemString( "SMSChannelParameters", &mSMSOtherMessageParameters, "" ); 89 addItemString( "SMSChannelParameters", &mSMSOtherMessageParameters, "" );
69 90
70 addItemInt( "PagerChannelType", &mPagerClient, NONE_PAC ); 91 addItemInt( "PagerChannelType", &mPagerClient, NONE_PAC );
71 addItemString( "PagerChannel", &mPagerOtherChannel, "" ); 92 addItemString( "PagerChannel", &mPagerOtherChannel, "" );
72 addItemString( "PagerChannelMessage", &mPagerOtherMessage, "" ); 93 addItemString( "PagerChannelMessage", &mPagerOtherMessage, "" );
73 addItemString( "PagerChannelParameters", &mPagerOtherMessageParameters, "" ); 94 addItemString( "PagerChannelParameters", &mPagerOtherMessageParameters, "" );
74 95
75 addItemInt( "SIPChannelType", &mSipClient, NONE_SIC ); 96 addItemInt( "SIPChannelType", &mSipClient, NONE_SIC );
76 addItemString( "SIPChannel", &mSipOtherChannel, "" ); 97 addItemString( "SIPChannel", &mSipOtherChannel, "" );
77 addItemString( "SIPChannelMessage", &mSipOtherMessage, "" ); 98 addItemString( "SIPChannelMessage", &mSipOtherMessage, "" );
78 addItemString( "SIPChannelParameters", &mSipOtherMessageParameters, "" ); 99 addItemString( "SIPChannelParameters", &mSipOtherMessageParameters, "" );
79 100
80} 101}
81 102
82KPimGlobalPrefs::~KPimGlobalPrefs() 103KPimGlobalPrefs::~KPimGlobalPrefs()
83{ 104{
84} 105}
85 106
86KPimGlobalPrefs *KPimGlobalPrefs::instance() 107KPimGlobalPrefs *KPimGlobalPrefs::instance()
87{ 108{
88 if ( !sInstance ) { 109 if ( !sInstance ) {
89 sInstance = staticDeleter.setObject( new KPimGlobalPrefs() ); 110 sInstance = staticDeleter.setObject( new KPimGlobalPrefs() );
90 sInstance->readConfig(); 111 sInstance->readConfig();
91 } 112 }
92 113
93 return sInstance; 114 return sInstance;
diff --git a/libkdepim/kpimglobalprefs.h b/libkdepim/kpimglobalprefs.h
index 8bd543d..dad78e6 100644
--- a/libkdepim/kpimglobalprefs.h
+++ b/libkdepim/kpimglobalprefs.h
@@ -39,84 +39,99 @@ class KPimGlobalPrefs : public KPrefs
39 39
40 static KPimGlobalPrefs *instance(); 40 static KPimGlobalPrefs *instance();
41 41
42 42
43 virtual ~KPimGlobalPrefs(); 43 virtual ~KPimGlobalPrefs();
44 44
45 45
46 enum EMailClients { 46 enum EMailClients {
47 NONE_EMC = 0, 47 NONE_EMC = 0,
48 OTHER_EMC = 1, 48 OTHER_EMC = 1,
49 OMPI_EMC = 2, 49 OMPI_EMC = 2,
50 QTOPIA_EMC = 3, 50 QTOPIA_EMC = 3,
51 OPIE_EMC = 4 51 OPIE_EMC = 4
52 }; 52 };
53 53
54 enum PhoneClients { 54 enum PhoneClients {
55 NONE_PHC = 0, 55 NONE_PHC = 0,
56 OTHER_PHC = 1, 56 OTHER_PHC = 1,
57 KPPI_PHC = 2 57 KPPI_PHC = 2
58 }; 58 };
59 59
60 enum FaxClients { 60 enum FaxClients {
61 NONE_FAC = 0, 61 NONE_FAC = 0,
62 OTHER_FAC = 1 62 OTHER_FAC = 1
63 }; 63 };
64 64
65 enum SMSClients { 65 enum SMSClients {
66 NONE_SMC = 0, 66 NONE_SMC = 0,
67 OTHER_SMC = 1 67 OTHER_SMC = 1
68 }; 68 };
69 69
70 enum PagerClients { 70 enum PagerClients {
71 NONE_PAC = 0, 71 NONE_PAC = 0,
72 OTHER_PAC = 1 72 OTHER_PAC = 1
73 }; 73 };
74 74
75 enum SIPClients { 75 enum SIPClients {
76 NONE_SIC = 0, 76 NONE_SIC = 0,
77 OTHER_SIC = 1 77 OTHER_SIC = 1
78 }; 78 };
79 79
80 private: 80 private:
81 KPimGlobalPrefs( const QString &name = QString::null ); 81 KPimGlobalPrefs( const QString &name = QString::null );
82 82
83 static KPimGlobalPrefs *sInstance; 83 static KPimGlobalPrefs *sInstance;
84 84
85 85
86 public: 86 public:
87 //US I copied the following "locale" settings from KOPrefs
88 int mPreferredDate;
89 QString mUserDateFormatLong;
90 QString mUserDateFormatShort;
91 int mPreferredLanguage;
92 int mPreferredTime;
93 bool mWeekStartsOnSunday;
94 QString mTimeZoneId;
95 bool mUseDaylightsaving;
96 int mDaylightsavingStart;
97 int mDaylightsavingEnd;
98
99
100
101
87 int mEmailClient; 102 int mEmailClient;
88 QString mEmailOtherChannel; 103 QString mEmailOtherChannel;
89 QString mEmailOtherMessage; 104 QString mEmailOtherMessage;
90 QString mEmailOtherMessageParameters; 105 QString mEmailOtherMessageParameters;
91 QString mEmailOtherMessage2; 106 QString mEmailOtherMessage2;
92 QString mEmailOtherMessageParameters2; 107 QString mEmailOtherMessageParameters2;
93 108
94 int mPhoneClient; 109 int mPhoneClient;
95 QString mPhoneOtherChannel; 110 QString mPhoneOtherChannel;
96 QString mPhoneOtherMessage; 111 QString mPhoneOtherMessage;
97 QString mPhoneOtherMessageParameters; 112 QString mPhoneOtherMessageParameters;
98 113
99 int mFaxClient; 114 int mFaxClient;
100 QString mFaxOtherChannel; 115 QString mFaxOtherChannel;
101 QString mFaxOtherMessage; 116 QString mFaxOtherMessage;
102 QString mFaxOtherMessageParameters; 117 QString mFaxOtherMessageParameters;
103 118
104 int mSMSClient; 119 int mSMSClient;
105 QString mSMSOtherChannel; 120 QString mSMSOtherChannel;
106 QString mSMSOtherMessage; 121 QString mSMSOtherMessage;
107 QString mSMSOtherMessageParameters; 122 QString mSMSOtherMessageParameters;
108 123
109 int mPagerClient; 124 int mPagerClient;
110 QString mPagerOtherChannel; 125 QString mPagerOtherChannel;
111 QString mPagerOtherMessage; 126 QString mPagerOtherMessage;
112 QString mPagerOtherMessageParameters; 127 QString mPagerOtherMessageParameters;
113 128
114 int mSipClient; 129 int mSipClient;
115 QString mSipOtherChannel; 130 QString mSipOtherChannel;
116 QString mSipOtherMessage; 131 QString mSipOtherMessage;
117 QString mSipOtherMessageParameters; 132 QString mSipOtherMessageParameters;
118 133
119 134
120}; 135};
121 136
122#endif 137#endif
diff --git a/libkdepim/kpimprefs.cpp b/libkdepim/kpimprefs.cpp
index 140a286..a9ea330 100644
--- a/libkdepim/kpimprefs.cpp
+++ b/libkdepim/kpimprefs.cpp
@@ -19,48 +19,54 @@
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/* 24/*
25Enhanced Version of the file for platform independent KDE tools. 25Enhanced Version of the file for platform independent KDE tools.
26Copyright (c) 2004 Ulf Schenk 26Copyright (c) 2004 Ulf Schenk
27 27
28$Id$ 28$Id$
29*/ 29*/
30 30
31#include <kglobal.h> 31#include <kglobal.h>
32#include <kconfig.h> 32#include <kconfig.h>
33#include <klocale.h> 33#include <klocale.h>
34#include <kdebug.h> 34#include <kdebug.h>
35 35
36#include "kpimprefs.h" 36#include "kpimprefs.h"
37 37
38KPimPrefs::KPimPrefs( const QString &name ) : 38KPimPrefs::KPimPrefs( const QString &name ) :
39 KPrefs( name ) 39 KPrefs( name )
40{ 40{
41} 41}
42 42
43KPimPrefs::~KPimPrefs() 43KPimPrefs::~KPimPrefs()
44{ 44{
45} 45}
46 46
47void KPimPrefs::usrSetDefaults() 47void KPimPrefs::usrSetDefaults()
48{ 48{
49 setCategoryDefaults(); 49 setCategoryDefaults();
50} 50}
51 51
52void KPimPrefs::usrReadConfig() 52void KPimPrefs::usrReadConfig()
53{ 53{
54 kdDebug(5300) << "KPimPrefs::usrReadConfig()" << endl; 54 kdDebug(5300) << "KPimPrefs::usrReadConfig()" << endl;
55 55
56 config()->setGroup("General"); 56 config()->setGroup("General");
57 mCustomCategories = config()->readListEntry("Custom Categories"); 57 mCustomCategories = config()->readListEntry("Custom Categories");
58 if (mCustomCategories.isEmpty()) setCategoryDefaults(); 58 if (mCustomCategories.isEmpty()) setCategoryDefaults();
59} 59}
60 60
61 61
62void KPimPrefs::usrWriteConfig() 62void KPimPrefs::usrWriteConfig()
63{ 63{
64 config()->setGroup("General"); 64 config()->setGroup("General");
65 config()->writeEntry("Custom Categories",mCustomCategories); 65 config()->writeEntry("Custom Categories",mCustomCategories);
66} 66}
67
68void KPimPrefs::setCategoryDefaults()
69{
70 // empty implementation
71}
72
diff --git a/libkdepim/kpimprefs.h b/libkdepim/kpimprefs.h
index 9bd9466..860665b 100644
--- a/libkdepim/kpimprefs.h
+++ b/libkdepim/kpimprefs.h
@@ -13,52 +13,52 @@
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/* 24/*
25Enhanced Version of the file for platform independent KDE tools. 25Enhanced Version of the file for platform independent KDE tools.
26Copyright (c) 2004 Ulf Schenk 26Copyright (c) 2004 Ulf Schenk
27 27
28$Id$ 28$Id$
29*/ 29*/
30 30
31#ifndef KPIMPREFS_H 31#ifndef KPIMPREFS_H
32#define KPIMPREFS_H 32#define KPIMPREFS_H
33 33
34#include <qstringlist.h> 34#include <qstringlist.h>
35 35
36#include "kprefs.h" 36#include "kprefs.h"
37 37
38class KPimPrefs : public KPrefs 38class KPimPrefs : public KPrefs
39{ 39{
40 public: 40 public:
41 41
42 KPimPrefs( const QString &name = QString::null ); 42 KPimPrefs( const QString &name = QString::null );
43 43
44 virtual ~KPimPrefs(); 44 virtual ~KPimPrefs();
45 45
46 /** Set preferences to default values */ 46 /** Set preferences to default values */
47 void usrSetDefaults(); 47 void usrSetDefaults();
48 48
49 /** Read preferences from config file */ 49 /** Read preferences from config file */
50 void usrReadConfig(); 50 void usrReadConfig();
51 51
52 /** Write preferences to config file */ 52 /** Write preferences to config file */
53 void usrWriteConfig(); 53 void usrWriteConfig();
54 54
55 55
56 public: 56 public:
57 QStringList mCustomCategories; 57 QStringList mCustomCategories;
58 58
59 59
60 protected: 60 protected:
61 virtual void setCategoryDefaults() = 0; 61 virtual void setCategoryDefaults();
62}; 62};
63 63
64#endif 64#endif
diff --git a/libkdepim/kprefsdialog.cpp b/libkdepim/kprefsdialog.cpp
index 205c526..dd9a602 100644
--- a/libkdepim/kprefsdialog.cpp
+++ b/libkdepim/kprefsdialog.cpp
@@ -12,399 +12,399 @@
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 <kfontdialog.h> 50#include <kfontdialog.h>
51#include <kmessagebox.h> 51#include <kmessagebox.h>
52#include <kcolordialog.h> 52#include <kcolordialog.h>
53#include <kiconloader.h> 53#include <kiconloader.h>
54 54
55#include "kprefs.h" 55#include "kprefs.h"
56 56
57#include "kprefsdialog.h" 57#include "kprefsdialog.h"
58//#include "kprefsdialog.moc" 58//#include "kprefsdialog.moc"
59 59
60KPrefsWidBool::KPrefsWidBool(const QString &text,bool *reference, 60KPrefsDialogWidBool::KPrefsDialogWidBool(const QString &text,bool *reference,
61 QWidget *parent) 61 QWidget *parent)
62{ 62{
63 mReference = reference; 63 mReference = reference;
64 64
65 mCheck = new QCheckBox(text,parent); 65 mCheck = new QCheckBox(text,parent);
66} 66}
67 67
68void KPrefsWidBool::readConfig() 68void KPrefsDialogWidBool::readConfig()
69{ 69{
70 mCheck->setChecked(*mReference); 70 mCheck->setChecked(*mReference);
71} 71}
72 72
73void KPrefsWidBool::writeConfig() 73void KPrefsDialogWidBool::writeConfig()
74{ 74{
75 *mReference = mCheck->isChecked(); 75 *mReference = mCheck->isChecked();
76} 76}
77 77
78QCheckBox *KPrefsWidBool::checkBox() 78QCheckBox *KPrefsDialogWidBool::checkBox()
79{ 79{
80 return mCheck; 80 return mCheck;
81} 81}
82 82
83 83
84KPrefsWidColor::KPrefsWidColor(const QString &text,QColor *reference, 84KPrefsDialogWidColor::KPrefsDialogWidColor(const QString &text,QColor *reference,
85 QWidget *parent) 85 QWidget *parent)
86{ 86{
87 mReference = reference; 87 mReference = reference;
88 88
89 mButton = new KColorButton(parent); 89 mButton = new KColorButton(parent);
90 mLabel = new QLabel(mButton, text, parent); 90 mLabel = new QLabel(mButton, text, parent);
91 mButton->setColor( *mReference ); 91 mButton->setColor( *mReference );
92 mButton->setColor( Qt::red ); 92 mButton->setColor( Qt::red );
93 93
94} 94}
95 95
96KPrefsWidColor::~KPrefsWidColor() 96KPrefsDialogWidColor::~KPrefsDialogWidColor()
97{ 97{
98// kdDebug(5300) << "KPrefsWidColor::~KPrefsWidColor()" << endl; 98// kdDebug(5300) << "KPrefsDialogWidColor::~KPrefsDialogWidColor()" << endl;
99} 99}
100 100
101void KPrefsWidColor::readConfig() 101void KPrefsDialogWidColor::readConfig()
102{ 102{
103 mButton->setColor(*mReference); 103 mButton->setColor(*mReference);
104} 104}
105 105
106void KPrefsWidColor::writeConfig() 106void KPrefsDialogWidColor::writeConfig()
107{ 107{
108 *mReference = mButton->color(); 108 *mReference = mButton->color();
109} 109}
110 110
111QLabel *KPrefsWidColor::label() 111QLabel *KPrefsDialogWidColor::label()
112{ 112{
113 return mLabel; 113 return mLabel;
114} 114}
115 115
116KColorButton *KPrefsWidColor::button() 116KColorButton *KPrefsDialogWidColor::button()
117{ 117{
118 return mButton; 118 return mButton;
119} 119}
120 120
121KPrefsWidFont::KPrefsWidFont(const QString &sampleText,const QString &labelText, 121KPrefsDialogWidFont::KPrefsDialogWidFont(const QString &sampleText,const QString &labelText,
122 QFont *reference,QWidget *parent) 122 QFont *reference,QWidget *parent)
123{ 123{
124 mReference = reference; 124 mReference = reference;
125 125
126 mLabel = new QLabel(labelText, parent); 126 mLabel = new QLabel(labelText, parent);
127 127
128 mPreview = new QLabel(sampleText,parent); 128 mPreview = new QLabel(sampleText,parent);
129 mPreview->setFrameStyle(QFrame::Panel|QFrame::Sunken); 129 mPreview->setFrameStyle(QFrame::Panel|QFrame::Sunken);
130 130
131 mButton = new QPushButton(i18n("Choose..."), parent); 131 mButton = new QPushButton(i18n("Choose..."), parent);
132 connect(mButton,SIGNAL(clicked()),SLOT(selectFont())); 132 connect(mButton,SIGNAL(clicked()),SLOT(selectFont()));
133 mPreview->setMaximumHeight( QApplication::desktop()->height() / 12 ); 133 mPreview->setMaximumHeight( QApplication::desktop()->height() / 12 );
134 mPreview->setMaximumWidth( (QApplication::desktop()->width() / 2)-10 ); 134 mPreview->setMaximumWidth( (QApplication::desktop()->width() / 2)-10 );
135} 135}
136 136
137KPrefsWidFont::~KPrefsWidFont() 137KPrefsDialogWidFont::~KPrefsDialogWidFont()
138{ 138{
139} 139}
140 140
141void KPrefsWidFont::readConfig() 141void KPrefsDialogWidFont::readConfig()
142{ 142{
143 mPreview->setFont(*mReference); 143 mPreview->setFont(*mReference);
144} 144}
145 145
146void KPrefsWidFont::writeConfig() 146void KPrefsDialogWidFont::writeConfig()
147{ 147{
148 *mReference = mPreview->font(); 148 *mReference = mPreview->font();
149} 149}
150 150
151QLabel *KPrefsWidFont::label() 151QLabel *KPrefsDialogWidFont::label()
152{ 152{
153 return mLabel; 153 return mLabel;
154} 154}
155 155
156QLabel *KPrefsWidFont::preview() 156QLabel *KPrefsDialogWidFont::preview()
157{ 157{
158 return mPreview; 158 return mPreview;
159} 159}
160 160
161QPushButton *KPrefsWidFont::button() 161QPushButton *KPrefsDialogWidFont::button()
162{ 162{
163 return mButton; 163 return mButton;
164} 164}
165 165
166void KPrefsWidFont::selectFont() 166void KPrefsDialogWidFont::selectFont()
167{ 167{
168 QFont myFont(mPreview->font()); 168 QFont myFont(mPreview->font());
169 bool ok; 169 bool ok;
170 myFont = KFontDialog::getFont(myFont, ok); 170 myFont = KFontDialog::getFont(myFont, ok);
171 if ( ok ) { 171 if ( ok ) {
172 mPreview->setFont(myFont); 172 mPreview->setFont(myFont);
173 } 173 }
174} 174}
175 175
176 176
177KPrefsWidTime::KPrefsWidTime(const QString &text,int *reference, 177KPrefsDialogWidTime::KPrefsDialogWidTime(const QString &text,int *reference,
178 QWidget *parent) 178 QWidget *parent)
179{ 179{
180 mReference = reference; 180 mReference = reference;
181 181
182 mLabel = new QLabel(text,parent); 182 mLabel = new QLabel(text,parent);
183 mSpin = new QSpinBox(0,23,1,parent); 183 mSpin = new QSpinBox(0,23,1,parent);
184 mSpin->setSuffix(":00"); 184 mSpin->setSuffix(":00");
185} 185}
186 186
187void KPrefsWidTime::readConfig() 187void KPrefsDialogWidTime::readConfig()
188{ 188{
189 mSpin->setValue(*mReference); 189 mSpin->setValue(*mReference);
190} 190}
191 191
192void KPrefsWidTime::writeConfig() 192void KPrefsDialogWidTime::writeConfig()
193{ 193{
194 *mReference = mSpin->value(); 194 *mReference = mSpin->value();
195} 195}
196 196
197QLabel *KPrefsWidTime::label() 197QLabel *KPrefsDialogWidTime::label()
198{ 198{
199 return mLabel; 199 return mLabel;
200} 200}
201 201
202QSpinBox *KPrefsWidTime::spinBox() 202QSpinBox *KPrefsDialogWidTime::spinBox()
203{ 203{
204 return mSpin; 204 return mSpin;
205} 205}
206 206
207 207
208KPrefsWidRadios::KPrefsWidRadios(const QString &text,int *reference, 208KPrefsDialogWidRadios::KPrefsDialogWidRadios(const QString &text,int *reference,
209 QWidget *parent) 209 QWidget *parent)
210{ 210{
211 mReference = reference; 211 mReference = reference;
212 212
213 mBox = new QButtonGroup(1,Qt::Horizontal,text,parent); 213 mBox = new QButtonGroup(1,Qt::Horizontal,text,parent);
214} 214}
215 215
216KPrefsWidRadios::~KPrefsWidRadios() 216KPrefsDialogWidRadios::~KPrefsDialogWidRadios()
217{ 217{
218} 218}
219 219
220void KPrefsWidRadios::addRadio(const QString &text) 220void KPrefsDialogWidRadios::addRadio(const QString &text)
221{ 221{
222 new QRadioButton(text,mBox); 222 new QRadioButton(text,mBox);
223} 223}
224 224
225QButtonGroup *KPrefsWidRadios::groupBox() 225QButtonGroup *KPrefsDialogWidRadios::groupBox()
226{ 226{
227 return mBox; 227 return mBox;
228} 228}
229 229
230void KPrefsWidRadios::readConfig() 230void KPrefsDialogWidRadios::readConfig()
231{ 231{
232 mBox->setButton(*mReference); 232 mBox->setButton(*mReference);
233} 233}
234 234
235void KPrefsWidRadios::writeConfig() 235void KPrefsDialogWidRadios::writeConfig()
236{ 236{
237 *mReference = mBox->id(mBox->selected()); 237 *mReference = mBox->id(mBox->selected());
238} 238}
239 239
240 240
241KPrefsWidString::KPrefsWidString(const QString &text,QString *reference, 241KPrefsDialogWidString::KPrefsDialogWidString(const QString &text,QString *reference,
242 QWidget *parent, QLineEdit::EchoMode echomode) 242 QWidget *parent, QLineEdit::EchoMode echomode)
243{ 243{
244 mReference = reference; 244 mReference = reference;
245 245
246 mLabel = new QLabel(text,parent); 246 mLabel = new QLabel(text,parent);
247 mEdit = new QLineEdit(parent); 247 mEdit = new QLineEdit(parent);
248 mEdit->setEchoMode( echomode ); 248 mEdit->setEchoMode( echomode );
249} 249}
250 250
251KPrefsWidString::~KPrefsWidString() 251KPrefsDialogWidString::~KPrefsDialogWidString()
252{ 252{
253} 253}
254 254
255void KPrefsWidString::readConfig() 255void KPrefsDialogWidString::readConfig()
256{ 256{
257 mEdit->setText(*mReference); 257 mEdit->setText(*mReference);
258} 258}
259 259
260void KPrefsWidString::writeConfig() 260void KPrefsDialogWidString::writeConfig()
261{ 261{
262 *mReference = mEdit->text(); 262 *mReference = mEdit->text();
263} 263}
264 264
265QLabel *KPrefsWidString::label() 265QLabel *KPrefsDialogWidString::label()
266{ 266{
267 return mLabel; 267 return mLabel;
268} 268}
269 269
270QLineEdit *KPrefsWidString::lineEdit() 270QLineEdit *KPrefsDialogWidString::lineEdit()
271{ 271{
272 return mEdit; 272 return mEdit;
273} 273}
274 274
275 275
276KPrefsDialog::KPrefsDialog(KPrefs *prefs,QWidget *parent,char *name,bool modal) : 276KPrefsDialog::KPrefsDialog(KPrefs *prefs,QWidget *parent,char *name,bool modal) :
277 KDialogBase(IconList,i18n("Preferences"),Ok|Cancel|Default,Ok,parent, 277 KDialogBase(IconList,i18n("Preferences"),Ok|Cancel|Default,Ok,parent,
278 name,modal,true) 278 name,modal,true)
279{ 279{
280 mPrefs = prefs; 280 mPrefs = prefs;
281 281
282// This seems to cause a crash on exit. Investigate later. 282// This seems to cause a crash on exit. Investigate later.
283// mPrefsWids.setAutoDelete(true); 283// mPrefsWids.setAutoDelete(true);
284 284
285 connect(this,SIGNAL(defaultClicked()),SLOT(slotDefault())); 285 connect(this,SIGNAL(defaultClicked()),SLOT(slotDefault()));
286 //connect(this,SIGNAL(cancelClicked()),SLOT(slotDefault())); 286 //connect(this,SIGNAL(cancelClicked()),SLOT(slotDefault()));
287 //connect(this,SIGNAL(cancelClicked()),SLOT(reject())); 287 //connect(this,SIGNAL(cancelClicked()),SLOT(reject()));
288} 288}
289 289
290KPrefsDialog::~KPrefsDialog() 290KPrefsDialog::~KPrefsDialog()
291{ 291{
292} 292}
293 293
294void KPrefsDialog::addWid(KPrefsWid *wid) 294void KPrefsDialog::addWid(KPrefsDialogWid *wid)
295{ 295{
296 mPrefsWids.append(wid); 296 mPrefsWids.append(wid);
297} 297}
298 298
299KPrefsWidBool *KPrefsDialog::addWidBool(const QString &text,bool *reference,QWidget *parent) 299KPrefsDialogWidBool *KPrefsDialog::addWidBool(const QString &text,bool *reference,QWidget *parent)
300{ 300{
301 KPrefsWidBool *w = new KPrefsWidBool(text,reference,parent); 301 KPrefsDialogWidBool *w = new KPrefsDialogWidBool(text,reference,parent);
302 addWid(w); 302 addWid(w);
303 return w; 303 return w;
304} 304}
305 305
306KPrefsWidTime *KPrefsDialog::addWidTime(const QString &text,int *reference,QWidget *parent) 306KPrefsDialogWidTime *KPrefsDialog::addWidTime(const QString &text,int *reference,QWidget *parent)
307{ 307{
308 KPrefsWidTime *w = new KPrefsWidTime(text,reference,parent); 308 KPrefsDialogWidTime *w = new KPrefsDialogWidTime(text,reference,parent);
309 addWid(w); 309 addWid(w);
310 return w; 310 return w;
311} 311}
312 312
313KPrefsWidColor *KPrefsDialog::addWidColor(const QString &text,QColor *reference,QWidget *parent) 313KPrefsDialogWidColor *KPrefsDialog::addWidColor(const QString &text,QColor *reference,QWidget *parent)
314{ 314{
315 KPrefsWidColor *w = new KPrefsWidColor(text,reference,parent); 315 KPrefsDialogWidColor *w = new KPrefsDialogWidColor(text,reference,parent);
316 addWid(w); 316 addWid(w);
317 return w; 317 return w;
318} 318}
319 319
320KPrefsWidRadios *KPrefsDialog::addWidRadios(const QString &text,int *reference,QWidget *parent) 320KPrefsDialogWidRadios *KPrefsDialog::addWidRadios(const QString &text,int *reference,QWidget *parent)
321{ 321{
322 KPrefsWidRadios *w = new KPrefsWidRadios(text,reference,parent); 322 KPrefsDialogWidRadios *w = new KPrefsDialogWidRadios(text,reference,parent);
323 addWid(w); 323 addWid(w);
324 return w; 324 return w;
325} 325}
326 326
327KPrefsWidString *KPrefsDialog::addWidString(const QString &text,QString *reference,QWidget *parent) 327KPrefsDialogWidString *KPrefsDialog::addWidString(const QString &text,QString *reference,QWidget *parent)
328{ 328{
329 KPrefsWidString *w = new KPrefsWidString(text,reference,parent); 329 KPrefsDialogWidString *w = new KPrefsDialogWidString(text,reference,parent);
330 addWid(w); 330 addWid(w);
331 return w; 331 return w;
332} 332}
333 333
334KPrefsWidString *KPrefsDialog::addWidPassword(const QString &text,QString *reference,QWidget *parent) 334KPrefsDialogWidString *KPrefsDialog::addWidPassword(const QString &text,QString *reference,QWidget *parent)
335{ 335{
336 KPrefsWidString *w = new KPrefsWidString(text,reference,parent,QLineEdit::Password); 336 KPrefsDialogWidString *w = new KPrefsDialogWidString(text,reference,parent,QLineEdit::Password);
337 addWid(w); 337 addWid(w);
338 return w; 338 return w;
339} 339}
340 340
341KPrefsWidFont *KPrefsDialog::addWidFont(const QString &sampleText,const QString &buttonText, 341KPrefsDialogWidFont *KPrefsDialog::addWidFont(const QString &sampleText,const QString &buttonText,
342 QFont *reference,QWidget *parent) 342 QFont *reference,QWidget *parent)
343{ 343{
344 KPrefsWidFont *w = new KPrefsWidFont(sampleText,buttonText,reference,parent); 344 KPrefsDialogWidFont *w = new KPrefsDialogWidFont(sampleText,buttonText,reference,parent);
345 addWid(w); 345 addWid(w);
346 return w; 346 return w;
347} 347}
348 348
349void KPrefsDialog::setDefaults() 349void KPrefsDialog::setDefaults()
350{ 350{
351 mPrefs->setDefaults(); 351 mPrefs->setDefaults();
352 352
353 readConfig(); 353 readConfig();
354} 354}
355 355
356void KPrefsDialog::readConfig() 356void KPrefsDialog::readConfig()
357{ 357{
358// kdDebug(5300) << "KPrefsDialog::readConfig()" << endl; 358// kdDebug(5300) << "KPrefsDialog::readConfig()" << endl;
359 359
360 KPrefsWid *wid; 360 KPrefsDialogWid *wid;
361 for(wid = mPrefsWids.first();wid;wid=mPrefsWids.next()) { 361 for(wid = mPrefsWids.first();wid;wid=mPrefsWids.next()) {
362 wid->readConfig(); 362 wid->readConfig();
363 } 363 }
364 364
365 usrReadConfig(); 365 usrReadConfig();
366} 366}
367 367
368void KPrefsDialog::writeConfig() 368void KPrefsDialog::writeConfig()
369{ 369{
370// kdDebug(5300) << "KPrefsDialog::writeConfig()" << endl; 370// kdDebug(5300) << "KPrefsDialog::writeConfig()" << endl;
371 371
372 KPrefsWid *wid; 372 KPrefsDialogWid *wid;
373 for(wid = mPrefsWids.first();wid;wid=mPrefsWids.next()) { 373 for(wid = mPrefsWids.first();wid;wid=mPrefsWids.next()) {
374 wid->writeConfig(); 374 wid->writeConfig();
375 } 375 }
376 376
377 usrWriteConfig(); 377 usrWriteConfig();
378 378
379// kdDebug(5300) << "KPrefsDialog::writeConfig() now writing..." << endl; 379// kdDebug(5300) << "KPrefsDialog::writeConfig() now writing..." << endl;
380 380
381 mPrefs->writeConfig(); 381 mPrefs->writeConfig();
382 382
383// kdDebug(5300) << "KPrefsDialog::writeConfig() done" << endl; 383// kdDebug(5300) << "KPrefsDialog::writeConfig() done" << endl;
384} 384}
385 385
386 386
387void KPrefsDialog::slotApply() 387void KPrefsDialog::slotApply()
388{ 388{
389 writeConfig(); 389 writeConfig();
390 emit configChanged(); 390 emit configChanged();
391} 391}
392 392
393void KPrefsDialog::slotOk() 393void KPrefsDialog::slotOk()
394{ 394{
395 slotApply(); 395 slotApply();
396 QDialog::accept(); 396 QDialog::accept();
397} 397}
398void KPrefsDialog::accept() 398void KPrefsDialog::accept()
399{ 399{
400 slotOk(); 400 slotOk();
401} 401}
402 402
403void KPrefsDialog::slotDefault() 403void KPrefsDialog::slotDefault()
404{ 404{
405 if (KMessageBox::warningContinueCancel(this, 405 if (KMessageBox::warningContinueCancel(this,
406 i18n("You are about to set all\npreferences to default values.\nAll " 406 i18n("You are about to set all\npreferences to default values.\nAll "
407 "custom modifications will be lost."),i18n("Setting Default Preferences"), 407 "custom modifications will be lost."),i18n("Setting Default Preferences"),
408 i18n("Continue")) 408 i18n("Continue"))
409 == KMessageBox::Continue) setDefaults(); 409 == KMessageBox::Continue) setDefaults();
410} 410}
diff --git a/libkdepim/kprefsdialog.h b/libkdepim/kprefsdialog.h
index dceab01..ad13b78 100644
--- a/libkdepim/kprefsdialog.h
+++ b/libkdepim/kprefsdialog.h
@@ -1,446 +1,446 @@
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 <qptrlist.h>
28#include <qlineedit.h> 28#include <qlineedit.h>
29 29
30#include <kdialogbase.h> 30#include <kdialogbase.h>
31 31
32class KPrefs; 32class KPrefs;
33class KPrefsDialog; 33class KPrefsDialog;
34 34
35class KColorButton; 35class KColorButton;
36class QCheckBox; 36class QCheckBox;
37class QLabel; 37class QLabel;
38class QSpinBox; 38class QSpinBox;
39class QButtonGroup; 39class QButtonGroup;
40 40
41/** 41/**
42 @short Base class for widgets used by @ref KPrefsDialog. 42 @short Base class for widgets used by @ref KPrefsDialog.
43 @author Cornelius Schumacher 43 @author Cornelius Schumacher
44 @see KPrefsDialog 44 @see KPrefsDialog
45 45
46 This class provides the interface for the preferences widgets used by 46 This class provides the interface for the preferences widgets used by
47 KPrefsDialog. 47 KPrefsDialog.
48*/ 48*/
49class KPrefsWid 49class KPrefsDialogWid
50{ 50{
51 public: 51 public:
52 /** 52 /**
53 This function is called to read value of the setting from the 53 This function is called to read value of the setting from the
54 stored configuration and display it in the widget. 54 stored configuration and display it in the widget.
55 */ 55 */
56 virtual void readConfig() = 0; 56 virtual void readConfig() = 0;
57 /** 57 /**
58 This function is called to write the current setting of the widget to the 58 This function is called to write the current setting of the widget to the
59 stored configuration. 59 stored configuration.
60 */ 60 */
61 virtual void writeConfig() = 0; 61 virtual void writeConfig() = 0;
62}; 62};
63 63
64/** 64/**
65 @short Widget for bool settings in @ref KPrefsDialog. 65 @short Widget for bool settings in @ref KPrefsDialog.
66 66
67 This class provides a widget for configuring bool values. It is meant to be 67 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. 68 used by KPrefsDialog. The user is responsible for the layout management.
69*/ 69*/
70class KPrefsWidBool : public KPrefsWid 70class KPrefsDialogWidBool : public KPrefsDialogWid
71{ 71{
72 public: 72 public:
73 /** 73 /**
74 Create a bool widget consisting of a QCheckbox. 74 Create a bool widget consisting of a QCheckbox.
75 75
76 @param text Text of QCheckBox. 76 @param text Text of QCheckBox.
77 @param reference Pointer to variable read and written by this widget. 77 @param reference Pointer to variable read and written by this widget.
78 @param parent Parent widget. 78 @param parent Parent widget.
79 */ 79 */
80 KPrefsWidBool(const QString &text,bool *reference,QWidget *parent); 80 KPrefsDialogWidBool(const QString &text,bool *reference,QWidget *parent);
81 81
82 /** 82 /**
83 Return the QCheckbox used by this widget. 83 Return the QCheckbox used by this widget.
84 */ 84 */
85 QCheckBox *checkBox(); 85 QCheckBox *checkBox();
86 86
87 void readConfig(); 87 void readConfig();
88 void writeConfig(); 88 void writeConfig();
89 89
90 private: 90 private:
91 bool *mReference; 91 bool *mReference;
92 92
93 QCheckBox *mCheck; 93 QCheckBox *mCheck;
94}; 94};
95 95
96/** 96/**
97 @short Widget for time settings in @ref KPrefsDialog. 97 @short Widget for time settings in @ref KPrefsDialog.
98 98
99 This class provides a widget for configuring time values. It is meant to be 99 This class provides a widget for configuring time values. It is meant to be
100 used by KPrefsDialog. The user is responsible for the layout management. 100 used by KPrefsDialog. The user is responsible for the layout management.
101*/ 101*/
102class KPrefsWidTime : public KPrefsWid 102class KPrefsDialogWidTime : public KPrefsDialogWid
103{ 103{
104 public: 104 public:
105 /** 105 /**
106 Create a time widget consisting of a label and a spinbox. 106 Create a time widget consisting of a label and a spinbox.
107 107
108 @param text Text of Label. 108 @param text Text of Label.
109 @param reference Pointer to variable read and written by this widget. 109 @param reference Pointer to variable read and written by this widget.
110 @param parent Parent widget. 110 @param parent Parent widget.
111 */ 111 */
112 KPrefsWidTime(const QString &text,int *reference,QWidget *parent); 112 KPrefsDialogWidTime(const QString &text,int *reference,QWidget *parent);
113 113
114 /** 114 /**
115 Return QLabel used by this widget. 115 Return QLabel used by this widget.
116 */ 116 */
117 QLabel *label(); 117 QLabel *label();
118 /** 118 /**
119 Return QSpinBox used by this widget. 119 Return QSpinBox used by this widget.
120 */ 120 */
121 QSpinBox *spinBox(); 121 QSpinBox *spinBox();
122 122
123 void readConfig(); 123 void readConfig();
124 void writeConfig(); 124 void writeConfig();
125 125
126 private: 126 private:
127 int *mReference; 127 int *mReference;
128 128
129 QLabel *mLabel; 129 QLabel *mLabel;
130 QSpinBox *mSpin; 130 QSpinBox *mSpin;
131}; 131};
132 132
133/** 133/**
134 @short Widget for color settings in @ref KPrefsDialog. 134 @short Widget for color settings in @ref KPrefsDialog.
135 135
136 This class provides a widget for configuring color values. It is meant to be 136 This class provides a widget for configuring color values. It is meant to be
137 used by KPrefsDialog. The user is responsible for the layout management. 137 used by KPrefsDialog. The user is responsible for the layout management.
138*/ 138*/
139class KPrefsWidColor : public QObject, public KPrefsWid 139class KPrefsDialogWidColor : public QObject, public KPrefsDialogWid
140{ 140{
141 Q_OBJECT 141 Q_OBJECT
142 public: 142 public:
143 /** 143 /**
144 Create a color widget consisting of a test field and a button for opening 144 Create a color widget consisting of a test field and a button for opening
145 a color dialog. 145 a color dialog.
146 146
147 @param text Text of button. 147 @param text Text of button.
148 @param reference Pointer to variable read and written by this widget. 148 @param reference Pointer to variable read and written by this widget.
149 @param parent Parent widget. 149 @param parent Parent widget.
150 */ 150 */
151 KPrefsWidColor(const QString &text,QColor *reference,QWidget *parent); 151 KPrefsDialogWidColor(const QString &text,QColor *reference,QWidget *parent);
152 /** 152 /**
153 Destruct color setting widget. 153 Destruct color setting widget.
154 */ 154 */
155 ~KPrefsWidColor(); 155 ~KPrefsDialogWidColor();
156 156
157 /** 157 /**
158 Return QLabel for the button 158 Return QLabel for the button
159 */ 159 */
160 QLabel *label(); 160 QLabel *label();
161 /** 161 /**
162 Return button opening the color dialog. 162 Return button opening the color dialog.
163 */ 163 */
164 KColorButton *button(); 164 KColorButton *button();
165 165
166 void readConfig(); 166 void readConfig();
167 void writeConfig(); 167 void writeConfig();
168 168
169 private: 169 private:
170 QColor *mReference; 170 QColor *mReference;
171 171
172 QLabel *mLabel; 172 QLabel *mLabel;
173 KColorButton *mButton; 173 KColorButton *mButton;
174}; 174};
175 175
176/** 176/**
177 @short Widget for font settings in @ref KPrefsDialog. 177 @short Widget for font settings in @ref KPrefsDialog.
178 178
179 This class provides a widget for configuring font values. It is meant to be 179 This class provides a widget for configuring font values. It is meant to be
180 used by KPrefsDialog. The user is responsible for the layout management. 180 used by KPrefsDialog. The user is responsible for the layout management.
181*/ 181*/
182class KPrefsWidFont : public QObject, public KPrefsWid 182class KPrefsDialogWidFont : public QObject, public KPrefsDialogWid
183{ 183{
184 Q_OBJECT 184 Q_OBJECT
185 public: 185 public:
186 /** 186 /**
187 Create a font widget consisting of a test field and a button for opening 187 Create a font widget consisting of a test field and a button for opening
188 a font dialog. 188 a font dialog.
189 189
190 @param label Text of label. 190 @param label Text of label.
191 @param reference Pointer to variable read and written by this widget. 191 @param reference Pointer to variable read and written by this widget.
192 @param parent Parent widget. 192 @param parent Parent widget.
193 */ 193 */
194 KPrefsWidFont(const QString &sampleText,const QString &labelText, 194 KPrefsDialogWidFont(const QString &sampleText,const QString &labelText,
195 QFont *reference,QWidget *parent); 195 QFont *reference,QWidget *parent);
196 /** 196 /**
197 Destruct font setting widget. 197 Destruct font setting widget.
198 */ 198 */
199 ~KPrefsWidFont(); 199 ~KPrefsDialogWidFont();
200 200
201 /** 201 /**
202 Return label. 202 Return label.
203 */ 203 */
204 QLabel *label(); 204 QLabel *label();
205 /** 205 /**
206 Return QFrame used as preview field. 206 Return QFrame used as preview field.
207 */ 207 */
208 QLabel *preview(); 208 QLabel *preview();
209 /** 209 /**
210 Return button opening the font dialog. 210 Return button opening the font dialog.
211 */ 211 */
212 QPushButton *button(); 212 QPushButton *button();
213 213
214 void readConfig(); 214 void readConfig();
215 void writeConfig(); 215 void writeConfig();
216 216
217 protected slots: 217 protected slots:
218 void selectFont(); 218 void selectFont();
219 219
220 private: 220 private:
221 QFont *mReference; 221 QFont *mReference;
222 222
223 QLabel *mLabel; 223 QLabel *mLabel;
224 QLabel *mPreview; 224 QLabel *mPreview;
225 QPushButton *mButton; 225 QPushButton *mButton;
226}; 226};
227 227
228/** 228/**
229 @short Widget for settings represented by a group of radio buttons in 229 @short Widget for settings represented by a group of radio buttons in
230 @ref KPrefsDialog. 230 @ref KPrefsDialog.
231 231
232 This class provides a widget for configuring selections. It is meant to be 232 This class provides a widget for configuring selections. It is meant to be
233 used by KPrefsDialog. The user is responsible for the layout management. The 233 used by KPrefsDialog. The user is responsible for the layout management. The
234 setting is interpreted as an int value, corresponding to the position of the 234 setting is interpreted as an int value, corresponding to the position of the
235 radio button. The position of the button is defined by the sequence of @ref 235 radio button. The position of the button is defined by the sequence of @ref
236 addRadio() calls, starting with 0. 236 addRadio() calls, starting with 0.
237*/ 237*/
238class KPrefsWidRadios : public KPrefsWid 238class KPrefsDialogWidRadios : public KPrefsDialogWid
239{ 239{
240 public: 240 public:
241 /** 241 /**
242 Create a widget for selection of an option. It consists of a box with 242 Create a widget for selection of an option. It consists of a box with
243 several radio buttons. 243 several radio buttons.
244 244
245 @param text Text of main box. 245 @param text Text of main box.
246 @param reference Pointer to variable read and written by this widget. 246 @param reference Pointer to variable read and written by this widget.
247 @param parent Parent widget. 247 @param parent Parent widget.
248 */ 248 */
249 KPrefsWidRadios(const QString &text,int *reference,QWidget *parent); 249 KPrefsDialogWidRadios(const QString &text,int *reference,QWidget *parent);
250 virtual ~KPrefsWidRadios(); 250 virtual ~KPrefsDialogWidRadios();
251 251
252 /** 252 /**
253 Add a radio button. 253 Add a radio button.
254 254
255 @param text Text of the button. 255 @param text Text of the button.
256 */ 256 */
257 void addRadio(const QString &text); 257 void addRadio(const QString &text);
258 258
259 /** 259 /**
260 Return the box widget used by this widget. 260 Return the box widget used by this widget.
261 */ 261 */
262 QButtonGroup *groupBox(); 262 QButtonGroup *groupBox();
263 263
264 void readConfig(); 264 void readConfig();
265 void writeConfig(); 265 void writeConfig();
266 266
267 private: 267 private:
268 int *mReference; 268 int *mReference;
269 269
270 QButtonGroup *mBox; 270 QButtonGroup *mBox;
271}; 271};
272 272
273 273
274/** 274/**
275 @short Widget for string settings in @ref KPrefsDialog. 275 @short Widget for string settings in @ref KPrefsDialog.
276 276
277 This class provides a widget for configuring string values. It is meant to be 277 This class provides a widget for configuring string values. It is meant to be
278 used by KPrefsDialog. The user is responsible for the layout management. 278 used by KPrefsDialog. The user is responsible for the layout management.
279*/ 279*/
280class KPrefsWidString : public KPrefsWid 280class KPrefsDialogWidString : public KPrefsDialogWid
281{ 281{
282 public: 282 public:
283 /** 283 /**
284 Create a string widget consisting of a test label and a line edit. 284 Create a string widget consisting of a test label and a line edit.
285 285
286 @param text Text of label. 286 @param text Text of label.
287 @param reference Pointer to variable read and written by this widget. 287 @param reference Pointer to variable read and written by this widget.
288 @param parent Parent widget. 288 @param parent Parent widget.
289 */ 289 */
290 KPrefsWidString(const QString &text,QString *reference,QWidget *parent,QLineEdit::EchoMode echomode=QLineEdit::Normal); 290 KPrefsDialogWidString(const QString &text,QString *reference,QWidget *parent,QLineEdit::EchoMode echomode=QLineEdit::Normal);
291 /** 291 /**
292 Destructor. 292 Destructor.
293 */ 293 */
294 virtual ~KPrefsWidString(); 294 virtual ~KPrefsDialogWidString();
295 295
296 /** 296 /**
297 Return label used by this widget. 297 Return label used by this widget.
298 */ 298 */
299 QLabel *label(); 299 QLabel *label();
300 /** 300 /**
301 Return QLineEdit used by this widget. 301 Return QLineEdit used by this widget.
302 */ 302 */
303 QLineEdit *lineEdit(); 303 QLineEdit *lineEdit();
304 304
305 void readConfig(); 305 void readConfig();
306 void writeConfig(); 306 void writeConfig();
307 307
308 private: 308 private:
309 QString *mReference; 309 QString *mReference;
310 310
311 QLabel *mLabel; 311 QLabel *mLabel;
312 QLineEdit *mEdit; 312 QLineEdit *mEdit;
313}; 313};
314 314
315 315
316/** 316/**
317 @short Base class for a preferences dialog. 317 @short Base class for a preferences dialog.
318 318
319 This class provides the framework for a preferences dialog. You have to 319 This class provides the framework for a preferences dialog. You have to
320 subclass it and add the code to create the actual configuration widgets and 320 subclass it and add the code to create the actual configuration widgets and
321 do the layout management. 321 do the layout management.
322 322
323 KPrefsDialog provides functions to add subclasses of @ref KPrefsWid. For 323 KPrefsDialog provides functions to add subclasses of @ref KPrefsDialogWid. For
324 these widgets the reading, writing and setting to default values is handled 324 these widgets the reading, writing and setting to default values is handled
325 automatically. Custom widgets have to be handled in the functions @ref 325 automatically. Custom widgets have to be handled in the functions @ref
326 usrReadConfig() and @ref usrWriteConfig(). 326 usrReadConfig() and @ref usrWriteConfig().
327*/ 327*/
328class KPrefsDialog : public KDialogBase 328class KPrefsDialog : public KDialogBase
329{ 329{
330 Q_OBJECT 330 Q_OBJECT
331 public: 331 public:
332 /** 332 /**
333 Create a KPrefsDialog for a KPrefs object. 333 Create a KPrefsDialog for a KPrefs object.
334 334
335 @param prefs KPrefs object used to access te configuration. 335 @param prefs KPrefs object used to access te configuration.
336 @param parent Parent widget. 336 @param parent Parent widget.
337 @param name Widget name. 337 @param name Widget name.
338 @param modal true, if dialog has to be modal, false for non-modal. 338 @param modal true, if dialog has to be modal, false for non-modal.
339 */ 339 */
340 KPrefsDialog(KPrefs *prefs,QWidget *parent=0,char *name=0,bool modal=false); 340 KPrefsDialog(KPrefs *prefs,QWidget *parent=0,char *name=0,bool modal=false);
341 /** 341 /**
342 Destructor. 342 Destructor.
343 */ 343 */
344 virtual ~KPrefsDialog(); 344 virtual ~KPrefsDialog();
345 345
346 /** 346 /**
347 Register a custom KPrefsWid object. 347 Register a custom KPrefsDialogWid object.
348 */ 348 */
349 void addWid(KPrefsWid *); 349 void addWid(KPrefsDialogWid *);
350 /** 350 /**
351 Register a @ref KPrefsWidBool object. 351 Register a @ref KPrefsDialogWidBool object.
352 352
353 @param text Text of bool widget. 353 @param text Text of bool widget.
354 @param reference Reference to variable storing the setting. 354 @param reference Reference to variable storing the setting.
355 @param parent Parent widget. 355 @param parent Parent widget.
356 */ 356 */
357 KPrefsWidBool *addWidBool(const QString &text,bool *reference,QWidget *parent); 357 KPrefsDialogWidBool *addWidBool(const QString &text,bool *reference,QWidget *parent);
358 /** 358 /**
359 Register a @ref KPrefsWidTime object. 359 Register a @ref KPrefsDialogWidTime object.
360 360
361 @param text Text of time widget. 361 @param text Text of time widget.
362 @param reference Reference to variable storing the setting. 362 @param reference Reference to variable storing the setting.
363 @param parent Parent widget. 363 @param parent Parent widget.
364 */ 364 */
365 KPrefsWidTime *addWidTime(const QString &text,int *reference,QWidget *parent); 365 KPrefsDialogWidTime *addWidTime(const QString &text,int *reference,QWidget *parent);
366 /** 366 /**
367 Register a @ref KPrefsWidColor object. 367 Register a @ref KPrefsDialogWidColor object.
368 368
369 @param text Text of color widget. 369 @param text Text of color widget.
370 @param reference Reference to variable storing the setting. 370 @param reference Reference to variable storing the setting.
371 @param parent Parent widget. 371 @param parent Parent widget.
372 */ 372 */
373 KPrefsWidColor *addWidColor(const QString &text,QColor *reference,QWidget *parent); 373 KPrefsDialogWidColor *addWidColor(const QString &text,QColor *reference,QWidget *parent);
374 /** 374 /**
375 Register a @ref KPrefsWidRadios object. 375 Register a @ref KPrefsDialogWidRadios object.
376 376
377 @param text Text of radio button box widget. 377 @param text Text of radio button box widget.
378 @param reference Reference to variable storing the setting. 378 @param reference Reference to variable storing the setting.
379 @param parent Parent widget. 379 @param parent Parent widget.
380 */ 380 */
381 KPrefsWidRadios *addWidRadios(const QString &text,int *reference,QWidget *parent); 381 KPrefsDialogWidRadios *addWidRadios(const QString &text,int *reference,QWidget *parent);
382 /** 382 /**
383 Register a @ref KPrefsWidString object. 383 Register a @ref KPrefsDialogWidString object.
384 384
385 @param text Text of string widget. 385 @param text Text of string widget.
386 @param reference Reference to variable storing the setting. 386 @param reference Reference to variable storing the setting.
387 @param parent Parent widget. 387 @param parent Parent widget.
388 */ 388 */
389 KPrefsWidString *addWidString(const QString &text,QString *reference,QWidget *parent); 389 KPrefsDialogWidString *addWidString(const QString &text,QString *reference,QWidget *parent);
390 /** 390 /**
391 Register a password @ref KPrefsWidString object, with echomode set to QLineEdit::Password. 391 Register a password @ref KPrefsDialogWidString object, with echomode set to QLineEdit::Password.
392 392
393 @param text Text of string widget. 393 @param text Text of string widget.
394 @param reference Reference to variable storing the setting. 394 @param reference Reference to variable storing the setting.
395 @param parent Parent widget. 395 @param parent Parent widget.
396 */ 396 */
397 KPrefsWidString *addWidPassword (const QString &text,QString *reference,QWidget *parent); 397 KPrefsDialogWidString *addWidPassword (const QString &text,QString *reference,QWidget *parent);
398 /** 398 /**
399 Register a @ref KPrefsWidFont object. 399 Register a @ref KPrefsDialogWidFont object.
400 400
401 @param sampleText Sample text of font widget. 401 @param sampleText Sample text of font widget.
402 @param buttonText Button text of font widget. 402 @param buttonText Button text of font widget.
403 @param reference Reference to variable storing the setting. 403 @param reference Reference to variable storing the setting.
404 @param parent Parent widget. 404 @param parent Parent widget.
405 */ 405 */
406 KPrefsWidFont *addWidFont(const QString &sampleText,const QString &buttonText, 406 KPrefsDialogWidFont *addWidFont(const QString &sampleText,const QString &buttonText,
407 QFont *reference,QWidget *parent); 407 QFont *reference,QWidget *parent);
408 408
409 public slots: 409 public slots:
410 /** Set all widgets to default values. */ 410 /** Set all widgets to default values. */
411 void setDefaults(); 411 void setDefaults();
412 412
413 /** Read preferences from config file. */ 413 /** Read preferences from config file. */
414 void readConfig(); 414 void readConfig();
415 415
416 /** Write preferences to config file. */ 416 /** Write preferences to config file. */
417 void writeConfig(); 417 void writeConfig();
418 418
419 signals: 419 signals:
420 /** Emitted when the a changed configuration has been stored. */ 420 /** Emitted when the a changed configuration has been stored. */
421 void configChanged(); 421 void configChanged();
422 422
423 protected slots: 423 protected slots:
424 /** Apply changes to preferences */ 424 /** Apply changes to preferences */
425 void slotApply(); 425 void slotApply();
426 426
427 void accept(); 427 void accept();
428 /** Accept changes to preferences and close dialog */ 428 /** Accept changes to preferences and close dialog */
429 void slotOk(); 429 void slotOk();
430 430
431 /** Set preferences to default values */ 431 /** Set preferences to default values */
432 void slotDefault(); 432 void slotDefault();
433 433
434 protected: 434 protected:
435 /** Implement this to read custom configuration widgets. */ 435 /** Implement this to read custom configuration widgets. */
436 virtual void usrReadConfig() {} 436 virtual void usrReadConfig() {}
437 /** Implement this to write custom configuration widgets. */ 437 /** Implement this to write custom configuration widgets. */
438 virtual void usrWriteConfig() {} 438 virtual void usrWriteConfig() {}
439 439
440 private: 440 private:
441 KPrefs *mPrefs; 441 KPrefs *mPrefs;
442 442
443 QPtrList<KPrefsWid> mPrefsWids; 443 QPtrList<KPrefsDialogWid> mPrefsWids;
444}; 444};
445 445
446#endif 446#endif
diff --git a/libkdepim/libkdepimE.pro b/libkdepim/libkdepimE.pro
index 69980e3..2a30ee8 100644
--- a/libkdepim/libkdepimE.pro
+++ b/libkdepim/libkdepimE.pro
@@ -1,51 +1,53 @@
1 TEMPLATE= lib 1 TEMPLATE= lib
2 CONFIG += qt warn_on 2 CONFIG += qt warn_on
3TARGET = microkdepim 3TARGET = microkdepim
4INCLUDEPATH += . $(KDEPIMDIR) $(KDEPIMDIR)/microkde $(KDEPIMDIR)/qtcompat $(KDEPIMDIR)/microkde/kdecore $(KDEPIMDIR)/microkde/kdeui $(QPEDIR)/include 4INCLUDEPATH += . $(KDEPIMDIR) $(KDEPIMDIR)/microkde $(KDEPIMDIR)/qtcompat $(KDEPIMDIR)/microkde/kdecore $(KDEPIMDIR)/microkde/kdeui $(QPEDIR)/include
5LIBS += -lmicrokde 5LIBS += -lmicrokde
6#LIBS += -lmicrokcal 6#LIBS += -lmicrokcal
7LIBS += -L$(QPEDIR)/lib 7LIBS += -L$(QPEDIR)/lib
8OBJECTS_DIR = obj/$(PLATFORM) 8OBJECTS_DIR = obj/$(PLATFORM)
9MOC_DIR = moc/$(PLATFORM) 9MOC_DIR = moc/$(PLATFORM)
10DESTDIR=$(QPEDIR)/lib 10DESTDIR=$(QPEDIR)/lib
11 11
12 12
13INTERFACES = \ 13INTERFACES = \
14 14
15HEADERS = \ 15HEADERS = \
16 categoryeditdialog.h \ 16 categoryeditdialog.h \
17 categoryeditdialog_base.h \ 17 categoryeditdialog_base.h \
18 categoryselectdialog.h \ 18 categoryselectdialog.h \
19 categoryselectdialog_base.h \ 19 categoryselectdialog_base.h \
20 externalapphandler.h \ 20 externalapphandler.h \
21 kdateedit.h \ 21 kdateedit.h \
22 kdatepicker.h \ 22 kdatepicker.h \
23 kinputdialog.h \ 23 kinputdialog.h \
24 kpimprefs.h \ 24 kpimprefs.h \
25 kpimglobalprefs.h \ 25 kpimglobalprefs.h \
26 kprefsdialog.h \ 26 kprefsdialog.h \
27 kprefswidget.h \
27 ksyncprofile.h \ 28 ksyncprofile.h \
28 ksyncprefsdialog.h \ 29 ksyncprefsdialog.h \
29 kcmconfigs/kcmkdepimconfig.h \ 30 kcmconfigs/kcmkdepimconfig.h \
30 kcmconfigs/kdepimconfigwidget.h 31 kcmconfigs/kdepimconfigwidget.h
31 32
32 33
33 34
34SOURCES = \ 35SOURCES = \
35 categoryeditdialog.cpp \ 36 categoryeditdialog.cpp \
36 categoryeditdialog_base.cpp \ 37 categoryeditdialog_base.cpp \
37 categoryselectdialog.cpp \ 38 categoryselectdialog.cpp \
38 categoryselectdialog_base.cpp \ 39 categoryselectdialog_base.cpp \
39 externalapphandler.cpp \ 40 externalapphandler.cpp \
40 kdateedit.cpp \ 41 kdateedit.cpp \
41 kinputdialog.cpp \ 42 kinputdialog.cpp \
42 kdatepicker.cpp \ 43 kdatepicker.cpp \
43 kpimprefs.cpp \ 44 kpimprefs.cpp \
44 kpimglobalprefs.cpp \ 45 kpimglobalprefs.cpp \
45 kprefsdialog.cpp \ 46 kprefsdialog.cpp \
47 kprefswidget.cpp \
46 ksyncprofile.cpp \ 48 ksyncprofile.cpp \
47 ksyncprefsdialog.cpp \ 49 ksyncprefsdialog.cpp \
48 kcmconfigs/kcmkdepimconfig.cpp \ 50 kcmconfigs/kcmkdepimconfig.cpp \
49 kcmconfigs/kdepimconfigwidget.cpp 51 kcmconfigs/kdepimconfigwidget.cpp
50 52
51 53