summaryrefslogtreecommitdiffabout
path: root/korganizer
Unidiff
Diffstat (limited to 'korganizer') (more/less context) (ignore whitespace changes)
-rw-r--r--korganizer/koprefs.cpp41
1 files changed, 22 insertions, 19 deletions
diff --git a/korganizer/koprefs.cpp b/korganizer/koprefs.cpp
index 9fe285c..e679bd3 100644
--- a/korganizer/koprefs.cpp
+++ b/korganizer/koprefs.cpp
@@ -415,68 +415,69 @@ void KOPrefs::usrReadConfig()
415 if (mLocationDefaults.isEmpty()) { 415 if (mLocationDefaults.isEmpty()) {
416 mLocationDefaults = getLocationDefaultList(); 416 mLocationDefaults = getLocationDefaultList();
417 } 417 }
418 418
419 if (mEventSummaryUser.isEmpty()) { 419 if (mEventSummaryUser.isEmpty()) {
420 mEventSummaryUser = getDefaultList() ; 420 mEventSummaryUser = getDefaultList() ;
421 } 421 }
422 if (mTodoSummaryUser.isEmpty()) { 422 if (mTodoSummaryUser.isEmpty()) {
423 mTodoSummaryUser = getDefaultList() ; 423 mTodoSummaryUser = getDefaultList() ;
424 } 424 }
425 425
426 if (mCustomCategories.isEmpty()) setCategoryDefaults(); 426 if (mCustomCategories.isEmpty()) setCategoryDefaults();
427 427
428 config()->setGroup("Personal Settings"); 428 config()->setGroup("Personal Settings");
429 mName = config()->readEntry("user_name",""); 429 mName = config()->readEntry("user_name","");
430 mEmail = config()->readEntry("user_email",""); 430 mEmail = config()->readEntry("user_email","");
431 fillMailDefaults(); 431 fillMailDefaults();
432 432
433 config()->setGroup("Category Colors"); 433 config()->setGroup("Category Colors");
434 QStringList::Iterator it; 434 QStringList::Iterator it;
435 for (it = mCustomCategories.begin();it != mCustomCategories.end();++it ) { 435 for (it = mCustomCategories.begin();it != mCustomCategories.end();++it ) {
436 setCategoryColor(*it,config()->readColorEntry(*it,&mDefaultCategoryColor)); 436 setCategoryColor(*it,config()->readColorEntry(*it,&mDefaultCategoryColor));
437 437
438 } 438 }
439 config()->setGroup("CCal"); 439 KConfig fc (locateLocal("config","kopicalendarrc"));
440 int numCals = config()->readNumEntry("NumberCalendars",0 ); 440 fc.setGroup("CC");
441 int numCals = fc.readNumEntry("NumberCalendars",0 );
441 mNextAvailableCalendar = 1; 442 mNextAvailableCalendar = 1;
442 if ( numCals == 0 ) { 443 if ( numCals == 0 ) {
443 KopiCalendarFile *kkf = getNewCalendar(); 444 KopiCalendarFile *kkf = getNewCalendar();
444 kkf->isStandard = true; 445 kkf->isStandard = true;
445 kkf->mName = i18n("Standard"); 446 kkf->mName = i18n("Standard");
446 kkf->mFileName = locateLocal( "data", "korganizer/mycalendar.ics" ); 447 kkf->mFileName = locateLocal( "data", "korganizer/mycalendar.ics" );
447 } 448 }
448 while ( mNextAvailableCalendar <= numCals ) { 449 while ( mNextAvailableCalendar <= numCals ) {
449 //qDebug("Read cal #%d ", mNextAvailableCalendar ); 450 //qDebug("Read cal #%d ", mNextAvailableCalendar );
450 QString prefix = "Cal_" +QString::number( mNextAvailableCalendar ); 451 QString prefix = "Cal_" +QString::number( mNextAvailableCalendar );
451 KopiCalendarFile *kkf = getNewCalendar(); 452 KopiCalendarFile *kkf = getNewCalendar();
452 kkf->isStandard = config()->readBoolEntry( prefix+"_isStandard", false ); 453 kkf->isStandard = fc.readBoolEntry( prefix+"_isStandard", false );
453 kkf->isEnabled = config()->readBoolEntry( prefix+"_isEnabled", true); 454 kkf->isEnabled = fc.readBoolEntry( prefix+"_isEnabled", true);
454 kkf->isAlarmEnabled = config()->readBoolEntry( prefix+"_isAlarmEnabled", true); 455 kkf->isAlarmEnabled = fc.readBoolEntry( prefix+"_isAlarmEnabled", true);
455 kkf->isReadOnly = config()->readBoolEntry( prefix+"_isReadOnly", false); 456 kkf->isReadOnly = fc.readBoolEntry( prefix+"_isReadOnly", false);
456 kkf->mName = config()->readEntry( prefix+"_Name", "Calendar"); 457 kkf->mName = fc.readEntry( prefix+"_Name", "Calendar");
457 kkf->mFileName = config()->readEntry( prefix+"_FileName", kkf->mFileName); 458 kkf->mFileName = fc.readEntry( prefix+"_FileName", kkf->mFileName);
458 kkf->mDefaultColor = config()->readColorEntry( prefix+"_Color",&mEventColor); 459 kkf->mDefaultColor = fc.readColorEntry( prefix+"_Color",&mEventColor);
459 if ( kkf->mCalNumber == 1 ) { 460 if ( kkf->mCalNumber == 1 ) {
460 kkf->mFileName = locateLocal( "data", "korganizer/mycalendar.ics" ); 461 kkf->mFileName = locateLocal( "data", "korganizer/mycalendar.ics" );
461 } 462 }
462 } 463 }
463 464
464 KPimPrefs::usrReadConfig(); 465 KPimPrefs::usrReadConfig();
465} 466}
466 467
467KopiCalendarFile * KOPrefs::getCalendar( int num ) 468KopiCalendarFile * KOPrefs::getCalendar( int num )
468{ 469{
469 return mDefCalColors[num-1]; 470 return mDefCalColors[num-1];
470} 471}
471 472
472KopiCalendarFile * KOPrefs::getNewCalendar() 473KopiCalendarFile * KOPrefs::getNewCalendar()
473{ 474{
474 KopiCalendarFile * kkf = new KopiCalendarFile(); 475 KopiCalendarFile * kkf = new KopiCalendarFile();
475 kkf->mCalNumber = mNextAvailableCalendar; 476 kkf->mCalNumber = mNextAvailableCalendar;
476 mDefCalColors.resize( mNextAvailableCalendar ); 477 mDefCalColors.resize( mNextAvailableCalendar );
477 mDefCalColors[mNextAvailableCalendar-1] = kkf; 478 mDefCalColors[mNextAvailableCalendar-1] = kkf;
478 ++mNextAvailableCalendar; 479 ++mNextAvailableCalendar;
479 kkf->mDefaultColor = mEventColor; 480 kkf->mDefaultColor = mEventColor;
480 kkf->mName = i18n("New Calendar"); 481 kkf->mName = i18n("New Calendar");
481 mCalendars.append( kkf ); 482 mCalendars.append( kkf );
482 return kkf; 483 return kkf;
@@ -491,73 +492,75 @@ void KOPrefs::deleteCalendar( int num )
491 delete kkf; 492 delete kkf;
492 return; 493 return;
493 } 494 }
494 kkf = mCalendars.next(); 495 kkf = mCalendars.next();
495 } 496 }
496} 497}
497QColor KOPrefs::defaultColor( int calNum ) const 498QColor KOPrefs::defaultColor( int calNum ) const
498{ 499{
499 return (mDefCalColors[calNum-1])->mDefaultColor; 500 return (mDefCalColors[calNum-1])->mDefaultColor;
500} 501}
501void KOPrefs::usrWriteConfig() 502void KOPrefs::usrWriteConfig()
502{ 503{
503 config()->setGroup("General"); 504 config()->setGroup("General");
504 config()->writeEntry("Custom Categories",mCustomCategories); 505 config()->writeEntry("Custom Categories",mCustomCategories);
505 506
506 config()->setGroup("Personal Settings"); 507 config()->setGroup("Personal Settings");
507 config()->writeEntry("user_name",mName); 508 config()->writeEntry("user_name",mName);
508 config()->writeEntry("user_email",mEmail); 509 config()->writeEntry("user_email",mEmail);
509 510
510 config()->setGroup("Category Colors"); 511 config()->setGroup("Category Colors");
511 QDictIterator<QColor> it(mCategoryColors); 512 QDictIterator<QColor> it(mCategoryColors);
512 while (it.current()) { 513 while (it.current()) {
513 config()->writeEntry(it.currentKey(),*(it.current())); 514 config()->writeEntry(it.currentKey(),*(it.current()));
514 ++it; 515 ++it;
515 } 516 }
516 config()->setGroup("CCal"); 517 KConfig fc (locateLocal("config","kopicalendarrc"));
517 config()->writeEntry("NumberCalendars",mCalendars.count()); 518 fc.setGroup("CC");
519 fc.writeEntry("NumberCalendars",mCalendars.count());
518 int numCal = 1; 520 int numCal = 1;
519 int writeCal = 0; 521 int writeCal = 0;
520 while ( numCal < mNextAvailableCalendar ) { 522 while ( numCal < mNextAvailableCalendar ) {
521 KopiCalendarFile * kkf = mCalendars.first(); 523 KopiCalendarFile * kkf = mCalendars.first();
522 while ( kkf ) { 524 while ( kkf ) {
523 //qDebug("cal num %d %d ", kkf->mCalNumber, numCal); 525 //qDebug("cal num %d %d ", kkf->mCalNumber, numCal);
524 if ( kkf->mCalNumber == numCal ) { 526 if ( kkf->mCalNumber == numCal ) {
525 ++writeCal; 527 ++writeCal;
526 //qDebug("Write calendar %d %d ", numCal , writeCal); 528 //qDebug("Write calendar %d %d ", numCal , writeCal);
527 QString prefix = "Cal_" + QString::number( writeCal ); 529 QString prefix = "Cal_" + QString::number( writeCal );
528 config()->writeEntry( prefix+"_isStandard", kkf->isStandard ); 530 fc.writeEntry( prefix+"_isStandard", kkf->isStandard );
529 config()->writeEntry( prefix+"_isEnabled", kkf->isEnabled ); 531 fc.writeEntry( prefix+"_isEnabled", kkf->isEnabled );
530 config()->writeEntry( prefix+"_isAlarmEnabled", kkf->isAlarmEnabled ); 532 fc.writeEntry( prefix+"_isAlarmEnabled", kkf->isAlarmEnabled );
531 config()->writeEntry( prefix+"_isReadOnly", kkf->isReadOnly ); 533 fc.writeEntry( prefix+"_isReadOnly", kkf->isReadOnly );
532 config()->writeEntry( prefix+"_Name", kkf->mName); 534 fc.writeEntry( prefix+"_Name", kkf->mName);
533 config()->writeEntry( prefix+"_FileName", kkf->mFileName); 535 fc.writeEntry( prefix+"_FileName", kkf->mFileName);
534 config()->writeEntry( prefix+"_Color",kkf->mDefaultColor); 536 fc.writeEntry( prefix+"_Color",kkf->mDefaultColor);
535 } 537 }
536 kkf = mCalendars.next(); 538 kkf = mCalendars.next();
537 } 539 }
538 ++numCal; 540 ++numCal;
539 } 541 }
542 fc.sync();
540 KPimPrefs::usrWriteConfig(); 543 KPimPrefs::usrWriteConfig();
541} 544}
542 545
543void KOPrefs::setCategoryColor(QString cat,const QColor & color) 546void KOPrefs::setCategoryColor(QString cat,const QColor & color)
544{ 547{
545 mCategoryColors.replace(cat,new QColor(color)); 548 mCategoryColors.replace(cat,new QColor(color));
546} 549}
547 550
548QColor *KOPrefs::categoryColor(QString cat) 551QColor *KOPrefs::categoryColor(QString cat)
549{ 552{
550 QColor *color = 0; 553 QColor *color = 0;
551 554
552 if (!cat.isEmpty()) color = mCategoryColors[cat]; 555 if (!cat.isEmpty()) color = mCategoryColors[cat];
553 556
554 if (color) return color; 557 if (color) return color;
555 else return &mDefaultCategoryColor; 558 else return &mDefaultCategoryColor;
556} 559}
557 560
558void KOPrefs::setFullName(const QString &name) 561void KOPrefs::setFullName(const QString &name)
559{ 562{
560 mName = name; 563 mName = name;
561} 564}
562 565
563void KOPrefs::setEmail(const QString &email) 566void KOPrefs::setEmail(const QString &email)