summaryrefslogtreecommitdiffabout
path: root/korganizer
Unidiff
Diffstat (limited to 'korganizer') (more/less context) (ignore whitespace changes)
-rw-r--r--korganizer/koprefs.cpp8
1 files changed, 8 insertions, 0 deletions
diff --git a/korganizer/koprefs.cpp b/korganizer/koprefs.cpp
index 31ef338..9147af3 100644
--- a/korganizer/koprefs.cpp
+++ b/korganizer/koprefs.cpp
@@ -283,364 +283,372 @@ KOPrefs::KOPrefs() :
283#else 283#else
284 addItemBool("UseInternalAlarmNotification",&mUseInternalAlarmNotification,false); 284 addItemBool("UseInternalAlarmNotification",&mUseInternalAlarmNotification,false);
285#endif 285#endif
286 addItemInt("Day Begins",&mDayBegins,7); 286 addItemInt("Day Begins",&mDayBegins,7);
287 addItemInt("Working Hours Start",&mWorkingHoursStart,8); 287 addItemInt("Working Hours Start",&mWorkingHoursStart,8);
288 addItemInt("Working Hours End",&mWorkingHoursEnd,17); 288 addItemInt("Working Hours End",&mWorkingHoursEnd,17);
289 addItemBool("Exclude Holidays",&mExcludeHolidays,true); 289 addItemBool("Exclude Holidays",&mExcludeHolidays,true);
290 addItemBool("Exclude Saturdays",&mExcludeSaturdays,true); 290 addItemBool("Exclude Saturdays",&mExcludeSaturdays,true);
291 291
292 addItemBool("Month View Uses Category Color",&mMonthViewUsesCategoryColor,false); 292 addItemBool("Month View Uses Category Color",&mMonthViewUsesCategoryColor,false);
293 addItemBool("Full View Month",&mFullViewMonth,true); 293 addItemBool("Full View Month",&mFullViewMonth,true);
294 addItemBool("Full View Todo",&mFullViewTodo,true); 294 addItemBool("Full View Todo",&mFullViewTodo,true);
295 addItemBool("Quick Todo",&mEnableQuickTodo,false); 295 addItemBool("Quick Todo",&mEnableQuickTodo,false);
296 296
297 addItemInt("Next X Days",&mNextXDays,3); 297 addItemInt("Next X Days",&mNextXDays,3);
298 298
299 KPrefs::setCurrentGroup("Printer"); 299 KPrefs::setCurrentGroup("Printer");
300 300
301 KPrefs::setCurrentGroup("Layout"); 301 KPrefs::setCurrentGroup("Layout");
302 302
303 addItemBool("CompactDialogs",&mCompactDialogs,false); 303 addItemBool("CompactDialogs",&mCompactDialogs,false);
304 addItemBool("VerticalScreen",&mVerticalScreen,true); 304 addItemBool("VerticalScreen",&mVerticalScreen,true);
305 305
306 KPrefs::setCurrentGroup("KOrganizer Plugins"); 306 KPrefs::setCurrentGroup("KOrganizer Plugins");
307 307
308 addItemStringList("SelectedPlugins",&mSelectedPlugins,"holidays"); 308 addItemStringList("SelectedPlugins",&mSelectedPlugins,"holidays");
309 309
310 KPrefs::setCurrentGroup("Group Scheduling"); 310 KPrefs::setCurrentGroup("Group Scheduling");
311 311
312 addItemInt("IMIPScheduler",&mIMIPScheduler,IMIPKMail); 312 addItemInt("IMIPScheduler",&mIMIPScheduler,IMIPKMail);
313 addItemInt("IMIPSend",&mIMIPSend,IMIPdirectsend); 313 addItemInt("IMIPSend",&mIMIPSend,IMIPdirectsend);
314 addItemStringList("AdditionalMails",&mAdditionalMails,""); 314 addItemStringList("AdditionalMails",&mAdditionalMails,"");
315 addItemInt("IMIP auto refresh",&mIMIPAutoRefresh,neverAuto); 315 addItemInt("IMIP auto refresh",&mIMIPAutoRefresh,neverAuto);
316 addItemInt("IMIP auto insert request",&mIMIPAutoInsertRequest,neverAuto); 316 addItemInt("IMIP auto insert request",&mIMIPAutoInsertRequest,neverAuto);
317 addItemInt("IMIP auto insert reply",&mIMIPAutoInsertReply,neverAuto); 317 addItemInt("IMIP auto insert reply",&mIMIPAutoInsertReply,neverAuto);
318 addItemInt("IMIP auto FreeBusy",&mIMIPAutoFreeBusy,neverAuto); 318 addItemInt("IMIP auto FreeBusy",&mIMIPAutoFreeBusy,neverAuto);
319 addItemInt("IMIP auto save FreeBusy",&mIMIPAutoFreeBusyReply,neverAuto); 319 addItemInt("IMIP auto save FreeBusy",&mIMIPAutoFreeBusyReply,neverAuto);
320 320
321 KPrefs::setCurrentGroup( "Editors" ); 321 KPrefs::setCurrentGroup( "Editors" );
322 322
323 addItemStringList( "EventTemplates", &mEventTemplates ); 323 addItemStringList( "EventTemplates", &mEventTemplates );
324 addItemStringList( "TodoTemplates", &mTodoTemplates ); 324 addItemStringList( "TodoTemplates", &mTodoTemplates );
325 325
326 addItemInt("DestinationPolicy",&mDestination,standardDestination); 326 addItemInt("DestinationPolicy",&mDestination,standardDestination);
327 327
328 KPrefs::setCurrentGroup( "ViewOptions" ); 328 KPrefs::setCurrentGroup( "ViewOptions" );
329 addItemBool("EVshowDetails",&mEVshowDetails,true); 329 addItemBool("EVshowDetails",&mEVshowDetails,true);
330 addItemBool("EVshowCreated",&mEVshowCreated,true); 330 addItemBool("EVshowCreated",&mEVshowCreated,true);
331 addItemBool("EVshowChanged",&mEVshowChanged,true); 331 addItemBool("EVshowChanged",&mEVshowChanged,true);
332 addItemBool("WTshowDetails",&mWTshowDetails,false); 332 addItemBool("WTshowDetails",&mWTshowDetails,false);
333 addItemBool("WTshowCreated",&mWTshowCreated,false); 333 addItemBool("WTshowCreated",&mWTshowCreated,false);
334 addItemBool("WTshowChanged",&mWTshowChanged,false); 334 addItemBool("WTshowChanged",&mWTshowChanged,false);
335 mCalendars.setAutoDelete( true ); 335 mCalendars.setAutoDelete( true );
336} 336}
337 337
338 338
339KOPrefs::~KOPrefs() 339KOPrefs::~KOPrefs()
340{ 340{
341 if (mInstance == this) 341 if (mInstance == this)
342 mInstance = insd.setObject(0); 342 mInstance = insd.setObject(0);
343 mCalendars.setAutoDelete( true ); 343 mCalendars.setAutoDelete( true );
344 mCalendars.clear(); 344 mCalendars.clear();
345 //qDebug("KOPrefs::~KOPrefs() "); 345 //qDebug("KOPrefs::~KOPrefs() ");
346} 346}
347 347
348 348
349KOPrefs *KOPrefs::instance() 349KOPrefs *KOPrefs::instance()
350{ 350{
351 if (!mInstance) { 351 if (!mInstance) {
352 mInstance = insd.setObject(new KOPrefs()); 352 mInstance = insd.setObject(new KOPrefs());
353 mInstance->readConfig(); 353 mInstance->readConfig();
354 } 354 }
355 355
356 return mInstance; 356 return mInstance;
357} 357}
358 358
359void KOPrefs::usrSetDefaults() 359void KOPrefs::usrSetDefaults()
360{ 360{
361 361
362} 362}
363 363
364void KOPrefs::fillMailDefaults() 364void KOPrefs::fillMailDefaults()
365{ 365{
366 if (mName.isEmpty()) mName = i18n("Anonymous"); 366 if (mName.isEmpty()) mName = i18n("Anonymous");
367 if (mEmail.isEmpty()) mEmail = i18n("nobody@nowhere"); 367 if (mEmail.isEmpty()) mEmail = i18n("nobody@nowhere");
368} 368}
369 369
370void KOPrefs::setTimeZoneIdDefault() 370void KOPrefs::setTimeZoneIdDefault()
371{ 371{
372 ; 372 ;
373} 373}
374 374
375void KOPrefs::setAllDefaults() 375void KOPrefs::setAllDefaults()
376{ 376{
377 setCategoryDefaults(); 377 setCategoryDefaults();
378 mEventSummaryUser = getDefaultList() ; 378 mEventSummaryUser = getDefaultList() ;
379 mTodoSummaryUser = getDefaultList() ; 379 mTodoSummaryUser = getDefaultList() ;
380 mJournalSummaryUser = getDefaultList() ; 380 mJournalSummaryUser = getDefaultList() ;
381 mLocationDefaults = getLocationDefaultList(); 381 mLocationDefaults = getLocationDefaultList();
382} 382}
383 383
384void KOPrefs::setCategoryDefaults() 384void KOPrefs::setCategoryDefaults()
385{ 385{
386 mCustomCategories.clear(); 386 mCustomCategories.clear();
387 mCustomCategories = getDefaultList(); 387 mCustomCategories = getDefaultList();
388 388
389 QStringList::Iterator it; 389 QStringList::Iterator it;
390 for (it = mCustomCategories.begin();it != mCustomCategories.end();++it ) { 390 for (it = mCustomCategories.begin();it != mCustomCategories.end();++it ) {
391 setCategoryColor(*it,mDefaultCategoryColor); 391 setCategoryColor(*it,mDefaultCategoryColor);
392 } 392 }
393} 393}
394QStringList KOPrefs::getLocationDefaultList() 394QStringList KOPrefs::getLocationDefaultList()
395{ 395{
396 QStringList retval ; 396 QStringList retval ;
397 retval << i18n("Home") << i18n("Office") << i18n("Library") << i18n("School") << i18n("Doctor") << i18n("Beach") 397 retval << i18n("Home") << i18n("Office") << i18n("Library") << i18n("School") << i18n("Doctor") << i18n("Beach")
398 << i18n("University") << i18n("Restaurant") << i18n("Bar") << i18n("Conference room") 398 << i18n("University") << i18n("Restaurant") << i18n("Bar") << i18n("Conference room")
399 << i18n("Cinema") << i18n("Lake") << i18n("Kindergarten") 399 << i18n("Cinema") << i18n("Lake") << i18n("Kindergarten")
400 << i18n("Germany") << i18n("Sweden") << i18n("Forest") << i18n("Desert") << i18n("Kitchen") ; 400 << i18n("Germany") << i18n("Sweden") << i18n("Forest") << i18n("Desert") << i18n("Kitchen") ;
401 // << i18n("") << i18n("") << i18n("") << i18n("") << i18n("") << i18n("") << i18n("") << i18n("") 401 // << i18n("") << i18n("") << i18n("") << i18n("") << i18n("") << i18n("") << i18n("") << i18n("")
402 402
403 retval.sort(); 403 retval.sort();
404 return retval; 404 return retval;
405} 405}
406QStringList KOPrefs::getDefaultList() 406QStringList KOPrefs::getDefaultList()
407{ 407{
408 QStringList retval ; 408 QStringList retval ;
409 retval << i18n("Anniversary") << i18n("Appointment") << i18n("Birthday") << i18n("Business") << i18n("Customer") 409 retval << i18n("Anniversary") << i18n("Appointment") << i18n("Birthday") << i18n("Business") << i18n("Customer")
410 << i18n("Break") 410 << i18n("Break")
411 << i18n("Family") << i18n("Favorites") << i18n("Fishing") << i18n("Gifts") 411 << i18n("Family") << i18n("Favorites") << i18n("Fishing") << i18n("Gifts")
412 << i18n("Holiday") << i18n("Holiday Cards")<< i18n("Hot Contacts") 412 << i18n("Holiday") << i18n("Holiday Cards")<< i18n("Hot Contacts")
413 << i18n("Meeting") << i18n("Miscellaneous") << i18n("Partner") << i18n("Personal") 413 << i18n("Meeting") << i18n("Miscellaneous") << i18n("Partner") << i18n("Personal")
414 << i18n("PHB") << i18n("Phone Calls") << i18n("Shopping") 414 << i18n("PHB") << i18n("Phone Calls") << i18n("Shopping")
415 << i18n("Sports") << i18n("Talk") << i18n("Travel") << i18n("TV") 415 << i18n("Sports") << i18n("Talk") << i18n("Travel") << i18n("TV")
416 << i18n("Vacation") ; 416 << i18n("Vacation") ;
417 retval.sort(); 417 retval.sort();
418 //qDebug("cat %s ", retval.join("-").latin1()); 418 //qDebug("cat %s ", retval.join("-").latin1());
419 return retval; 419 return retval;
420} 420}
421// << i18n("Business Travel") << i18n("Education") << i18n("Hiking") << i18n("Hunting") << i18n("Recurring") << i18n("Personal Travel") << i18n("Speach") << i18n("Festival") << i18n("Competition")<< i18n("Party")<< i18n("Projects")<< i18n("Kids") << i18n("Special Occasion")<< i18n("Breakfast")<< i18n("Dinner") << i18n("Lunch")<< i18n("University")<< i18n("School")<< i18n("Flight")<< i18n("Key Customer") << i18n("VIP") << i18n("SyncEvent") << i18n("Cinema") 421// << i18n("Business Travel") << i18n("Education") << i18n("Hiking") << i18n("Hunting") << i18n("Recurring") << i18n("Personal Travel") << i18n("Speach") << i18n("Festival") << i18n("Competition")<< i18n("Party")<< i18n("Projects")<< i18n("Kids") << i18n("Special Occasion")<< i18n("Breakfast")<< i18n("Dinner") << i18n("Lunch")<< i18n("University")<< i18n("School")<< i18n("Flight")<< i18n("Key Customer") << i18n("VIP") << i18n("SyncEvent") << i18n("Cinema")
422void KOPrefs::usrReadConfig() 422void KOPrefs::usrReadConfig()
423{ 423{
424 config()->setGroup("General"); 424 config()->setGroup("General");
425 425
426 //qDebug("KOPrefs::usrReadConfig() "); 426 //qDebug("KOPrefs::usrReadConfig() ");
427 mCustomCategories = config()->readListEntry("Custom Categories"); 427 mCustomCategories = config()->readListEntry("Custom Categories");
428 mOldLoadedLanguage = mOldLanguage ; 428 mOldLoadedLanguage = mOldLanguage ;
429 mOldLanguage = KPimGlobalPrefs::instance()->mPreferredLanguage; 429 mOldLanguage = KPimGlobalPrefs::instance()->mPreferredLanguage;
430 if (mLocationDefaults.isEmpty()) { 430 if (mLocationDefaults.isEmpty()) {
431 mLocationDefaults = getLocationDefaultList(); 431 mLocationDefaults = getLocationDefaultList();
432 } 432 }
433 433
434 if (mEventSummaryUser.isEmpty()) { 434 if (mEventSummaryUser.isEmpty()) {
435 mEventSummaryUser = getDefaultList() ; 435 mEventSummaryUser = getDefaultList() ;
436 } 436 }
437 if (mTodoSummaryUser.isEmpty()) { 437 if (mTodoSummaryUser.isEmpty()) {
438 mTodoSummaryUser = getDefaultList() ; 438 mTodoSummaryUser = getDefaultList() ;
439 } 439 }
440 440
441 if (mCustomCategories.isEmpty()) setCategoryDefaults(); 441 if (mCustomCategories.isEmpty()) setCategoryDefaults();
442 442
443 config()->setGroup("Personal Settings"); 443 config()->setGroup("Personal Settings");
444 mName = config()->readEntry("user_name",""); 444 mName = config()->readEntry("user_name","");
445 mEmail = config()->readEntry("user_email",""); 445 mEmail = config()->readEntry("user_email","");
446 fillMailDefaults(); 446 fillMailDefaults();
447 447
448 config()->setGroup("Category Colors"); 448 config()->setGroup("Category Colors");
449 QStringList::Iterator it; 449 QStringList::Iterator it;
450 for (it = mCustomCategories.begin();it != mCustomCategories.end();++it ) { 450 for (it = mCustomCategories.begin();it != mCustomCategories.end();++it ) {
451 setCategoryColor(*it,config()->readColorEntry(*it,&mDefaultCategoryColor)); 451 setCategoryColor(*it,config()->readColorEntry(*it,&mDefaultCategoryColor));
452 452
453 } 453 }
454 KConfig fc (locateLocal("config","kopicalendarrc")); 454 KConfig fc (locateLocal("config","kopicalendarrc"));
455 fc.setGroup("CC"); 455 fc.setGroup("CC");
456 int numCals = fc.readNumEntry("NumberCalendars",0 ); 456 int numCals = fc.readNumEntry("NumberCalendars",0 );
457 mNextAvailableCalendar = 1; 457 mNextAvailableCalendar = 1;
458 if ( numCals == 0 ) { 458 if ( numCals == 0 ) {
459 KopiCalendarFile *kkf = getNewCalendar(); 459 KopiCalendarFile *kkf = getNewCalendar();
460 kkf->isStandard = true; 460 kkf->isStandard = true;
461 kkf->mName = i18n("Standard"); 461 kkf->mName = i18n("Standard");
462 kkf->mFileName = QDir::convertSeparators( locateLocal( "data", "korganizer/mycalendar.ics" ) ); 462 kkf->mFileName = QDir::convertSeparators( locateLocal( "data", "korganizer/mycalendar.ics" ) );
463 } 463 }
464 while ( mNextAvailableCalendar <= numCals ) { 464 while ( mNextAvailableCalendar <= numCals ) {
465 //qDebug("Read cal #%d ", mNextAvailableCalendar ); 465 //qDebug("Read cal #%d ", mNextAvailableCalendar );
466 QString prefix = "Cal_" +QString::number( mNextAvailableCalendar ); 466 QString prefix = "Cal_" +QString::number( mNextAvailableCalendar );
467 KopiCalendarFile *kkf = getNewCalendar(); 467 KopiCalendarFile *kkf = getNewCalendar();
468 kkf->isStandard = fc.readBoolEntry( prefix+"_isStandard", false ); 468 kkf->isStandard = fc.readBoolEntry( prefix+"_isStandard", false );
469 kkf->isEnabled = fc.readBoolEntry( prefix+"_isEnabled", true); 469 kkf->isEnabled = fc.readBoolEntry( prefix+"_isEnabled", true);
470 kkf->isRelative = fc.readBoolEntry( prefix+"_isRelative", false ); 470 kkf->isRelative = fc.readBoolEntry( prefix+"_isRelative", false );
471 kkf->isAlarmEnabled = fc.readBoolEntry( prefix+"_isAlarmEnabled", true); 471 kkf->isAlarmEnabled = fc.readBoolEntry( prefix+"_isAlarmEnabled", true);
472 kkf->isReadOnly = fc.readBoolEntry( prefix+"_isReadOnly", false); 472 kkf->isReadOnly = fc.readBoolEntry( prefix+"_isReadOnly", false);
473 kkf->mName = fc.readEntry( prefix+"_Name", "Calendar"); 473 kkf->mName = fc.readEntry( prefix+"_Name", "Calendar");
474 kkf->mFileName = QDir::convertSeparators( fc.readEntry( prefix+"_FileName", kkf->mFileName) ); 474 kkf->mFileName = QDir::convertSeparators( fc.readEntry( prefix+"_FileName", kkf->mFileName) );
475 kkf->mSavedFileName = QDir::convertSeparators( fc.readEntry( prefix+"_SavedFileName", kkf->mFileName) ); 475 kkf->mSavedFileName = QDir::convertSeparators( fc.readEntry( prefix+"_SavedFileName", kkf->mFileName) );
476 kkf->mDefaultColor = fc.readColorEntry( prefix+"_Color",&mEventColor); 476 kkf->mDefaultColor = fc.readColorEntry( prefix+"_Color",&mEventColor);
477 if ( kkf->mCalNumber == 1 ) { 477 if ( kkf->mCalNumber == 1 ) {
478 kkf->mFileName = locateLocal( "data", "korganizer/mycalendar.ics" ); 478 kkf->mFileName = locateLocal( "data", "korganizer/mycalendar.ics" );
479 } 479 }
480 //qDebug("NAME %s %s", kkf->mName.latin1(), i18n("Birthdays").latin1() ); 480 //qDebug("NAME %s %s", kkf->mName.latin1(), i18n("Birthdays").latin1() );
481 if ( kkf->mName == i18n("Birthdays") ) { 481 if ( kkf->mName == i18n("Birthdays") ) {
482 kkf->mFileName = locateLocal( "data", "korganizer/birthdays.ics" ); 482 kkf->mFileName = locateLocal( "data", "korganizer/birthdays.ics" );
483 } 483 }
484 if ( kkf->isRelative ) 484 if ( kkf->isRelative )
485 kkf->mFileName = QDir::convertSeparators( KGlobalSettings::calendarDir() + kkf->mSavedFileName ); 485 kkf->mFileName = QDir::convertSeparators( KGlobalSettings::calendarDir() + kkf->mSavedFileName );
486 } 486 }
487 487
488 KPimPrefs::usrReadConfig(); 488 KPimPrefs::usrReadConfig();
489} 489}
490 490
491KopiCalendarFile * KOPrefs::getCalendar( int num ) 491KopiCalendarFile * KOPrefs::getCalendar( int num )
492{ 492{
493 return mDefCalColors[num-1]; 493 return mDefCalColors[num-1];
494} 494}
495 495
496KopiCalendarFile * KOPrefs::getNewCalendar() 496KopiCalendarFile * KOPrefs::getNewCalendar()
497{ 497{
498 KopiCalendarFile * kkf = new KopiCalendarFile(); 498 KopiCalendarFile * kkf = new KopiCalendarFile();
499 kkf->mCalNumber = mNextAvailableCalendar; 499 kkf->mCalNumber = mNextAvailableCalendar;
500 mDefCalColors.resize( mNextAvailableCalendar ); 500 mDefCalColors.resize( mNextAvailableCalendar );
501 mDefCalColors[mNextAvailableCalendar-1] = kkf; 501 mDefCalColors[mNextAvailableCalendar-1] = kkf;
502 ++mNextAvailableCalendar; 502 ++mNextAvailableCalendar;
503 kkf->mDefaultColor = mEventColor; 503 kkf->mDefaultColor = mEventColor;
504 kkf->mName = i18n("New Calendar"); 504 kkf->mName = i18n("New Calendar");
505 mCalendars.append( kkf ); 505 mCalendars.append( kkf );
506 return kkf; 506 return kkf;
507} 507}
508void KOPrefs::deleteCalendar( int num ) 508void KOPrefs::deleteCalendar( int num )
509{ 509{
510 KopiCalendarFile * kkf = mCalendars.first(); 510 KopiCalendarFile * kkf = mCalendars.first();
511 while ( kkf ) { 511 while ( kkf ) {
512 if ( kkf->mCalNumber == num ) { 512 if ( kkf->mCalNumber == num ) {
513 qDebug("KOPrefs::deleteCalendar %d ", num ); 513 qDebug("KOPrefs::deleteCalendar %d ", num );
514 mCalendars.remove( kkf ); 514 mCalendars.remove( kkf );
515 delete kkf; 515 delete kkf;
516 return; 516 return;
517 } 517 }
518 kkf = mCalendars.next(); 518 kkf = mCalendars.next();
519 } 519 }
520} 520}
521int KOPrefs::getCalendarID( const QString & name ) 521int KOPrefs::getCalendarID( const QString & name )
522{ 522{
523 KopiCalendarFile * kkf = mCalendars.first(); 523 KopiCalendarFile * kkf = mCalendars.first();
524 while ( kkf ) { 524 while ( kkf ) {
525 if ( name == kkf->mName) 525 if ( name == kkf->mName)
526 return kkf->mCalNumber; 526 return kkf->mCalNumber;
527 kkf = mCalendars.next(); 527 kkf = mCalendars.next();
528 } 528 }
529 return 1; 529 return 1;
530} 530}
531int KOPrefs::getFuzzyCalendarID( const QString & name ) 531int KOPrefs::getFuzzyCalendarID( const QString & name )
532{ 532{
533 KopiCalendarFile * kkf = mCalendars.first(); 533 KopiCalendarFile * kkf = mCalendars.first();
534 while ( kkf ) { 534 while ( kkf ) {
535 if ( name.lower() == kkf->mName.lower()) 535 if ( name.lower() == kkf->mName.lower())
536 return kkf->mCalNumber; 536 return kkf->mCalNumber;
537 kkf = mCalendars.next(); 537 kkf = mCalendars.next();
538 } 538 }
539 QString name2 = name;
540 name2.replace (QRegExp ("_")," " );
541 kkf = mCalendars.first();
542 while ( kkf ) {
543 if ( name2.lower() == kkf->mName.lower())
544 return kkf->mCalNumber;
545 kkf = mCalendars.next();
546 }
539 return 0; 547 return 0;
540} 548}
541QString KOPrefs::calName( int calNum) const 549QString KOPrefs::calName( int calNum) const
542{ 550{
543 return (mDefCalColors[calNum-1])->mName; 551 return (mDefCalColors[calNum-1])->mName;
544} 552}
545QColor KOPrefs::defaultColor( int calNum ) const 553QColor KOPrefs::defaultColor( int calNum ) const
546{ 554{
547 if ( calNum == 1 ) return mEventColor; 555 if ( calNum == 1 ) return mEventColor;
548 return (mDefCalColors[calNum-1])->mDefaultColor; 556 return (mDefCalColors[calNum-1])->mDefaultColor;
549} 557}
550void KOPrefs::usrWriteConfig() 558void KOPrefs::usrWriteConfig()
551{ 559{
552 config()->setGroup("General"); 560 config()->setGroup("General");
553 config()->writeEntry("Custom Categories",mCustomCategories); 561 config()->writeEntry("Custom Categories",mCustomCategories);
554 562
555 config()->setGroup("Personal Settings"); 563 config()->setGroup("Personal Settings");
556 config()->writeEntry("user_name",mName); 564 config()->writeEntry("user_name",mName);
557 config()->writeEntry("user_email",mEmail); 565 config()->writeEntry("user_email",mEmail);
558 566
559 config()->setGroup("Category Colors"); 567 config()->setGroup("Category Colors");
560 QDictIterator<QColor> it(mCategoryColors); 568 QDictIterator<QColor> it(mCategoryColors);
561 while (it.current()) { 569 while (it.current()) {
562 config()->writeEntry(it.currentKey(),*(it.current())); 570 config()->writeEntry(it.currentKey(),*(it.current()));
563 ++it; 571 ++it;
564 } 572 }
565 KConfig fc (locateLocal("config","kopicalendarrc")); 573 KConfig fc (locateLocal("config","kopicalendarrc"));
566 fc.setGroup("CC"); 574 fc.setGroup("CC");
567 fc.deleteGroup( "CC"); 575 fc.deleteGroup( "CC");
568 fc.setGroup("CC"); 576 fc.setGroup("CC");
569 fc.writeEntry("NumberCalendars",mCalendars.count()); 577 fc.writeEntry("NumberCalendars",mCalendars.count());
570 int numCal = 1; 578 int numCal = 1;
571 int writeCal = 0; 579 int writeCal = 0;
572 while ( numCal < mNextAvailableCalendar ) { 580 while ( numCal < mNextAvailableCalendar ) {
573 KopiCalendarFile * kkf = mCalendars.first(); 581 KopiCalendarFile * kkf = mCalendars.first();
574 while ( kkf ) { 582 while ( kkf ) {
575 //qDebug("cal num %d %d ", kkf->mCalNumber, numCal); 583 //qDebug("cal num %d %d ", kkf->mCalNumber, numCal);
576 if ( kkf->mCalNumber == numCal ) { 584 if ( kkf->mCalNumber == numCal ) {
577 ++writeCal; 585 ++writeCal;
578 //qDebug("Write calendar %d %d ", numCal , writeCal); 586 //qDebug("Write calendar %d %d ", numCal , writeCal);
579 QString prefix = "Cal_" + QString::number( writeCal ); 587 QString prefix = "Cal_" + QString::number( writeCal );
580 fc.writeEntry( prefix+"_isStandard", kkf->isStandard ); 588 fc.writeEntry( prefix+"_isStandard", kkf->isStandard );
581 fc.writeEntry( prefix+"_isEnabled", kkf->isEnabled ); 589 fc.writeEntry( prefix+"_isEnabled", kkf->isEnabled );
582 fc.writeEntry( prefix+"_isAlarmEnabled", kkf->isAlarmEnabled ); 590 fc.writeEntry( prefix+"_isAlarmEnabled", kkf->isAlarmEnabled );
583 fc.writeEntry( prefix+"_isReadOnly", kkf->isReadOnly ); 591 fc.writeEntry( prefix+"_isReadOnly", kkf->isReadOnly );
584 fc.writeEntry( prefix+"_isRelative", kkf->isRelative ); 592 fc.writeEntry( prefix+"_isRelative", kkf->isRelative );
585 fc.writeEntry( prefix+"_Name", kkf->mName); 593 fc.writeEntry( prefix+"_Name", kkf->mName);
586 fc.writeEntry( prefix+"_FileName", kkf->mFileName); 594 fc.writeEntry( prefix+"_FileName", kkf->mFileName);
587 fc.writeEntry( prefix+"_SavedFileName", kkf->mSavedFileName); 595 fc.writeEntry( prefix+"_SavedFileName", kkf->mSavedFileName);
588 fc.writeEntry( prefix+"_Color",kkf->mDefaultColor); 596 fc.writeEntry( prefix+"_Color",kkf->mDefaultColor);
589 } 597 }
590 kkf = mCalendars.next(); 598 kkf = mCalendars.next();
591 } 599 }
592 ++numCal; 600 ++numCal;
593 } 601 }
594 fc.sync(); 602 fc.sync();
595 KPimPrefs::usrWriteConfig(); 603 KPimPrefs::usrWriteConfig();
596} 604}
597 605
598void KOPrefs::setCategoryColor(QString cat,const QColor & color) 606void KOPrefs::setCategoryColor(QString cat,const QColor & color)
599{ 607{
600 mCategoryColors.replace(cat,new QColor(color)); 608 mCategoryColors.replace(cat,new QColor(color));
601} 609}
602 610
603QColor *KOPrefs::categoryColor(QString cat) 611QColor *KOPrefs::categoryColor(QString cat)
604{ 612{
605 QColor *color = 0; 613 QColor *color = 0;
606 614
607 if (!cat.isEmpty()) color = mCategoryColors[cat]; 615 if (!cat.isEmpty()) color = mCategoryColors[cat];
608 616
609 if (color) return color; 617 if (color) return color;
610 else return &mDefaultCategoryColor; 618 else return &mDefaultCategoryColor;
611} 619}
612 620
613void KOPrefs::setFullName(const QString &name) 621void KOPrefs::setFullName(const QString &name)
614{ 622{
615 mName = name; 623 mName = name;
616} 624}
617 625
618void KOPrefs::setEmail(const QString &email) 626void KOPrefs::setEmail(const QString &email)
619{ 627{
620 //qDebug(" KOPrefs::setEmai*********** %s",email.latin1() ); 628 //qDebug(" KOPrefs::setEmai*********** %s",email.latin1() );
621 mEmail = email; 629 mEmail = email;
622} 630}
623 631
624QString KOPrefs::fullName() 632QString KOPrefs::fullName()
625{ 633{
626 if (mEmailControlCenter) { 634 if (mEmailControlCenter) {
627 KEMailSettings settings; 635 KEMailSettings settings;
628 return settings.getSetting(KEMailSettings::RealName); 636 return settings.getSetting(KEMailSettings::RealName);
629 } else { 637 } else {
630 return mName; 638 return mName;
631 } 639 }
632} 640}
633 641
634QString KOPrefs::email() 642QString KOPrefs::email()
635{ 643{
636 if (mEmailControlCenter) { 644 if (mEmailControlCenter) {
637 KEMailSettings settings; 645 KEMailSettings settings;
638 return settings.getSetting(KEMailSettings::EmailAddress); 646 return settings.getSetting(KEMailSettings::EmailAddress);
639 } else { 647 } else {
640 return mEmail; 648 return mEmail;
641 } 649 }
642} 650}
643KConfig* KOPrefs::getConfig() 651KConfig* KOPrefs::getConfig()
644{ 652{
645 return config(); 653 return config();
646} 654}