-rw-r--r-- | korganizer/koprefs.cpp | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/korganizer/koprefs.cpp b/korganizer/koprefs.cpp index e679bd3..65f0342 100644 --- a/korganizer/koprefs.cpp +++ b/korganizer/koprefs.cpp | |||
@@ -452,96 +452,97 @@ void KOPrefs::usrReadConfig() | |||
452 | KopiCalendarFile *kkf = getNewCalendar(); | 452 | KopiCalendarFile *kkf = getNewCalendar(); |
453 | kkf->isStandard = fc.readBoolEntry( prefix+"_isStandard", false ); | 453 | kkf->isStandard = fc.readBoolEntry( prefix+"_isStandard", false ); |
454 | kkf->isEnabled = fc.readBoolEntry( prefix+"_isEnabled", true); | 454 | kkf->isEnabled = fc.readBoolEntry( prefix+"_isEnabled", true); |
455 | kkf->isAlarmEnabled = fc.readBoolEntry( prefix+"_isAlarmEnabled", true); | 455 | kkf->isAlarmEnabled = fc.readBoolEntry( prefix+"_isAlarmEnabled", true); |
456 | kkf->isReadOnly = fc.readBoolEntry( prefix+"_isReadOnly", false); | 456 | kkf->isReadOnly = fc.readBoolEntry( prefix+"_isReadOnly", false); |
457 | kkf->mName = fc.readEntry( prefix+"_Name", "Calendar"); | 457 | kkf->mName = fc.readEntry( prefix+"_Name", "Calendar"); |
458 | kkf->mFileName = fc.readEntry( prefix+"_FileName", kkf->mFileName); | 458 | kkf->mFileName = fc.readEntry( prefix+"_FileName", kkf->mFileName); |
459 | kkf->mDefaultColor = fc.readColorEntry( prefix+"_Color",&mEventColor); | 459 | kkf->mDefaultColor = fc.readColorEntry( prefix+"_Color",&mEventColor); |
460 | if ( kkf->mCalNumber == 1 ) { | 460 | if ( kkf->mCalNumber == 1 ) { |
461 | kkf->mFileName = locateLocal( "data", "korganizer/mycalendar.ics" ); | 461 | kkf->mFileName = locateLocal( "data", "korganizer/mycalendar.ics" ); |
462 | } | 462 | } |
463 | } | 463 | } |
464 | 464 | ||
465 | KPimPrefs::usrReadConfig(); | 465 | KPimPrefs::usrReadConfig(); |
466 | } | 466 | } |
467 | 467 | ||
468 | KopiCalendarFile * KOPrefs::getCalendar( int num ) | 468 | KopiCalendarFile * KOPrefs::getCalendar( int num ) |
469 | { | 469 | { |
470 | return mDefCalColors[num-1]; | 470 | return mDefCalColors[num-1]; |
471 | } | 471 | } |
472 | 472 | ||
473 | KopiCalendarFile * KOPrefs::getNewCalendar() | 473 | KopiCalendarFile * KOPrefs::getNewCalendar() |
474 | { | 474 | { |
475 | KopiCalendarFile * kkf = new KopiCalendarFile(); | 475 | KopiCalendarFile * kkf = new KopiCalendarFile(); |
476 | kkf->mCalNumber = mNextAvailableCalendar; | 476 | kkf->mCalNumber = mNextAvailableCalendar; |
477 | mDefCalColors.resize( mNextAvailableCalendar ); | 477 | mDefCalColors.resize( mNextAvailableCalendar ); |
478 | mDefCalColors[mNextAvailableCalendar-1] = kkf; | 478 | mDefCalColors[mNextAvailableCalendar-1] = kkf; |
479 | ++mNextAvailableCalendar; | 479 | ++mNextAvailableCalendar; |
480 | kkf->mDefaultColor = mEventColor; | 480 | kkf->mDefaultColor = mEventColor; |
481 | kkf->mName = i18n("New Calendar"); | 481 | kkf->mName = i18n("New Calendar"); |
482 | mCalendars.append( kkf ); | 482 | mCalendars.append( kkf ); |
483 | return kkf; | 483 | return kkf; |
484 | } | 484 | } |
485 | void KOPrefs::deleteCalendar( int num ) | 485 | void KOPrefs::deleteCalendar( int num ) |
486 | { | 486 | { |
487 | KopiCalendarFile * kkf = mCalendars.first(); | 487 | KopiCalendarFile * kkf = mCalendars.first(); |
488 | while ( kkf ) { | 488 | while ( kkf ) { |
489 | if ( kkf->mCalNumber == num ) { | 489 | if ( kkf->mCalNumber == num ) { |
490 | qDebug("KOPrefs::deleteCalendar %d ", num ); | 490 | qDebug("KOPrefs::deleteCalendar %d ", num ); |
491 | mCalendars.remove( kkf ); | 491 | mCalendars.remove( kkf ); |
492 | delete kkf; | 492 | delete kkf; |
493 | return; | 493 | return; |
494 | } | 494 | } |
495 | kkf = mCalendars.next(); | 495 | kkf = mCalendars.next(); |
496 | } | 496 | } |
497 | } | 497 | } |
498 | QColor KOPrefs::defaultColor( int calNum ) const | 498 | QColor KOPrefs::defaultColor( int calNum ) const |
499 | { | 499 | { |
500 | if ( calNum == 1 ) return mEventColor; | ||
500 | return (mDefCalColors[calNum-1])->mDefaultColor; | 501 | return (mDefCalColors[calNum-1])->mDefaultColor; |
501 | } | 502 | } |
502 | void KOPrefs::usrWriteConfig() | 503 | void KOPrefs::usrWriteConfig() |
503 | { | 504 | { |
504 | config()->setGroup("General"); | 505 | config()->setGroup("General"); |
505 | config()->writeEntry("Custom Categories",mCustomCategories); | 506 | config()->writeEntry("Custom Categories",mCustomCategories); |
506 | 507 | ||
507 | config()->setGroup("Personal Settings"); | 508 | config()->setGroup("Personal Settings"); |
508 | config()->writeEntry("user_name",mName); | 509 | config()->writeEntry("user_name",mName); |
509 | config()->writeEntry("user_email",mEmail); | 510 | config()->writeEntry("user_email",mEmail); |
510 | 511 | ||
511 | config()->setGroup("Category Colors"); | 512 | config()->setGroup("Category Colors"); |
512 | QDictIterator<QColor> it(mCategoryColors); | 513 | QDictIterator<QColor> it(mCategoryColors); |
513 | while (it.current()) { | 514 | while (it.current()) { |
514 | config()->writeEntry(it.currentKey(),*(it.current())); | 515 | config()->writeEntry(it.currentKey(),*(it.current())); |
515 | ++it; | 516 | ++it; |
516 | } | 517 | } |
517 | KConfig fc (locateLocal("config","kopicalendarrc")); | 518 | KConfig fc (locateLocal("config","kopicalendarrc")); |
518 | fc.setGroup("CC"); | 519 | fc.setGroup("CC"); |
519 | fc.writeEntry("NumberCalendars",mCalendars.count()); | 520 | fc.writeEntry("NumberCalendars",mCalendars.count()); |
520 | int numCal = 1; | 521 | int numCal = 1; |
521 | int writeCal = 0; | 522 | int writeCal = 0; |
522 | while ( numCal < mNextAvailableCalendar ) { | 523 | while ( numCal < mNextAvailableCalendar ) { |
523 | KopiCalendarFile * kkf = mCalendars.first(); | 524 | KopiCalendarFile * kkf = mCalendars.first(); |
524 | while ( kkf ) { | 525 | while ( kkf ) { |
525 | //qDebug("cal num %d %d ", kkf->mCalNumber, numCal); | 526 | //qDebug("cal num %d %d ", kkf->mCalNumber, numCal); |
526 | if ( kkf->mCalNumber == numCal ) { | 527 | if ( kkf->mCalNumber == numCal ) { |
527 | ++writeCal; | 528 | ++writeCal; |
528 | //qDebug("Write calendar %d %d ", numCal , writeCal); | 529 | //qDebug("Write calendar %d %d ", numCal , writeCal); |
529 | QString prefix = "Cal_" + QString::number( writeCal ); | 530 | QString prefix = "Cal_" + QString::number( writeCal ); |
530 | fc.writeEntry( prefix+"_isStandard", kkf->isStandard ); | 531 | fc.writeEntry( prefix+"_isStandard", kkf->isStandard ); |
531 | fc.writeEntry( prefix+"_isEnabled", kkf->isEnabled ); | 532 | fc.writeEntry( prefix+"_isEnabled", kkf->isEnabled ); |
532 | fc.writeEntry( prefix+"_isAlarmEnabled", kkf->isAlarmEnabled ); | 533 | fc.writeEntry( prefix+"_isAlarmEnabled", kkf->isAlarmEnabled ); |
533 | fc.writeEntry( prefix+"_isReadOnly", kkf->isReadOnly ); | 534 | fc.writeEntry( prefix+"_isReadOnly", kkf->isReadOnly ); |
534 | fc.writeEntry( prefix+"_Name", kkf->mName); | 535 | fc.writeEntry( prefix+"_Name", kkf->mName); |
535 | fc.writeEntry( prefix+"_FileName", kkf->mFileName); | 536 | fc.writeEntry( prefix+"_FileName", kkf->mFileName); |
536 | fc.writeEntry( prefix+"_Color",kkf->mDefaultColor); | 537 | fc.writeEntry( prefix+"_Color",kkf->mDefaultColor); |
537 | } | 538 | } |
538 | kkf = mCalendars.next(); | 539 | kkf = mCalendars.next(); |
539 | } | 540 | } |
540 | ++numCal; | 541 | ++numCal; |
541 | } | 542 | } |
542 | fc.sync(); | 543 | fc.sync(); |
543 | KPimPrefs::usrWriteConfig(); | 544 | KPimPrefs::usrWriteConfig(); |
544 | } | 545 | } |
545 | 546 | ||
546 | void KOPrefs::setCategoryColor(QString cat,const QColor & color) | 547 | void KOPrefs::setCategoryColor(QString cat,const QColor & color) |
547 | { | 548 | { |