Diffstat (limited to 'korganizer/koeditorgeneral.cpp') (more/less context) (show whitespace changes)
-rw-r--r-- | korganizer/koeditorgeneral.cpp | 8 |
1 files changed, 1 insertions, 7 deletions
diff --git a/korganizer/koeditorgeneral.cpp b/korganizer/koeditorgeneral.cpp index fd50b05..aa55d82 100644 --- a/korganizer/koeditorgeneral.cpp +++ b/korganizer/koeditorgeneral.cpp | |||
@@ -438,103 +438,97 @@ void KOEditorGeneral::setDefaults(bool allDay) | |||
438 | mAlarmButton ->setChecked( false ); | 438 | mAlarmButton ->setChecked( false ); |
439 | mAlarmTimeEdit->setValue(alarmTime); | 439 | mAlarmTimeEdit->setValue(alarmTime); |
440 | mAlarmIncrCombo->setCurrentItem(0); | 440 | mAlarmIncrCombo->setCurrentItem(0); |
441 | enableAlarmEdit( false ); | 441 | enableAlarmEdit( false ); |
442 | //alarmDisable (false); | 442 | //alarmDisable (false); |
443 | mSecrecyCombo->setCurrentItem(Incidence::SecrecyPublic); | 443 | mSecrecyCombo->setCurrentItem(Incidence::SecrecyPublic); |
444 | mCancelBox->setChecked( false ); | 444 | mCancelBox->setChecked( false ); |
445 | mSummaryEdit->setEditText(""); | 445 | mSummaryEdit->setEditText(""); |
446 | mLocationEdit->setEditText(""); | 446 | mLocationEdit->setEditText(""); |
447 | mDescriptionEdit->setText(""); | 447 | mDescriptionEdit->setText(""); |
448 | mAlarmSound = KOPrefs::instance()->mDefaultAlarmFile; | 448 | mAlarmSound = KOPrefs::instance()->mDefaultAlarmFile; |
449 | setCategories(""); | 449 | setCategories(""); |
450 | fillCalCombo(); | 450 | fillCalCombo(); |
451 | } | 451 | } |
452 | void KOEditorGeneral::setSecrecy( int num ) | 452 | void KOEditorGeneral::setSecrecy( int num ) |
453 | { | 453 | { |
454 | mSecrecyCombo->setCurrentItem(num); | 454 | mSecrecyCombo->setCurrentItem(num); |
455 | } | 455 | } |
456 | void KOEditorGeneral::fillCalCombo( int setToID ) | 456 | void KOEditorGeneral::fillCalCombo( int setToID ) |
457 | { | 457 | { |
458 | mCalendarBox->clear(); | 458 | mCalendarBox->clear(); |
459 | KopiCalendarFile * kkf = KOPrefs::instance()->mCalendars.first(); | 459 | KopiCalendarFile * kkf = KOPrefs::instance()->mCalendars.first(); |
460 | int std = 0; | 460 | int std = 0; |
461 | int count = 0; | 461 | int count = 0; |
462 | while ( kkf ) { | 462 | while ( kkf ) { |
463 | if ( !kkf->mErrorOnLoad &&! kkf->isReadOnly ) { | 463 | if ( !kkf->mErrorOnLoad &&! kkf->isReadOnly ) { |
464 | if ( setToID ) { | 464 | if ( setToID ) { |
465 | if ( kkf->mCalNumber == setToID ) | 465 | if ( kkf->mCalNumber == setToID ) |
466 | std = count; | 466 | std = count; |
467 | } else { | 467 | } else { |
468 | if ( kkf->isStandard ) { | 468 | if ( kkf->isStandard ) { |
469 | std = count; | 469 | std = count; |
470 | } | 470 | } |
471 | } | 471 | } |
472 | ++count; | 472 | ++count; |
473 | mCalendarBox->insertItem( kkf->mName ); | 473 | mCalendarBox->insertItem( kkf->mName ); |
474 | } | 474 | } |
475 | kkf = KOPrefs::instance()->mCalendars.next(); | 475 | kkf = KOPrefs::instance()->mCalendars.next(); |
476 | } | 476 | } |
477 | mCalendarBox->setCurrentItem( std ); | 477 | mCalendarBox->setCurrentItem( std ); |
478 | if ( KOPrefs::instance()->mCalendars.count() == 1 ) | 478 | if ( KOPrefs::instance()->mCalendars.count() == 1 ) |
479 | mCalendarBox->hide(); | 479 | mCalendarBox->hide(); |
480 | else | 480 | else |
481 | mCalendarBox->show(); | 481 | mCalendarBox->show(); |
482 | 482 | ||
483 | } | 483 | } |
484 | int KOEditorGeneral::getCalendarID() | 484 | int KOEditorGeneral::getCalendarID() |
485 | { | 485 | { |
486 | KopiCalendarFile * kkf = KOPrefs::instance()->mCalendars.first(); | 486 | return KOPrefs::instance()->getCalendarID( mCalendarBox->currentText() ); |
487 | while ( kkf ) { | ||
488 | if ( mCalendarBox->currentText() == kkf->mName) | ||
489 | return kkf->mCalNumber; | ||
490 | kkf = KOPrefs::instance()->mCalendars.next(); | ||
491 | } | ||
492 | return 1; | ||
493 | } | 487 | } |
494 | 488 | ||
495 | void KOEditorGeneral::readIncidence(Incidence *event) | 489 | void KOEditorGeneral::readIncidence(Incidence *event) |
496 | { | 490 | { |
497 | fillCalCombo( event->calID() ); | 491 | fillCalCombo( event->calID() ); |
498 | mAlarmMessage = event->summary(); | 492 | mAlarmMessage = event->summary(); |
499 | if ( ! event->location().isEmpty() ) | 493 | if ( ! event->location().isEmpty() ) |
500 | mAlarmMessage += " ("+event->location()+")"; | 494 | mAlarmMessage += " ("+event->location()+")"; |
501 | mAlarmIncrCombo->setCurrentItem(0); | 495 | mAlarmIncrCombo->setCurrentItem(0); |
502 | mSummaryEdit->setEditText(event->summary()); | 496 | mSummaryEdit->setEditText(event->summary()); |
503 | mLocationEdit->setEditText(event->location()); | 497 | mLocationEdit->setEditText(event->location()); |
504 | mDescriptionEdit->setText(event->description()); | 498 | mDescriptionEdit->setText(event->description()); |
505 | 499 | ||
506 | #if 0 | 500 | #if 0 |
507 | // organizer information | 501 | // organizer information |
508 | mOwnerLabel->setText(i18n("Owner: ") + event->organizer()); | 502 | mOwnerLabel->setText(i18n("Owner: ") + event->organizer()); |
509 | #endif | 503 | #endif |
510 | 504 | ||
511 | enableAlarmEdit( event->isAlarmEnabled() ); | 505 | enableAlarmEdit( event->isAlarmEnabled() ); |
512 | //qDebug("KOEditorGeneral::readIncidence(Incidence *event) "); | 506 | //qDebug("KOEditorGeneral::readIncidence(Incidence *event) "); |
513 | if(!event->isAlarmEnabled()) { | 507 | if(!event->isAlarmEnabled()) { |
514 | // TODO: Implement a KPrefsComboItem to solve this in a clean way. | 508 | // TODO: Implement a KPrefsComboItem to solve this in a clean way. |
515 | int alarmTime; | 509 | int alarmTime; |
516 | int a[] = { 1,5,10,15,30,60,180, 1440 }; | 510 | int a[] = { 1,5,10,15,30,60,180, 1440 }; |
517 | int index = KOPrefs::instance()->mAlarmTime; | 511 | int index = KOPrefs::instance()->mAlarmTime; |
518 | if (index < 0 || index > 7) { | 512 | if (index < 0 || index > 7) { |
519 | alarmTime = 15; | 513 | alarmTime = 15; |
520 | } else { | 514 | } else { |
521 | alarmTime = a[index]; | 515 | alarmTime = a[index]; |
522 | } | 516 | } |
523 | mAlarmTimeEdit->setValue(alarmTime); | 517 | mAlarmTimeEdit->setValue(alarmTime); |
524 | } | 518 | } |
525 | mAlarmButton->setChecked( event->isAlarmEnabled() ); | 519 | mAlarmButton->setChecked( event->isAlarmEnabled() ); |
526 | mSecrecyCombo->setCurrentItem(event->secrecy()); | 520 | mSecrecyCombo->setCurrentItem(event->secrecy()); |
527 | mCancelBox->setChecked( event->cancelled() ); | 521 | mCancelBox->setChecked( event->cancelled() ); |
528 | mAlarmProgramButton->setOn(false); | 522 | mAlarmProgramButton->setOn(false); |
529 | mAlarmSoundButton->setOn(false); | 523 | mAlarmSoundButton->setOn(false); |
530 | 524 | ||
531 | // set up alarm stuff | 525 | // set up alarm stuff |
532 | QPtrList<Alarm> alarms = event->alarms(); | 526 | QPtrList<Alarm> alarms = event->alarms(); |
533 | Alarm* alarm; | 527 | Alarm* alarm; |
534 | mAlarmIncrCombo->setCurrentItem(0); | 528 | mAlarmIncrCombo->setCurrentItem(0); |
535 | for ( alarm = alarms.first(); alarm; alarm = alarms.next() ) { | 529 | for ( alarm = alarms.first(); alarm; alarm = alarms.next() ) { |
536 | int offset; | 530 | int offset; |
537 | if ( alarm->hasTime() ) { | 531 | if ( alarm->hasTime() ) { |
538 | QDateTime t = alarm->time(); | 532 | QDateTime t = alarm->time(); |
539 | offset = event->dtStart().secsTo( t ); | 533 | offset = event->dtStart().secsTo( t ); |
540 | } else { | 534 | } else { |