author | ulf69 <ulf69> | 2004-09-21 19:50:27 (UTC) |
---|---|---|
committer | ulf69 <ulf69> | 2004-09-21 19:50:27 (UTC) |
commit | 93313aa8d66c01aa0e4562449020af20b5cef0a7 (patch) (unidiff) | |
tree | 7bf9930c58b4651a29b5aa4210742340c9439bc8 /libkdepim/kcmconfigs | |
parent | c2cce86fdb2d0b291c3d3bdfa9fac47452153d1a (diff) | |
download | kdepimpi-93313aa8d66c01aa0e4562449020af20b5cef0a7.zip kdepimpi-93313aa8d66c01aa0e4562449020af20b5cef0a7.tar.gz kdepimpi-93313aa8d66c01aa0e4562449020af20b5cef0a7.tar.bz2 |
added edit elements for global prefs
-rw-r--r-- | libkdepim/kcmconfigs/kcmkdepimconfig.cpp | 17 | ||||
-rw-r--r-- | libkdepim/kcmconfigs/kcmkdepimconfig.h | 2 | ||||
-rw-r--r-- | libkdepim/kcmconfigs/kdepimconfigwidget.cpp | 313 | ||||
-rw-r--r-- | libkdepim/kcmconfigs/kdepimconfigwidget.h | 45 |
4 files changed, 277 insertions, 100 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 | |||
@@ -44,18 +44,18 @@ $Id$ | |||
44 | #ifndef _WIN32_ | 44 | #ifndef _WIN32_ |
45 | extern "C" | 45 | extern "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 | ||
53 | KCMKdePimConfig::KCMKdePimConfig( KPimGlobalPrefs* prefs, QWidget *parent, const char *name ) | 53 | KCMKdePimConfig::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 ); |
@@ -65,15 +65,16 @@ KCMKdePimConfig::KCMKdePimConfig( KPimGlobalPrefs* prefs, QWidget *parent, const | |||
65 | 65 | ||
66 | void KCMKdePimConfig::load() | 66 | void KCMKdePimConfig::load() |
67 | { | 67 | { |
68 | mConfigWidget->restoreSettings((KPimGlobalPrefs*)getPreferences()); | 68 | mConfigWidget->readConfig(); |
69 | } | 69 | } |
70 | 70 | ||
71 | void KCMKdePimConfig::save() | 71 | void KCMKdePimConfig::save() |
72 | { | 72 | { |
73 | mConfigWidget->saveSettings((KPimGlobalPrefs*)getPreferences()); | 73 | mConfigWidget->writeConfig(); |
74 | } | 74 | } |
75 | 75 | ||
76 | void KCMKdePimConfig::defaults() | 76 | void 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 | |||
@@ -41,7 +41,7 @@ class KCMKdePimConfig : public KCModule | |||
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(); |
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 | |||
@@ -34,11 +34,13 @@ $Id$ | |||
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 |
@@ -71,13 +73,15 @@ $Id$ | |||
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 | ||
79 | KDEPIMConfigWidget::KDEPIMConfigWidget( QWidget *parent, const char *name ) | 83 | KDEPIMConfigWidget::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")); |
@@ -90,12 +94,19 @@ KDEPIMConfigWidget::KDEPIMConfigWidget( QWidget *parent, const char *name ) | |||
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 | 108 | void 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() ); |
@@ -112,8 +123,6 @@ KDEPIMConfigWidget::KDEPIMConfigWidget( QWidget *parent, const char *name ) | |||
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 | ||
@@ -168,12 +177,182 @@ KDEPIMConfigWidget::KDEPIMConfigWidget( QWidget *parent, const char *name ) | |||
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 | |||
186 | void 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 | |||
246 | void 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 | |||
287 | void 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 | |||
177 | void KDEPIMConfigWidget::externalapp_changed( int newApp ) | 356 | void KDEPIMConfigWidget::externalapp_changed( int newApp ) |
178 | { | 357 | { |
179 | // first store the current data | 358 | // first store the current data |
@@ -228,7 +407,7 @@ void KDEPIMConfigWidget::client_changed( int newClient ) | |||
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 | ||
234 | void KDEPIMConfigWidget::saveEditFieldSettings() | 413 | void KDEPIMConfigWidget::saveEditFieldSettings() |
@@ -444,14 +623,26 @@ void KDEPIMConfigWidget::updateClientWidgets() | |||
444 | 623 | ||
445 | } | 624 | } |
446 | 625 | ||
447 | 626 | void KDEPIMConfigWidget::usrReadConfig() | |
448 | |||
449 | |||
450 | void 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; |
@@ -491,14 +682,33 @@ void KDEPIMConfigWidget::restoreSettings(KPimGlobalPrefs* prefs) | |||
491 | 682 | ||
492 | blockSignals( blocked ); | 683 | blockSignals( blocked ); |
493 | 684 | ||
494 | emit changed( false ); | ||
495 | |||
496 | } | 685 | } |
497 | 686 | ||
498 | void KDEPIMConfigWidget::saveSettings(KPimGlobalPrefs* prefs) | 687 | void 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; |
@@ -532,72 +742,29 @@ void KDEPIMConfigWidget::saveSettings(KPimGlobalPrefs* prefs) | |||
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 | ||
543 | void 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); | 751 | void 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 | |||
596 | void 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 | |||
601 | void KDEPIMConfigWidget::textChanged( const QString& text ) | 768 | void KDEPIMConfigWidget::textChanged( const QString& text ) |
602 | { | 769 | { |
603 | emit changed( true ); | 770 | emit changed( true ); |
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 | |||
@@ -31,42 +31,34 @@ $Id$ | |||
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 | /* | ||
41 | class QCheckBox; | ||
42 | class QListViewItem; | ||
43 | class QPushButton; | ||
44 | class KListView; | ||
45 | */ | ||
46 | class QComboBox; | 40 | class QComboBox; |
47 | class QLineEdit; | 41 | class QLineEdit; |
48 | class KPimGlobalPrefs; | 42 | class KPimGlobalPrefs; |
49 | class QGroupBox; | 43 | class QGroupBox; |
44 | class QTabWidget; | ||
45 | class KDateEdit; | ||
50 | 46 | ||
51 | class KDEPIMConfigWidget : public QWidget | 47 | class 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: |
@@ -77,9 +69,26 @@ class KDEPIMConfigWidget : public QWidget | |||
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 | ||