author | zautrix <zautrix> | 2005-07-01 20:58:33 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2005-07-01 20:58:33 (UTC) |
commit | 5c03b6da2ff31c72d8c8b37d3e94f666a22081d0 (patch) (unidiff) | |
tree | fb0197957a16aed93322ba61f7c6db2edd453011 /korganizer/kolistview.cpp | |
parent | 541878bcf52030d8597d5e79afb6ae1185b2ac2c (diff) | |
download | kdepimpi-5c03b6da2ff31c72d8c8b37d3e94f666a22081d0.zip kdepimpi-5c03b6da2ff31c72d8c8b37d3e94f666a22081d0.tar.gz kdepimpi-5c03b6da2ff31c72d8c8b37d3e94f666a22081d0.tar.bz2 |
more fixes
-rw-r--r-- | korganizer/kolistview.cpp | 42 |
1 files changed, 20 insertions, 22 deletions
diff --git a/korganizer/kolistview.cpp b/korganizer/kolistview.cpp index 4c815d8..1b4397f 100644 --- a/korganizer/kolistview.cpp +++ b/korganizer/kolistview.cpp | |||
@@ -466,37 +466,20 @@ void KOListView::setCat() | |||
466 | setCategories( set ); | 466 | setCategories( set ); |
467 | } | 467 | } |
468 | 468 | ||
469 | void KOListView::setAlarm() | 469 | void KOListView::setAlarm() |
470 | { | 470 | { |
471 | KOAlarmPrefs kap( this); | 471 | KOAlarmPrefs kap( this); |
472 | if ( !kap.exec() ) | 472 | if ( !kap.exec() ) |
473 | return; | 473 | return; |
474 | QPtrList<KOListViewItem> sel ; | 474 | QPtrList<Incidence> delSel = getSelectedIncidences( true, true, false, true ); // no journals, only due todos |
475 | QListViewItem *qitem = mListView->firstChild (); | 475 | Incidence* inc = delSel.first(); |
476 | while ( qitem ) { | ||
477 | if ( qitem->isSelected() ) { | ||
478 | Incidence* inc = ((KOListViewItem *) qitem)->data(); | ||
479 | if ( inc->typeID() != journalID ) { | ||
480 | if ( inc->typeID() == todoID ) { | ||
481 | if ( ((Todo*)inc)->hasDueDate() ) | ||
482 | sel.append(((KOListViewItem *)qitem)); | ||
483 | } else | ||
484 | sel.append(((KOListViewItem *)qitem)); | ||
485 | } | ||
486 | } | ||
487 | qitem = qitem->nextSibling(); | ||
488 | } | ||
489 | int count = 0; | 476 | int count = 0; |
490 | KOListViewItem * item, *temp; | 477 | while ( inc ) { |
491 | item = sel.first(); | ||
492 | Incidence* inc; | ||
493 | while ( item ) { | ||
494 | inc = item->data(); | ||
495 | ++count; | 478 | ++count; |
496 | if (kap.mAlarmButton->isChecked()) { | 479 | if (kap.mAlarmButton->isChecked()) { |
497 | if (inc->alarms().count() == 0) | 480 | if (inc->alarms().count() == 0) |
498 | inc->newAlarm(); | 481 | inc->newAlarm(); |
499 | QPtrList<Alarm> alarms = inc->alarms(); | 482 | QPtrList<Alarm> alarms = inc->alarms(); |
500 | Alarm *alarm; | 483 | Alarm *alarm; |
501 | for (alarm = alarms.first(); alarm; alarm = alarms.next() ) { | 484 | for (alarm = alarms.first(); alarm; alarm = alarms.next() ) { |
502 | alarm->setEnabled(true); | 485 | alarm->setEnabled(true); |
@@ -520,19 +503,22 @@ void KOListView::setAlarm() | |||
520 | } | 503 | } |
521 | } else { | 504 | } else { |
522 | Alarm* alarm = inc->alarms().first(); | 505 | Alarm* alarm = inc->alarms().first(); |
523 | if ( alarm ) { | 506 | if ( alarm ) { |
524 | alarm->setEnabled(false); | 507 | alarm->setEnabled(false); |
525 | alarm->setType(Alarm::Invalid); | 508 | alarm->setType(Alarm::Invalid); |
526 | } | 509 | } |
527 | } | 510 | } |
511 | KOListViewItem* item = getItemForEvent(inc); | ||
512 | if (item) { | ||
528 | ListItemVisitor v(item, mStartDate ); | 513 | ListItemVisitor v(item, mStartDate ); |
529 | inc->accept(v); | 514 | inc->accept(v); |
530 | item = sel.next(); | 515 | } |
516 | inc = delSel.next(); | ||
531 | } | 517 | } |
532 | topLevelWidget()->setCaption( i18n("Changed alarm for %1 items").arg( count ) ); | 518 | topLevelWidget()->setCaption( i18n("Changed alarm for %1 items").arg( count ) ); |
533 | qDebug("KO: Set alarm for %d items", count); | 519 | qDebug("KO: Set alarm for %d items", count); |
534 | calendar()->reInitAlarmSettings(); | 520 | calendar()->reInitAlarmSettings(); |
535 | QTimer::singleShot( 1, this, SLOT ( resetFocus() ) ); | 521 | QTimer::singleShot( 1, this, SLOT ( resetFocus() ) ); |
536 | } | 522 | } |
537 | void KOListView::setCategories( bool removeOld ) | 523 | void KOListView::setCategories( bool removeOld ) |
538 | { | 524 | { |
@@ -694,17 +680,29 @@ QPtrList<Incidence> KOListView::getSelectedIncidences( bool includeEvents, bool | |||
694 | delSel.clear(); | 680 | delSel.clear(); |
695 | return delSel; | 681 | return delSel; |
696 | } | 682 | } |
697 | if (result == KMessageBox::Yes) | 683 | if (result == KMessageBox::Yes) |
698 | addSubTodos = true; | 684 | addSubTodos = true; |
699 | askSubTodos = false; | 685 | askSubTodos = false; |
700 | } | 686 | } |
701 | if ( addSubTodos ) { | 687 | if ( addSubTodos ) { |
702 | inc->addRelationsToList( &delSel ); | 688 | QPtrList<Incidence> tempSel ; |
689 | inc->addRelationsToList( &tempSel ); | ||
690 | Incidence* tempinc = tempSel.first(); | ||
691 | while ( tempinc ) { | ||
692 | if ( delSel.findRef( tempinc ) == -1 ) { | ||
693 | if ( tempinc->typeID() == todoID && onlyDueTodos ) { | ||
694 | if ( ((Todo*)tempinc)->hasDueDate() ) | ||
695 | delSel.append( tempinc ); | ||
696 | } else | ||
697 | delSel.append( tempinc ); | ||
698 | } | ||
699 | tempinc = tempSel.next(); | ||
700 | } | ||
703 | } | 701 | } |
704 | } | 702 | } |
705 | } | 703 | } |
706 | } | 704 | } |
707 | item = item->nextSibling(); | 705 | item = item->nextSibling(); |
708 | } | 706 | } |
709 | return delSel; | 707 | return delSel; |
710 | } | 708 | } |