summaryrefslogtreecommitdiffabout
path: root/korganizer
authorzautrix <zautrix>2005-07-06 09:52:24 (UTC)
committer zautrix <zautrix>2005-07-06 09:52:24 (UTC)
commit3b77a857e17e04e47d22ba6017dd723ed922e3fc (patch) (unidiff)
tree0ce40d3e6480ae4016e3f2e464c3180be96bdd27 /korganizer
parent4ac63cce98fabb59a47970baa2906b2fe8d0f2b0 (diff)
downloadkdepimpi-3b77a857e17e04e47d22ba6017dd723ed922e3fc.zip
kdepimpi-3b77a857e17e04e47d22ba6017dd723ed922e3fc.tar.gz
kdepimpi-3b77a857e17e04e47d22ba6017dd723ed922e3fc.tar.bz2
fixx
Diffstat (limited to 'korganizer') (more/less context) (ignore whitespace changes)
-rw-r--r--korganizer/koprefs.cpp2
1 files changed, 2 insertions, 0 deletions
diff --git a/korganizer/koprefs.cpp b/korganizer/koprefs.cpp
index f1f1442..138028d 100644
--- a/korganizer/koprefs.cpp
+++ b/korganizer/koprefs.cpp
@@ -448,174 +448,176 @@ void KOPrefs::usrReadConfig()
448 kkf->mName = i18n("Standard"); 448 kkf->mName = i18n("Standard");
449 kkf->mFileName = locateLocal( "data", "korganizer/mycalendar.ics" ); 449 kkf->mFileName = locateLocal( "data", "korganizer/mycalendar.ics" );
450 } 450 }
451 while ( mNextAvailableCalendar <= numCals ) { 451 while ( mNextAvailableCalendar <= numCals ) {
452 //qDebug("Read cal #%d ", mNextAvailableCalendar ); 452 //qDebug("Read cal #%d ", mNextAvailableCalendar );
453 QString prefix = "Cal_" +QString::number( mNextAvailableCalendar ); 453 QString prefix = "Cal_" +QString::number( mNextAvailableCalendar );
454 KopiCalendarFile *kkf = getNewCalendar(); 454 KopiCalendarFile *kkf = getNewCalendar();
455 kkf->isStandard = fc.readBoolEntry( prefix+"_isStandard", false ); 455 kkf->isStandard = fc.readBoolEntry( prefix+"_isStandard", false );
456 kkf->isEnabled = fc.readBoolEntry( prefix+"_isEnabled", true); 456 kkf->isEnabled = fc.readBoolEntry( prefix+"_isEnabled", true);
457 kkf->isRelative = fc.readBoolEntry( prefix+"_isRelative", false ); 457 kkf->isRelative = fc.readBoolEntry( prefix+"_isRelative", false );
458 kkf->isAlarmEnabled = fc.readBoolEntry( prefix+"_isAlarmEnabled", true); 458 kkf->isAlarmEnabled = fc.readBoolEntry( prefix+"_isAlarmEnabled", true);
459 kkf->isReadOnly = fc.readBoolEntry( prefix+"_isReadOnly", false); 459 kkf->isReadOnly = fc.readBoolEntry( prefix+"_isReadOnly", false);
460 kkf->mName = fc.readEntry( prefix+"_Name", "Calendar"); 460 kkf->mName = fc.readEntry( prefix+"_Name", "Calendar");
461 kkf->mFileName = fc.readEntry( prefix+"_FileName", kkf->mFileName); 461 kkf->mFileName = fc.readEntry( prefix+"_FileName", kkf->mFileName);
462 kkf->mSavedFileName = fc.readEntry( prefix+"_SavedFileName", kkf->mFileName); 462 kkf->mSavedFileName = fc.readEntry( prefix+"_SavedFileName", kkf->mFileName);
463 kkf->mDefaultColor = fc.readColorEntry( prefix+"_Color",&mEventColor); 463 kkf->mDefaultColor = fc.readColorEntry( prefix+"_Color",&mEventColor);
464 if ( kkf->mCalNumber == 1 ) { 464 if ( kkf->mCalNumber == 1 ) {
465 kkf->mFileName = locateLocal( "data", "korganizer/mycalendar.ics" ); 465 kkf->mFileName = locateLocal( "data", "korganizer/mycalendar.ics" );
466 } 466 }
467 //qDebug("NAME %s %s", kkf->mName.latin1(), i18n("Birthdays").latin1() ); 467 //qDebug("NAME %s %s", kkf->mName.latin1(), i18n("Birthdays").latin1() );
468 if ( kkf->mName == i18n("Birthdays") ) { 468 if ( kkf->mName == i18n("Birthdays") ) {
469 kkf->mFileName = locateLocal( "data", "korganizer/birthdays.ics" ); 469 kkf->mFileName = locateLocal( "data", "korganizer/birthdays.ics" );
470 } 470 }
471 if ( kkf->isRelative ) 471 if ( kkf->isRelative )
472 kkf->mFileName = KGlobalSettings::calendarDir() + kkf->mSavedFileName; 472 kkf->mFileName = KGlobalSettings::calendarDir() + kkf->mSavedFileName;
473 } 473 }
474 474
475 KPimPrefs::usrReadConfig(); 475 KPimPrefs::usrReadConfig();
476} 476}
477 477
478KopiCalendarFile * KOPrefs::getCalendar( int num ) 478KopiCalendarFile * KOPrefs::getCalendar( int num )
479{ 479{
480 return mDefCalColors[num-1]; 480 return mDefCalColors[num-1];
481} 481}
482 482
483KopiCalendarFile * KOPrefs::getNewCalendar() 483KopiCalendarFile * KOPrefs::getNewCalendar()
484{ 484{
485 KopiCalendarFile * kkf = new KopiCalendarFile(); 485 KopiCalendarFile * kkf = new KopiCalendarFile();
486 kkf->mCalNumber = mNextAvailableCalendar; 486 kkf->mCalNumber = mNextAvailableCalendar;
487 mDefCalColors.resize( mNextAvailableCalendar ); 487 mDefCalColors.resize( mNextAvailableCalendar );
488 mDefCalColors[mNextAvailableCalendar-1] = kkf; 488 mDefCalColors[mNextAvailableCalendar-1] = kkf;
489 ++mNextAvailableCalendar; 489 ++mNextAvailableCalendar;
490 kkf->mDefaultColor = mEventColor; 490 kkf->mDefaultColor = mEventColor;
491 kkf->mName = i18n("New Calendar"); 491 kkf->mName = i18n("New Calendar");
492 mCalendars.append( kkf ); 492 mCalendars.append( kkf );
493 return kkf; 493 return kkf;
494} 494}
495void KOPrefs::deleteCalendar( int num ) 495void KOPrefs::deleteCalendar( int num )
496{ 496{
497 KopiCalendarFile * kkf = mCalendars.first(); 497 KopiCalendarFile * kkf = mCalendars.first();
498 while ( kkf ) { 498 while ( kkf ) {
499 if ( kkf->mCalNumber == num ) { 499 if ( kkf->mCalNumber == num ) {
500 qDebug("KOPrefs::deleteCalendar %d ", num ); 500 qDebug("KOPrefs::deleteCalendar %d ", num );
501 mCalendars.remove( kkf ); 501 mCalendars.remove( kkf );
502 delete kkf; 502 delete kkf;
503 return; 503 return;
504 } 504 }
505 kkf = mCalendars.next(); 505 kkf = mCalendars.next();
506 } 506 }
507} 507}
508int KOPrefs::getCalendarID( const QString & name ) 508int KOPrefs::getCalendarID( const QString & name )
509{ 509{
510 KopiCalendarFile * kkf = mCalendars.first(); 510 KopiCalendarFile * kkf = mCalendars.first();
511 while ( kkf ) { 511 while ( kkf ) {
512 if ( name == kkf->mName) 512 if ( name == kkf->mName)
513 return kkf->mCalNumber; 513 return kkf->mCalNumber;
514 kkf = mCalendars.next(); 514 kkf = mCalendars.next();
515 } 515 }
516 return 1; 516 return 1;
517} 517}
518QString KOPrefs::calName( int calNum) const 518QString KOPrefs::calName( int calNum) const
519{ 519{
520 return (mDefCalColors[calNum-1])->mName; 520 return (mDefCalColors[calNum-1])->mName;
521} 521}
522QColor KOPrefs::defaultColor( int calNum ) const 522QColor KOPrefs::defaultColor( int calNum ) const
523{ 523{
524 if ( calNum == 1 ) return mEventColor; 524 if ( calNum == 1 ) return mEventColor;
525 return (mDefCalColors[calNum-1])->mDefaultColor; 525 return (mDefCalColors[calNum-1])->mDefaultColor;
526} 526}
527void KOPrefs::usrWriteConfig() 527void KOPrefs::usrWriteConfig()
528{ 528{
529 config()->setGroup("General"); 529 config()->setGroup("General");
530 config()->writeEntry("Custom Categories",mCustomCategories); 530 config()->writeEntry("Custom Categories",mCustomCategories);
531 531
532 config()->setGroup("Personal Settings"); 532 config()->setGroup("Personal Settings");
533 config()->writeEntry("user_name",mName); 533 config()->writeEntry("user_name",mName);
534 config()->writeEntry("user_email",mEmail); 534 config()->writeEntry("user_email",mEmail);
535 535
536 config()->setGroup("Category Colors"); 536 config()->setGroup("Category Colors");
537 QDictIterator<QColor> it(mCategoryColors); 537 QDictIterator<QColor> it(mCategoryColors);
538 while (it.current()) { 538 while (it.current()) {
539 config()->writeEntry(it.currentKey(),*(it.current())); 539 config()->writeEntry(it.currentKey(),*(it.current()));
540 ++it; 540 ++it;
541 } 541 }
542 KConfig fc (locateLocal("config","kopicalendarrc")); 542 KConfig fc (locateLocal("config","kopicalendarrc"));
543 fc.setGroup("CC"); 543 fc.setGroup("CC");
544 fc.deleteGroup( "CC");
545 fc.setGroup("CC");
544 fc.writeEntry("NumberCalendars",mCalendars.count()); 546 fc.writeEntry("NumberCalendars",mCalendars.count());
545 int numCal = 1; 547 int numCal = 1;
546 int writeCal = 0; 548 int writeCal = 0;
547 while ( numCal < mNextAvailableCalendar ) { 549 while ( numCal < mNextAvailableCalendar ) {
548 KopiCalendarFile * kkf = mCalendars.first(); 550 KopiCalendarFile * kkf = mCalendars.first();
549 while ( kkf ) { 551 while ( kkf ) {
550 //qDebug("cal num %d %d ", kkf->mCalNumber, numCal); 552 //qDebug("cal num %d %d ", kkf->mCalNumber, numCal);
551 if ( kkf->mCalNumber == numCal ) { 553 if ( kkf->mCalNumber == numCal ) {
552 ++writeCal; 554 ++writeCal;
553 //qDebug("Write calendar %d %d ", numCal , writeCal); 555 //qDebug("Write calendar %d %d ", numCal , writeCal);
554 QString prefix = "Cal_" + QString::number( writeCal ); 556 QString prefix = "Cal_" + QString::number( writeCal );
555 fc.writeEntry( prefix+"_isStandard", kkf->isStandard ); 557 fc.writeEntry( prefix+"_isStandard", kkf->isStandard );
556 fc.writeEntry( prefix+"_isEnabled", kkf->isEnabled ); 558 fc.writeEntry( prefix+"_isEnabled", kkf->isEnabled );
557 fc.writeEntry( prefix+"_isAlarmEnabled", kkf->isAlarmEnabled ); 559 fc.writeEntry( prefix+"_isAlarmEnabled", kkf->isAlarmEnabled );
558 fc.writeEntry( prefix+"_isReadOnly", kkf->isReadOnly ); 560 fc.writeEntry( prefix+"_isReadOnly", kkf->isReadOnly );
559 fc.writeEntry( prefix+"_isRelative", kkf->isRelative ); 561 fc.writeEntry( prefix+"_isRelative", kkf->isRelative );
560 fc.writeEntry( prefix+"_Name", kkf->mName); 562 fc.writeEntry( prefix+"_Name", kkf->mName);
561 fc.writeEntry( prefix+"_FileName", kkf->mFileName); 563 fc.writeEntry( prefix+"_FileName", kkf->mFileName);
562 fc.writeEntry( prefix+"_SavedFileName", kkf->mSavedFileName); 564 fc.writeEntry( prefix+"_SavedFileName", kkf->mSavedFileName);
563 fc.writeEntry( prefix+"_Color",kkf->mDefaultColor); 565 fc.writeEntry( prefix+"_Color",kkf->mDefaultColor);
564 } 566 }
565 kkf = mCalendars.next(); 567 kkf = mCalendars.next();
566 } 568 }
567 ++numCal; 569 ++numCal;
568 } 570 }
569 fc.sync(); 571 fc.sync();
570 KPimPrefs::usrWriteConfig(); 572 KPimPrefs::usrWriteConfig();
571} 573}
572 574
573void KOPrefs::setCategoryColor(QString cat,const QColor & color) 575void KOPrefs::setCategoryColor(QString cat,const QColor & color)
574{ 576{
575 mCategoryColors.replace(cat,new QColor(color)); 577 mCategoryColors.replace(cat,new QColor(color));
576} 578}
577 579
578QColor *KOPrefs::categoryColor(QString cat) 580QColor *KOPrefs::categoryColor(QString cat)
579{ 581{
580 QColor *color = 0; 582 QColor *color = 0;
581 583
582 if (!cat.isEmpty()) color = mCategoryColors[cat]; 584 if (!cat.isEmpty()) color = mCategoryColors[cat];
583 585
584 if (color) return color; 586 if (color) return color;
585 else return &mDefaultCategoryColor; 587 else return &mDefaultCategoryColor;
586} 588}
587 589
588void KOPrefs::setFullName(const QString &name) 590void KOPrefs::setFullName(const QString &name)
589{ 591{
590 mName = name; 592 mName = name;
591} 593}
592 594
593void KOPrefs::setEmail(const QString &email) 595void KOPrefs::setEmail(const QString &email)
594{ 596{
595 //qDebug(" KOPrefs::setEmai*********** %s",email.latin1() ); 597 //qDebug(" KOPrefs::setEmai*********** %s",email.latin1() );
596 mEmail = email; 598 mEmail = email;
597} 599}
598 600
599QString KOPrefs::fullName() 601QString KOPrefs::fullName()
600{ 602{
601 if (mEmailControlCenter) { 603 if (mEmailControlCenter) {
602 KEMailSettings settings; 604 KEMailSettings settings;
603 return settings.getSetting(KEMailSettings::RealName); 605 return settings.getSetting(KEMailSettings::RealName);
604 } else { 606 } else {
605 return mName; 607 return mName;
606 } 608 }
607} 609}
608 610
609QString KOPrefs::email() 611QString KOPrefs::email()
610{ 612{
611 if (mEmailControlCenter) { 613 if (mEmailControlCenter) {
612 KEMailSettings settings; 614 KEMailSettings settings;
613 return settings.getSetting(KEMailSettings::EmailAddress); 615 return settings.getSetting(KEMailSettings::EmailAddress);
614 } else { 616 } else {
615 return mEmail; 617 return mEmail;
616 } 618 }
617} 619}
618KConfig* KOPrefs::getConfig() 620KConfig* KOPrefs::getConfig()
619{ 621{
620 return config(); 622 return config();
621} 623}