author | zautrix <zautrix> | 2005-07-07 12:30:17 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2005-07-07 12:30:17 (UTC) |
commit | 766b53919de14b8faec22db32b6a750acde0b760 (patch) (unidiff) | |
tree | bb07c0af89b0dddf4257a61e9f5b1cf23c4a282a /korganizer/kolistview.cpp | |
parent | b4d85da57e2d558ec088af6f3b2a34b1854462c0 (diff) | |
download | kdepimpi-766b53919de14b8faec22db32b6a750acde0b760.zip kdepimpi-766b53919de14b8faec22db32b6a750acde0b760.tar.gz kdepimpi-766b53919de14b8faec22db32b6a750acde0b760.tar.bz2 |
fixesss
-rw-r--r-- | korganizer/kolistview.cpp | 13 |
1 files changed, 4 insertions, 9 deletions
diff --git a/korganizer/kolistview.cpp b/korganizer/kolistview.cpp index 7783dd4..d25f671 100644 --- a/korganizer/kolistview.cpp +++ b/korganizer/kolistview.cpp | |||
@@ -472,121 +472,116 @@ void KOListView::populateCalPopup() | |||
472 | { | 472 | { |
473 | mCalPopup->clear(); | 473 | mCalPopup->clear(); |
474 | KopiCalendarFile * kkf = KOPrefs::instance()->mCalendars.first(); | 474 | KopiCalendarFile * kkf = KOPrefs::instance()->mCalendars.first(); |
475 | while ( kkf ) { | 475 | while ( kkf ) { |
476 | int index = mCalPopup->insertItem( kkf->mName+"...", kkf->mCalNumber); | 476 | int index = mCalPopup->insertItem( kkf->mName+"...", kkf->mCalNumber); |
477 | if ( kkf->mErrorOnLoad || kkf->isReadOnly ) | 477 | if ( kkf->mErrorOnLoad || kkf->isReadOnly ) |
478 | mCalPopup->setItemEnabled( index, false ); | 478 | mCalPopup->setItemEnabled( index, false ); |
479 | kkf = KOPrefs::instance()->mCalendars.next(); | 479 | kkf = KOPrefs::instance()->mCalendars.next(); |
480 | } | 480 | } |
481 | } | 481 | } |
482 | void KOListView::updateList() | 482 | void KOListView::updateList() |
483 | { | 483 | { |
484 | // qDebug(" KOListView::updateList() "); | 484 | // qDebug(" KOListView::updateList() "); |
485 | 485 | ||
486 | } | 486 | } |
487 | 487 | ||
488 | void KOListView::clearList() | 488 | void KOListView::clearList() |
489 | { | 489 | { |
490 | clear (); | 490 | clear (); |
491 | } | 491 | } |
492 | 492 | ||
493 | void KOListView::setCat() | 493 | void KOListView::setCat() |
494 | { | 494 | { |
495 | 495 | ||
496 | bool set = true; | 496 | bool set = true; |
497 | int result = KMessageBox::warningYesNoCancel(this, | 497 | int result = KMessageBox::warningYesNoCancel(this, |
498 | i18n("Do you want to <b>add</b> categories to the selected items or <b>reset</b> the list (i.e. remove current categories)?"), | 498 | i18n("Do you want to <b>add</b> categories to the selected items or <b>reset</b> the list (i.e. remove current categories)?"), |
499 | i18n("Set categories"), | 499 | i18n("Set categories"), |
500 | i18n("Add"), | 500 | i18n("Add"), |
501 | i18n("Reset")); | 501 | i18n("Reset")); |
502 | if (result == KMessageBox::Cancel) return; | 502 | if (result == KMessageBox::Cancel) return; |
503 | if (result == KMessageBox::Yes) set = false; | 503 | if (result == KMessageBox::Yes) set = false; |
504 | setCategories( set ); | 504 | setCategories( set ); |
505 | } | 505 | } |
506 | 506 | ||
507 | void KOListView::setAlarm() | 507 | void KOListView::setAlarm() |
508 | { | 508 | { |
509 | KOAlarmPrefs kap( this); | 509 | KOAlarmPrefs kap( this); |
510 | if ( !kap.exec() ) | 510 | if ( !kap.exec() ) |
511 | return; | 511 | return; |
512 | QPtrList<Incidence> delSel = getSelectedIncidences( true, true, false, true ); // no journals, only due todos | 512 | QPtrList<Incidence> delSel = getSelectedIncidences( true, true, false, true ); // no journals, only due todos |
513 | Incidence* inc = delSel.first(); | 513 | Incidence* inc = delSel.first(); |
514 | int count = 0; | 514 | int count = 0; |
515 | while ( inc ) { | 515 | while ( inc ) { |
516 | ++count; | 516 | ++count; |
517 | if (kap.mAlarmButton->isChecked()) { | 517 | if (kap.mAlarmButton->isChecked()) { |
518 | if (inc->alarms().count() == 0) | 518 | if (inc->alarms().count() == 0) |
519 | inc->newAlarm(); | 519 | inc->newAlarm(); |
520 | QPtrList<Alarm> alarms = inc->alarms(); | 520 | Alarm *alarm = inc->alarms().first(); |
521 | Alarm *alarm; | ||
522 | for (alarm = alarms.first(); alarm; alarm = alarms.next() ) { | ||
523 | alarm->setEnabled(true); | 521 | alarm->setEnabled(true); |
524 | int j = kap.mAlarmTimeEdit->value()* -60; | 522 | int j = kap.mAlarmTimeEdit->value()* -60; |
525 | if (kap.mAlarmIncrCombo->currentItem() == 1) | 523 | if (kap.mAlarmIncrCombo->currentItem() == 1) |
526 | j = j * 60; | 524 | j = j * 60; |
527 | else if (kap.mAlarmIncrCombo->currentItem() == 2) | 525 | else if (kap.mAlarmIncrCombo->currentItem() == 2) |
528 | j = j * (60 * 24); | 526 | j = j * (60 * 24); |
529 | alarm->setStartOffset( j ); | 527 | alarm->setStartOffset( j ); |
530 | 528 | ||
531 | if (!kap.mAlarmProgram.isEmpty() && kap.mAlarmProgramButton->isOn()) { | 529 | if (!kap.mAlarmProgram.isEmpty() && kap.mAlarmProgramButton->isOn()) { |
532 | alarm->setProcedureAlarm(kap.mAlarmProgram); | 530 | alarm->setProcedureAlarm(kap.mAlarmProgram); |
533 | } | 531 | } |
534 | else if (!kap.mAlarmSound.isEmpty() && kap.mAlarmSoundButton->isOn()) | 532 | else if (!kap.mAlarmSound.isEmpty() && kap.mAlarmSoundButton->isOn()) |
535 | alarm->setAudioAlarm(kap.mAlarmSound); | 533 | alarm->setAudioAlarm(kap.mAlarmSound); |
536 | else | 534 | else |
537 | alarm->setType(Alarm::Invalid); | 535 | alarm->setType(Alarm::Invalid); |
538 | //alarm->setAudioAlarm("default"); | ||
539 | // TODO: Deal with multiple alarms | ||
540 | break; // For now, stop after the first alarm | ||
541 | } | ||
542 | } else { | 536 | } else { |
543 | Alarm* alarm = inc->alarms().first(); | 537 | QPtrList<Alarm> alarms = inc->alarms(); |
544 | if ( alarm ) { | 538 | Alarm *alarm; |
539 | for (alarm = alarms.first(); alarm; alarm = alarms.next() ) { | ||
545 | alarm->setEnabled(false); | 540 | alarm->setEnabled(false); |
546 | alarm->setType(Alarm::Invalid); | 541 | alarm->setType(Alarm::Invalid); |
547 | } | 542 | } |
548 | } | 543 | } |
549 | KOListViewItem* item = getItemForEvent(inc); | 544 | KOListViewItem* item = getItemForEvent(inc); |
550 | if (item) { | 545 | if (item) { |
551 | ListItemVisitor v(item, mStartDate ); | 546 | ListItemVisitor v(item, mStartDate ); |
552 | inc->accept(v); | 547 | inc->accept(v); |
553 | } | 548 | } |
554 | inc = delSel.next(); | 549 | inc = delSel.next(); |
555 | } | 550 | } |
556 | topLevelWidget()->setCaption( i18n("Changed alarm for %1 items").arg( count ) ); | 551 | topLevelWidget()->setCaption( i18n("Changed alarm for %1 items").arg( count ) ); |
557 | qDebug("KO: Set alarm for %d items", count); | 552 | qDebug("KO: Set alarm for %d items", count); |
558 | calendar()->reInitAlarmSettings(); | 553 | calendar()->reInitAlarmSettings(); |
559 | QTimer::singleShot( 1, this, SLOT ( resetFocus() ) ); | 554 | QTimer::singleShot( 1, this, SLOT ( resetFocus() ) ); |
560 | } | 555 | } |
561 | void KOListView::setCategories( bool removeOld ) | 556 | void KOListView::setCategories( bool removeOld ) |
562 | { | 557 | { |
563 | 558 | ||
564 | KPIM::CategorySelectDialog* csd = new KPIM::CategorySelectDialog( KOPrefs::instance(), 0 ); | 559 | KPIM::CategorySelectDialog* csd = new KPIM::CategorySelectDialog( KOPrefs::instance(), 0 ); |
565 | csd->setColorEnabled(); | 560 | csd->setColorEnabled(); |
566 | if (! csd->exec()) { | 561 | if (! csd->exec()) { |
567 | delete csd; | 562 | delete csd; |
568 | return; | 563 | return; |
569 | } | 564 | } |
570 | QStringList catList = csd->selectedCategories(); | 565 | QStringList catList = csd->selectedCategories(); |
571 | delete csd; | 566 | delete csd; |
572 | QPtrList<Incidence> delSel = getSelectedIncidences(); // all inc allowed; | 567 | QPtrList<Incidence> delSel = getSelectedIncidences(); // all inc allowed; |
573 | Incidence* inc = delSel.first(); | 568 | Incidence* inc = delSel.first(); |
574 | while ( inc ) { | 569 | while ( inc ) { |
575 | if ( removeOld ) { | 570 | if ( removeOld ) { |
576 | inc->setCategories( catList, false ); | 571 | inc->setCategories( catList, false ); |
577 | } else { | 572 | } else { |
578 | inc->addCategories( catList, false ); | 573 | inc->addCategories( catList, false ); |
579 | } | 574 | } |
580 | KOListViewItem* item = getItemForEvent(inc); | 575 | KOListViewItem* item = getItemForEvent(inc); |
581 | if (item) { | 576 | if (item) { |
582 | ListItemVisitor v(item, mStartDate ); | 577 | ListItemVisitor v(item, mStartDate ); |
583 | inc->accept(v); | 578 | inc->accept(v); |
584 | } | 579 | } |
585 | inc = delSel.next(); | 580 | inc = delSel.next(); |
586 | } | 581 | } |
587 | QTimer::singleShot( 1, this, SLOT ( resetFocus() ) ); | 582 | QTimer::singleShot( 1, this, SLOT ( resetFocus() ) ); |
588 | } | 583 | } |
589 | 584 | ||
590 | void KOListView::beamSelected() | 585 | void KOListView::beamSelected() |
591 | { | 586 | { |
592 | QPtrList<Incidence> delSel = getSelectedIncidences() ; | 587 | QPtrList<Incidence> delSel = getSelectedIncidences() ; |