summaryrefslogtreecommitdiffabout
Unidiff
Diffstat (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
@@ -35,45 +35,46 @@ $Id$
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
@@ -32,23 +32,23 @@ $Id$
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
@@ -25,29 +25,31 @@
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>
@@ -62,67 +64,74 @@ $Id$
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 );
@@ -159,30 +168,200 @@ KDEPIMConfigWidget::KDEPIMConfigWidget( QWidget *parent, const char *name )
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):
@@ -219,25 +398,25 @@ void KDEPIMConfigWidget::client_changed( int newClient )
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();
@@ -435,32 +614,44 @@ void KDEPIMConfigWidget::updateClientWidgets()
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
@@ -482,32 +673,51 @@ void KDEPIMConfigWidget::restoreSettings(KPimGlobalPrefs* prefs)
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
@@ -523,82 +733,39 @@ void KDEPIMConfigWidget::saveSettings(KPimGlobalPrefs* prefs)
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
@@ -22,73 +22,82 @@
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
diff --git a/libkdepim/kpimglobalprefs.cpp b/libkdepim/kpimglobalprefs.cpp
index eb8f1de..12a503d 100644
--- a/libkdepim/kpimglobalprefs.cpp
+++ b/libkdepim/kpimglobalprefs.cpp
@@ -34,24 +34,45 @@ $Id$
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, "" );
diff --git a/libkdepim/kpimglobalprefs.h b/libkdepim/kpimglobalprefs.h
index 8bd543d..dad78e6 100644
--- a/libkdepim/kpimglobalprefs.h
+++ b/libkdepim/kpimglobalprefs.h
@@ -75,24 +75,39 @@ class KPimGlobalPrefs : public KPrefs
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
diff --git a/libkdepim/kpimprefs.cpp b/libkdepim/kpimprefs.cpp
index 140a286..a9ea330 100644
--- a/libkdepim/kpimprefs.cpp
+++ b/libkdepim/kpimprefs.cpp
@@ -55,12 +55,18 @@ void KPimPrefs::usrReadConfig()
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
@@ -49,16 +49,16 @@ class KPimPrefs : public KPrefs
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
@@ -48,337 +48,337 @@
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}
diff --git a/libkdepim/kprefsdialog.h b/libkdepim/kprefsdialog.h
index dceab01..ad13b78 100644
--- a/libkdepim/kprefsdialog.h
+++ b/libkdepim/kprefsdialog.h
@@ -37,88 +37,88 @@ class 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();
@@ -127,41 +127,41 @@ class KPrefsWidTime : public KPrefsWid
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();
@@ -170,42 +170,42 @@ class KPrefsWidColor : public QObject, public KPrefsWid
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 */
@@ -226,37 +226,37 @@ class KPrefsWidFont : public QObject, public KPrefsWid
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();
@@ -268,39 +268,39 @@ class KPrefsWidRadios : public KPrefsWid
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();
@@ -311,108 +311,108 @@ class KPrefsWidString : public KPrefsWid
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
@@ -431,16 +431,16 @@ class KPrefsDialog : public KDialogBase
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
@@ -15,37 +15,39 @@ INTERFACES = \
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