author | zautrix <zautrix> | 2004-08-20 23:53:07 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2004-08-20 23:53:07 (UTC) |
commit | ab07441b413dff6d478e2c3a39b823b4269931c5 (patch) (unidiff) | |
tree | 5de6576a6c0e20e4af2db7baa5019aa983e2195a /korganizer | |
parent | bc33238f8038a03e04f25ea608c53e784616fee6 (diff) | |
download | kdepimpi-ab07441b413dff6d478e2c3a39b823b4269931c5.zip kdepimpi-ab07441b413dff6d478e2c3a39b823b4269931c5.tar.gz kdepimpi-ab07441b413dff6d478e2c3a39b823b4269931c5.tar.bz2 |
Sync fixes and fix of config loading bug
-rw-r--r-- | korganizer/koprefs.cpp | 118 |
1 files changed, 60 insertions, 58 deletions
diff --git a/korganizer/koprefs.cpp b/korganizer/koprefs.cpp index 0db8e6d..dd978bf 100644 --- a/korganizer/koprefs.cpp +++ b/korganizer/koprefs.cpp | |||
@@ -265,302 +265,304 @@ KOPrefs::KOPrefs() : | |||
265 | addItemBool("SetTimeToDayStartAt",&mSetTimeToDayStartAt,true); | 265 | addItemBool("SetTimeToDayStartAt",&mSetTimeToDayStartAt,true); |
266 | addItemBool("HighlightCurrentDay",&mHighlightCurrentDay,true); | 266 | addItemBool("HighlightCurrentDay",&mHighlightCurrentDay,true); |
267 | addItemBool("WNViewShowsParents",&mWNViewShowsParents,true); | 267 | addItemBool("WNViewShowsParents",&mWNViewShowsParents,true); |
268 | addItemBool("WNViewShowLocation",&mWNViewShowLocation,false); | 268 | addItemBool("WNViewShowLocation",&mWNViewShowLocation,false); |
269 | addItemBool("UseHighlightLightColor",&mUseHighlightLightColor,false); | 269 | addItemBool("UseHighlightLightColor",&mUseHighlightLightColor,false); |
270 | addItemBool("ListViewMonthTimespan",&mListViewMonthTimespan,true); | 270 | addItemBool("ListViewMonthTimespan",&mListViewMonthTimespan,true); |
271 | addItemBool("TodoViewUsesCatColors",&mTodoViewUsesCatColors,false); | 271 | addItemBool("TodoViewUsesCatColors",&mTodoViewUsesCatColors,false); |
272 | addItemBool("TodoViewShowsPercentage",&mTodoViewShowsPercentage,false); | 272 | addItemBool("TodoViewShowsPercentage",&mTodoViewShowsPercentage,false); |
273 | addItemBool("TodoViewUsesSmallFont",&mTodoViewUsesSmallFont,false); | 273 | addItemBool("TodoViewUsesSmallFont",&mTodoViewUsesSmallFont,false); |
274 | addItemBool("TodoViewUsesForegroundColor",&mTodoViewUsesForegroundColor,false); | 274 | addItemBool("TodoViewUsesForegroundColor",&mTodoViewUsesForegroundColor,false); |
275 | addItemBool("MonthViewUsesForegroundColor",&mMonthViewUsesForegroundColor,false); | 275 | addItemBool("MonthViewUsesForegroundColor",&mMonthViewUsesForegroundColor,false); |
276 | #ifdef DESKTOP_VERSION | 276 | #ifdef DESKTOP_VERSION |
277 | addItemBool("UseInternalAlarmNotification",&mUseInternalAlarmNotification,true); | 277 | addItemBool("UseInternalAlarmNotification",&mUseInternalAlarmNotification,true); |
278 | #else | 278 | #else |
279 | addItemBool("UseInternalAlarmNotification",&mUseInternalAlarmNotification,false); | 279 | addItemBool("UseInternalAlarmNotification",&mUseInternalAlarmNotification,false); |
280 | #endif | 280 | #endif |
281 | addItemInt("Day Begins",&mDayBegins,7); | 281 | addItemInt("Day Begins",&mDayBegins,7); |
282 | addItemInt("Working Hours Start",&mWorkingHoursStart,8); | 282 | addItemInt("Working Hours Start",&mWorkingHoursStart,8); |
283 | addItemInt("Working Hours End",&mWorkingHoursEnd,17); | 283 | addItemInt("Working Hours End",&mWorkingHoursEnd,17); |
284 | addItemBool("Exclude Holidays",&mExcludeHolidays,true); | 284 | addItemBool("Exclude Holidays",&mExcludeHolidays,true); |
285 | addItemBool("Exclude Saturdays",&mExcludeSaturdays,true); | 285 | addItemBool("Exclude Saturdays",&mExcludeSaturdays,true); |
286 | 286 | ||
287 | addItemBool("Month View Uses Category Color",&mMonthViewUsesCategoryColor,false); | 287 | addItemBool("Month View Uses Category Color",&mMonthViewUsesCategoryColor,false); |
288 | addItemBool("Full View Month",&mFullViewMonth,true); | 288 | addItemBool("Full View Month",&mFullViewMonth,true); |
289 | addItemBool("Full View Todo",&mFullViewTodo,true); | 289 | addItemBool("Full View Todo",&mFullViewTodo,true); |
290 | addItemBool("Quick Todo",&mEnableQuickTodo,false); | 290 | addItemBool("Quick Todo",&mEnableQuickTodo,false); |
291 | 291 | ||
292 | addItemInt("Next X Days",&mNextXDays,3); | 292 | addItemInt("Next X Days",&mNextXDays,3); |
293 | 293 | ||
294 | KPrefs::setCurrentGroup("Printer"); | 294 | KPrefs::setCurrentGroup("Printer"); |
295 | 295 | ||
296 | KPrefs::setCurrentGroup("Layout"); | 296 | KPrefs::setCurrentGroup("Layout"); |
297 | 297 | ||
298 | addItemBool("CompactDialogs",&mCompactDialogs,false); | 298 | addItemBool("CompactDialogs",&mCompactDialogs,false); |
299 | addItemBool("VerticalScreen",&mVerticalScreen,true); | 299 | addItemBool("VerticalScreen",&mVerticalScreen,true); |
300 | 300 | ||
301 | KPrefs::setCurrentGroup("KOrganizer Plugins"); | 301 | KPrefs::setCurrentGroup("KOrganizer Plugins"); |
302 | 302 | ||
303 | addItemStringList("SelectedPlugins",&mSelectedPlugins,"holidays"); | 303 | addItemStringList("SelectedPlugins",&mSelectedPlugins,"holidays"); |
304 | 304 | ||
305 | KPrefs::setCurrentGroup("Group Scheduling"); | 305 | KPrefs::setCurrentGroup("Group Scheduling"); |
306 | 306 | ||
307 | addItemInt("IMIPScheduler",&mIMIPScheduler,IMIPKMail); | 307 | addItemInt("IMIPScheduler",&mIMIPScheduler,IMIPKMail); |
308 | addItemInt("IMIPSend",&mIMIPSend,IMIPdirectsend); | 308 | addItemInt("IMIPSend",&mIMIPSend,IMIPdirectsend); |
309 | addItemStringList("AdditionalMails",&mAdditionalMails,""); | 309 | addItemStringList("AdditionalMails",&mAdditionalMails,""); |
310 | addItemInt("IMIP auto refresh",&mIMIPAutoRefresh,neverAuto); | 310 | addItemInt("IMIP auto refresh",&mIMIPAutoRefresh,neverAuto); |
311 | addItemInt("IMIP auto insert request",&mIMIPAutoInsertRequest,neverAuto); | 311 | addItemInt("IMIP auto insert request",&mIMIPAutoInsertRequest,neverAuto); |
312 | addItemInt("IMIP auto insert reply",&mIMIPAutoInsertReply,neverAuto); | 312 | addItemInt("IMIP auto insert reply",&mIMIPAutoInsertReply,neverAuto); |
313 | addItemInt("IMIP auto FreeBusy",&mIMIPAutoFreeBusy,neverAuto); | 313 | addItemInt("IMIP auto FreeBusy",&mIMIPAutoFreeBusy,neverAuto); |
314 | addItemInt("IMIP auto save FreeBusy",&mIMIPAutoFreeBusyReply,neverAuto); | 314 | addItemInt("IMIP auto save FreeBusy",&mIMIPAutoFreeBusyReply,neverAuto); |
315 | 315 | ||
316 | KPrefs::setCurrentGroup( "Editors" ); | 316 | KPrefs::setCurrentGroup( "Editors" ); |
317 | 317 | ||
318 | addItemStringList( "EventTemplates", &mEventTemplates ); | 318 | addItemStringList( "EventTemplates", &mEventTemplates ); |
319 | addItemStringList( "TodoTemplates", &mTodoTemplates ); | 319 | addItemStringList( "TodoTemplates", &mTodoTemplates ); |
320 | 320 | ||
321 | addItemInt("DestinationPolicy",&mDestination,standardDestination); | 321 | addItemInt("DestinationPolicy",&mDestination,standardDestination); |
322 | 322 | ||
323 | 323 | ||
324 | 324 | ||
325 | } | 325 | } |
326 | 326 | ||
327 | 327 | ||
328 | KOPrefs::~KOPrefs() | 328 | KOPrefs::~KOPrefs() |
329 | { | 329 | { |
330 | if (mInstance == this) | 330 | if (mInstance == this) |
331 | mInstance = insd.setObject(0); | 331 | mInstance = insd.setObject(0); |
332 | setLocaleDict( 0 ); | 332 | setLocaleDict( 0 ); |
333 | if ( mLocaleDict ) | 333 | if ( mLocaleDict ) |
334 | delete mLocaleDict; | 334 | delete mLocaleDict; |
335 | //qDebug("KOPrefs::~KOPrefs() "); | 335 | //qDebug("KOPrefs::~KOPrefs() "); |
336 | } | 336 | } |
337 | 337 | ||
338 | 338 | ||
339 | KOPrefs *KOPrefs::instance() | 339 | KOPrefs *KOPrefs::instance() |
340 | { | 340 | { |
341 | if (!mInstance) { | 341 | if (!mInstance) { |
342 | mInstance = insd.setObject(new KOPrefs()); | 342 | mInstance = insd.setObject(new KOPrefs()); |
343 | mInstance->readConfig(); | 343 | mInstance->readConfig(); |
344 | } | 344 | } |
345 | 345 | ||
346 | return mInstance; | 346 | return mInstance; |
347 | } | 347 | } |
348 | 348 | ||
349 | void KOPrefs::usrSetDefaults() | 349 | void KOPrefs::usrSetDefaults() |
350 | { | 350 | { |
351 | 351 | ||
352 | } | 352 | } |
353 | 353 | ||
354 | void KOPrefs::fillMailDefaults() | 354 | void KOPrefs::fillMailDefaults() |
355 | { | 355 | { |
356 | if (mName.isEmpty()) mName = i18n("Anonymous"); | 356 | if (mName.isEmpty()) mName = i18n("Anonymous"); |
357 | if (mEmail.isEmpty()) mEmail = i18n("nobody@nowhere"); | 357 | if (mEmail.isEmpty()) mEmail = i18n("nobody@nowhere"); |
358 | } | 358 | } |
359 | 359 | ||
360 | void KOPrefs::setTimeZoneIdDefault() | 360 | void KOPrefs::setTimeZoneIdDefault() |
361 | { | 361 | { |
362 | mTimeZoneId = i18n("+01:00 Europe/Oslo(CET)"); | 362 | mTimeZoneId = i18n("+01:00 Europe/Oslo(CET)"); |
363 | } | 363 | } |
364 | 364 | ||
365 | void KOPrefs::setCategoryDefaults() | 365 | void KOPrefs::setCategoryDefaults() |
366 | { | 366 | { |
367 | mCustomCategories.clear(); | 367 | mCustomCategories.clear(); |
368 | mCustomCategories = getDefaultList(); | 368 | mCustomCategories = getDefaultList(); |
369 | 369 | ||
370 | QStringList::Iterator it; | 370 | QStringList::Iterator it; |
371 | for (it = mCustomCategories.begin();it != mCustomCategories.end();++it ) { | 371 | for (it = mCustomCategories.begin();it != mCustomCategories.end();++it ) { |
372 | setCategoryColor(*it,mDefaultCategoryColor); | 372 | setCategoryColor(*it,mDefaultCategoryColor); |
373 | } | 373 | } |
374 | } | 374 | } |
375 | 375 | ||
376 | QStringList KOPrefs::getDefaultList() | 376 | QStringList KOPrefs::getDefaultList() |
377 | { | 377 | { |
378 | QStringList retval ; | 378 | QStringList retval ; |
379 | retval << i18n("Anniversary") << i18n("Appointment") << i18n("Birthday") << i18n("Business") << i18n("Business Travel") << i18n("Cinema") << i18n("Customer") | 379 | retval << i18n("Anniversary") << i18n("Appointment") << i18n("Birthday") << i18n("Business") << i18n("Business Travel") << i18n("Cinema") << i18n("Customer") |
380 | << i18n("Break")<< i18n("Breakfast")<< i18n("Competition")<< i18n("Dinner") | 380 | << i18n("Break")<< i18n("Breakfast")<< i18n("Competition")<< i18n("Dinner") |
381 | << i18n("Education")<< i18n("Family") << i18n("Favorites") << i18n("Festival")<< i18n("Fishing")<< i18n("Flight") << i18n("Gifts") | 381 | << i18n("Education")<< i18n("Family") << i18n("Favorites") << i18n("Festival")<< i18n("Fishing")<< i18n("Flight") << i18n("Gifts") |
382 | << i18n("Holiday") << i18n("Holiday Cards")<< i18n("Hot Contacts") << i18n("Hiking") << i18n("Hunting") << i18n("Key Customer") << i18n("Kids") | 382 | << i18n("Holiday") << i18n("Holiday Cards")<< i18n("Hot Contacts") << i18n("Hiking") << i18n("Hunting") << i18n("Key Customer") << i18n("Kids") |
383 | << i18n("Lunch") << i18n("Meeting") << i18n("Miscellaneous") << i18n("Partner")<< i18n("Party") << i18n("Personal") << i18n("Personal Travel") | 383 | << i18n("Lunch") << i18n("Meeting") << i18n("Miscellaneous") << i18n("Partner")<< i18n("Party") << i18n("Personal") << i18n("Personal Travel") |
384 | << i18n("PHB") << i18n("Phone Calls") << i18n("Projects") << i18n("Recurring") << i18n("School") << i18n("Shopping") | 384 | << i18n("PHB") << i18n("Phone Calls") << i18n("Projects") << i18n("Recurring") << i18n("School") << i18n("Shopping") |
385 | << i18n("Speach") << i18n("Special Occasion") << i18n("Sports") << i18n("Talk") << i18n("Travel") << i18n("TV")<< i18n("University") | 385 | << i18n("Speach") << i18n("Special Occasion") << i18n("Sports") << i18n("Talk") << i18n("Travel") << i18n("TV")<< i18n("University") |
386 | << i18n("Vacation") << i18n("VIP") << i18n("SyncEvent") ; | 386 | << i18n("Vacation") << i18n("VIP") << i18n("SyncEvent") ; |
387 | retval.sort(); | 387 | retval.sort(); |
388 | return retval; | 388 | return retval; |
389 | } | 389 | } |
390 | 390 | ||
391 | void KOPrefs::usrReadConfig() | 391 | void KOPrefs::usrReadConfig() |
392 | { | 392 | { |
393 | mLocaleDict = 0; | 393 | mLocaleDict = 0; |
394 | // pending LR fix translation | 394 | // pending LR fix translation |
395 | // qDebug("KOPrefs::usrReadConfig() fix translation "); | 395 | // qDebug("KOPrefs::usrReadConfig() fix translation "); |
396 | if ( mPreferredLanguage == 1 ) { | 396 | if ( mPreferredLanguage > 0 && mPreferredLanguage < 4 ) { |
397 | mLocaleDict = new QDict<QString>; | 397 | if ( mPreferredLanguage == 1 ) { |
398 | int i = 0; | ||
399 | QString fw ( germanwords[i] [0]); | ||
400 | while ( !fw.isEmpty() ) { | ||
401 | mLocaleDict->insert( fw, new QString (germanwords[i] [1] )); | ||
402 | ++i; | ||
403 | fw = germanwords[i] [0]; | ||
404 | } | ||
405 | |||
406 | setLocaleDict( mLocaleDict ); | ||
407 | } else { | ||
408 | QString fileName ; | ||
409 | if ( mPreferredLanguage == 3 ) | ||
410 | fileName = MainWindow::resourcePath()+"usertranslation.txt"; | ||
411 | else if ( mPreferredLanguage == 2 ) | ||
412 | fileName = MainWindow::resourcePath()+"frenchtranslation.txt"; | ||
413 | else return; | ||
414 | QFile file( fileName ); | ||
415 | if (file.open( IO_ReadOnly ) ) { | ||
416 | QTextStream ts( &file ); | ||
417 | ts.setCodec( QTextCodec::codecForLocale() ); | ||
418 | QString text = ts.read(); | ||
419 | file.close(); | ||
420 | text.replace( QRegExp("\\\\n"), "\n" ); | ||
421 | QString line; | ||
422 | QString we; | ||
423 | QString wt; | ||
424 | int br = 0; | ||
425 | int nbr; | ||
426 | nbr = text.find ( "},", br ); | ||
427 | line = text.mid( br, nbr - br ); | ||
428 | br = nbr+1; | ||
429 | int se, ee, st, et; | ||
430 | mLocaleDict = new QDict<QString>; | 398 | mLocaleDict = new QDict<QString>; |
431 | QString end = "{ \"\",\"\" }"; | 399 | int i = 0; |
432 | while ( (line != end) && (br > 1) ) { | 400 | QString fw ( germanwords[i] [0]); |
433 | //qDebug("%d *%s* ", br, line.latin1()); | 401 | while ( !fw.isEmpty() ) { |
434 | se = line.find("\"")+1; | 402 | mLocaleDict->insert( fw, new QString (germanwords[i] [1] )); |
435 | et = line.findRev("\"",-1); | 403 | ++i; |
436 | ee = line.find("\",\""); | 404 | fw = germanwords[i] [0]; |
437 | st = ee+3; | ||
438 | we = line.mid( se, ee-se ); | ||
439 | wt = line.mid( st, et-st ); | ||
440 | //qDebug("*%s* *%s* ", we.latin1(), wt.latin1()); | ||
441 | mLocaleDict->insert( we, new QString (wt) ); | ||
442 | nbr = text.find ( "}", br ); | ||
443 | line = text.mid( br, nbr - br ); | ||
444 | br = nbr+1; | ||
445 | } | 405 | } |
446 | //qDebug("end *%s* ", end.latin1()); | 406 | |
447 | |||
448 | setLocaleDict( mLocaleDict ); | 407 | setLocaleDict( mLocaleDict ); |
449 | } else { | 408 | } else { |
450 | qDebug("KO: Cannot find translation file %s",fileName.latin1() ); | 409 | QString fileName ; |
451 | } | 410 | if ( mPreferredLanguage == 3 ) |
411 | fileName = MainWindow::resourcePath()+"usertranslation.txt"; | ||
412 | else if ( mPreferredLanguage == 2 ) | ||
413 | fileName = MainWindow::resourcePath()+"frenchtranslation.txt"; | ||
414 | QFile file( fileName ); | ||
415 | if (file.open( IO_ReadOnly ) ) { | ||
416 | QTextStream ts( &file ); | ||
417 | ts.setEncoding( QTextStream::Latin1 ); | ||
418 | //ts.setCodec( QTextCodec::latin1 ); | ||
419 | QString text = ts.read(); | ||
420 | file.close(); | ||
421 | text.replace( QRegExp("\\\\n"), "\n" ); | ||
422 | QString line; | ||
423 | QString we; | ||
424 | QString wt; | ||
425 | int br = 0; | ||
426 | int nbr; | ||
427 | nbr = text.find ( "},", br ); | ||
428 | line = text.mid( br, nbr - br ); | ||
429 | br = nbr+1; | ||
430 | int se, ee, st, et; | ||
431 | mLocaleDict = new QDict<QString>; | ||
432 | QString end = "{ \"\",\"\" }"; | ||
433 | while ( (line != end) && (br > 1) ) { | ||
434 | //qDebug("%d *%s* ", br, line.latin1()); | ||
435 | se = line.find("\"")+1; | ||
436 | et = line.findRev("\"",-1); | ||
437 | ee = line.find("\",\""); | ||
438 | st = ee+3; | ||
439 | we = line.mid( se, ee-se ); | ||
440 | wt = line.mid( st, et-st ); | ||
441 | //qDebug("*%s* *%s* ", we.latin1(), wt.latin1()); | ||
442 | mLocaleDict->insert( we, new QString (wt) ); | ||
443 | nbr = text.find ( "}", br ); | ||
444 | line = text.mid( br, nbr - br ); | ||
445 | br = nbr+1; | ||
446 | } | ||
447 | //qDebug("end *%s* ", end.latin1()); | ||
448 | |||
449 | setLocaleDict( mLocaleDict ); | ||
450 | } else { | ||
451 | qDebug("KO: Cannot find translation file %s",fileName.latin1() ); | ||
452 | } | ||
452 | 453 | ||
453 | } | 454 | } |
455 | } | ||
454 | config()->setGroup("General"); | 456 | config()->setGroup("General"); |
455 | 457 | ||
456 | mCustomCategories = config()->readListEntry("Custom Categories"); | 458 | mCustomCategories = config()->readListEntry("Custom Categories"); |
457 | if ( KOPrefs::instance()->mLanguageChanged ) { | 459 | if ( KOPrefs::instance()->mLanguageChanged ) { |
458 | mLocationDefaults.clear(); | 460 | mLocationDefaults.clear(); |
459 | mEventSummaryUser.clear(); | 461 | mEventSummaryUser.clear(); |
460 | mTodoSummaryUser.clear(); | 462 | mTodoSummaryUser.clear(); |
461 | } | 463 | } |
462 | if (mLocationDefaults.isEmpty()) { | 464 | if (mLocationDefaults.isEmpty()) { |
463 | mLocationDefaults << i18n("Home") << i18n("Office") << i18n("Libary") << i18n("School") << i18n("Doctor") << i18n("Beach") | 465 | mLocationDefaults << i18n("Home") << i18n("Office") << i18n("Library") << i18n("School") << i18n("Doctor") << i18n("Beach") |
464 | << i18n("University") << i18n("Restaurant") << i18n("Bar") << i18n("Conference room") << i18n("Cinema") << i18n("Lake") << i18n("Kindergarden") | 466 | << i18n("University") << i18n("Restaurant") << i18n("Bar") << i18n("Conference room") << i18n("Cinema") << i18n("Lake") << i18n("Kindergarten") |
465 | << i18n("Germany") << i18n("Sweden") << i18n("Forest") << i18n("Desert") << i18n("Kitchen") ; | 467 | << i18n("Germany") << i18n("Sweden") << i18n("Forest") << i18n("Desert") << i18n("Kitchen") ; |
466 | // << i18n("") << i18n("") << i18n("") << i18n("") << i18n("") << i18n("") << i18n("") << i18n("") | 468 | // << i18n("") << i18n("") << i18n("") << i18n("") << i18n("") << i18n("") << i18n("") << i18n("") |
467 | mLocationDefaults.sort(); | 469 | mLocationDefaults.sort(); |
468 | } | 470 | } |
469 | 471 | ||
470 | if (mEventSummaryUser.isEmpty()) { | 472 | if (mEventSummaryUser.isEmpty()) { |
471 | mEventSummaryUser = getDefaultList() ; | 473 | mEventSummaryUser = getDefaultList() ; |
472 | } | 474 | } |
473 | if (mTodoSummaryUser.isEmpty()) { | 475 | if (mTodoSummaryUser.isEmpty()) { |
474 | mTodoSummaryUser = getDefaultList() ; | 476 | mTodoSummaryUser = getDefaultList() ; |
475 | } | 477 | } |
476 | 478 | ||
477 | if (mCustomCategories.isEmpty()) setCategoryDefaults(); | 479 | if (mCustomCategories.isEmpty()) setCategoryDefaults(); |
478 | 480 | ||
479 | config()->setGroup("Personal Settings"); | 481 | config()->setGroup("Personal Settings"); |
480 | mName = config()->readEntry("user_name",""); | 482 | mName = config()->readEntry("user_name",""); |
481 | mEmail = config()->readEntry("user_email",""); | 483 | mEmail = config()->readEntry("user_email",""); |
482 | fillMailDefaults(); | 484 | fillMailDefaults(); |
483 | 485 | ||
484 | config()->setGroup("Category Colors"); | 486 | config()->setGroup("Category Colors"); |
485 | QStringList::Iterator it; | 487 | QStringList::Iterator it; |
486 | for (it = mCustomCategories.begin();it != mCustomCategories.end();++it ) { | 488 | for (it = mCustomCategories.begin();it != mCustomCategories.end();++it ) { |
487 | setCategoryColor(*it,config()->readColorEntry(*it,&mDefaultCategoryColor)); | 489 | setCategoryColor(*it,config()->readColorEntry(*it,&mDefaultCategoryColor)); |
488 | 490 | ||
489 | } | 491 | } |
490 | 492 | ||
491 | if (mTimeZoneId.isEmpty()) { | 493 | if (mTimeZoneId.isEmpty()) { |
492 | setTimeZoneIdDefault(); | 494 | setTimeZoneIdDefault(); |
493 | } | 495 | } |
494 | KPimPrefs::usrReadConfig(); | 496 | KPimPrefs::usrReadConfig(); |
495 | } | 497 | } |
496 | 498 | ||
497 | 499 | ||
498 | void KOPrefs::usrWriteConfig() | 500 | void KOPrefs::usrWriteConfig() |
499 | { | 501 | { |
500 | config()->setGroup("General"); | 502 | config()->setGroup("General"); |
501 | config()->writeEntry("Custom Categories",mCustomCategories); | 503 | config()->writeEntry("Custom Categories",mCustomCategories); |
502 | 504 | ||
503 | config()->setGroup("Personal Settings"); | 505 | config()->setGroup("Personal Settings"); |
504 | config()->writeEntry("user_name",mName); | 506 | config()->writeEntry("user_name",mName); |
505 | config()->writeEntry("user_email",mEmail); | 507 | config()->writeEntry("user_email",mEmail); |
506 | 508 | ||
507 | config()->setGroup("Category Colors"); | 509 | config()->setGroup("Category Colors"); |
508 | QDictIterator<QColor> it(mCategoryColors); | 510 | QDictIterator<QColor> it(mCategoryColors); |
509 | while (it.current()) { | 511 | while (it.current()) { |
510 | config()->writeEntry(it.currentKey(),*(it.current())); | 512 | config()->writeEntry(it.currentKey(),*(it.current())); |
511 | ++it; | 513 | ++it; |
512 | } | 514 | } |
513 | 515 | ||
514 | 516 | ||
515 | KPimPrefs::usrWriteConfig(); | 517 | KPimPrefs::usrWriteConfig(); |
516 | } | 518 | } |
517 | 519 | ||
518 | void KOPrefs::setCategoryColor(QString cat,const QColor & color) | 520 | void KOPrefs::setCategoryColor(QString cat,const QColor & color) |
519 | { | 521 | { |
520 | mCategoryColors.replace(cat,new QColor(color)); | 522 | mCategoryColors.replace(cat,new QColor(color)); |
521 | } | 523 | } |
522 | 524 | ||
523 | QColor *KOPrefs::categoryColor(QString cat) | 525 | QColor *KOPrefs::categoryColor(QString cat) |
524 | { | 526 | { |
525 | QColor *color = 0; | 527 | QColor *color = 0; |
526 | 528 | ||
527 | if (!cat.isEmpty()) color = mCategoryColors[cat]; | 529 | if (!cat.isEmpty()) color = mCategoryColors[cat]; |
528 | 530 | ||
529 | if (color) return color; | 531 | if (color) return color; |
530 | else return &mDefaultCategoryColor; | 532 | else return &mDefaultCategoryColor; |
531 | } | 533 | } |
532 | 534 | ||
533 | void KOPrefs::setFullName(const QString &name) | 535 | void KOPrefs::setFullName(const QString &name) |
534 | { | 536 | { |
535 | mName = name; | 537 | mName = name; |
536 | } | 538 | } |
537 | 539 | ||
538 | void KOPrefs::setEmail(const QString &email) | 540 | void KOPrefs::setEmail(const QString &email) |
539 | { | 541 | { |
540 | //qDebug(" KOPrefs::setEmai*********** %s",email.latin1() ); | 542 | //qDebug(" KOPrefs::setEmai*********** %s",email.latin1() ); |
541 | mEmail = email; | 543 | mEmail = email; |
542 | } | 544 | } |
543 | 545 | ||
544 | QString KOPrefs::fullName() | 546 | QString KOPrefs::fullName() |
545 | { | 547 | { |
546 | if (mEmailControlCenter) { | 548 | if (mEmailControlCenter) { |
547 | KEMailSettings settings; | 549 | KEMailSettings settings; |
548 | return settings.getSetting(KEMailSettings::RealName); | 550 | return settings.getSetting(KEMailSettings::RealName); |
549 | } else { | 551 | } else { |
550 | return mName; | 552 | return mName; |
551 | } | 553 | } |
552 | } | 554 | } |
553 | 555 | ||
554 | QString KOPrefs::email() | 556 | QString KOPrefs::email() |
555 | { | 557 | { |
556 | if (mEmailControlCenter) { | 558 | if (mEmailControlCenter) { |
557 | KEMailSettings settings; | 559 | KEMailSettings settings; |
558 | return settings.getSetting(KEMailSettings::EmailAddress); | 560 | return settings.getSetting(KEMailSettings::EmailAddress); |
559 | } else { | 561 | } else { |
560 | return mEmail; | 562 | return mEmail; |
561 | } | 563 | } |
562 | } | 564 | } |
563 | KConfig* KOPrefs::getConfig() | 565 | KConfig* KOPrefs::getConfig() |
564 | { | 566 | { |
565 | return config(); | 567 | return config(); |
566 | } | 568 | } |