-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 @@ -473,23 +473,6 @@ void KOListView::setAlarm() return; - QPtrList<KOListViewItem> sel ; - QListViewItem *qitem = mListView->firstChild (); - while ( qitem ) { - if ( qitem->isSelected() ) { - Incidence* inc = ((KOListViewItem *) qitem)->data(); - if ( inc->typeID() != journalID ) { - if ( inc->typeID() == todoID ) { - if ( ((Todo*)inc)->hasDueDate() ) - sel.append(((KOListViewItem *)qitem)); - } else - sel.append(((KOListViewItem *)qitem)); - } - } - qitem = qitem->nextSibling(); - } + QPtrList<Incidence> delSel = getSelectedIncidences( true, true, false, true ); // no journals, only due todos + Incidence* inc = delSel.first(); int count = 0; - KOListViewItem * item, *temp; - item = sel.first(); - Incidence* inc; - while ( item ) { - inc = item->data(); + while ( inc ) { ++count; @@ -527,5 +510,8 @@ void KOListView::setAlarm() } + KOListViewItem* item = getItemForEvent(inc); + if (item) { ListItemVisitor v(item, mStartDate ); inc->accept(v); - item = sel.next(); + } + inc = delSel.next(); } @@ -701,3 +687,15 @@ QPtrList<Incidence> KOListView::getSelectedIncidences( bool includeEvents, bool if ( addSubTodos ) { - inc->addRelationsToList( &delSel ); + QPtrList<Incidence> tempSel ; + inc->addRelationsToList( &tempSel ); + Incidence* tempinc = tempSel.first(); + while ( tempinc ) { + if ( delSel.findRef( tempinc ) == -1 ) { + if ( tempinc->typeID() == todoID && onlyDueTodos ) { + if ( ((Todo*)tempinc)->hasDueDate() ) + delSel.append( tempinc ); + } else + delSel.append( tempinc ); + } + tempinc = tempSel.next(); + } } |