-rw-r--r-- | libkcal/calendarlocal.cpp | 1 |
1 files changed, 0 insertions, 1 deletions
diff --git a/libkcal/calendarlocal.cpp b/libkcal/calendarlocal.cpp index e75154b..0eba6a9 100644 --- a/libkcal/calendarlocal.cpp +++ b/libkcal/calendarlocal.cpp | |||
@@ -558,65 +558,64 @@ QPtrList<Event> CalendarLocal::rawEventsForDate( const QDate &qd, bool sorted ) | |||
558 | } else { | 558 | } else { |
559 | if ( event->dtStart().date() <= qd && event->dtEnd().date() >= qd ) { | 559 | if ( event->dtStart().date() <= qd && event->dtEnd().date() >= qd ) { |
560 | eventList.append( event ); | 560 | eventList.append( event ); |
561 | } | 561 | } |
562 | } | 562 | } |
563 | } | 563 | } |
564 | 564 | ||
565 | if ( !sorted ) { | 565 | if ( !sorted ) { |
566 | return eventList; | 566 | return eventList; |
567 | } | 567 | } |
568 | 568 | ||
569 | // kdDebug(5800) << "Sorting events for date\n" << endl; | 569 | // kdDebug(5800) << "Sorting events for date\n" << endl; |
570 | // now, we have to sort it based on dtStart.time() | 570 | // now, we have to sort it based on dtStart.time() |
571 | QPtrList<Event> eventListSorted; | 571 | QPtrList<Event> eventListSorted; |
572 | Event *sortEvent; | 572 | Event *sortEvent; |
573 | for ( event = eventList.first(); event; event = eventList.next() ) { | 573 | for ( event = eventList.first(); event; event = eventList.next() ) { |
574 | sortEvent = eventListSorted.first(); | 574 | sortEvent = eventListSorted.first(); |
575 | int i = 0; | 575 | int i = 0; |
576 | while ( sortEvent && event->dtStart().time()>=sortEvent->dtStart().time() ) | 576 | while ( sortEvent && event->dtStart().time()>=sortEvent->dtStart().time() ) |
577 | { | 577 | { |
578 | i++; | 578 | i++; |
579 | sortEvent = eventListSorted.next(); | 579 | sortEvent = eventListSorted.next(); |
580 | } | 580 | } |
581 | eventListSorted.insert( i, event ); | 581 | eventListSorted.insert( i, event ); |
582 | } | 582 | } |
583 | return eventListSorted; | 583 | return eventListSorted; |
584 | } | 584 | } |
585 | 585 | ||
586 | 586 | ||
587 | QPtrList<Event> CalendarLocal::rawEvents( const QDate &start, const QDate &end, | 587 | QPtrList<Event> CalendarLocal::rawEvents( const QDate &start, const QDate &end, |
588 | bool inclusive ) | 588 | bool inclusive ) |
589 | { | 589 | { |
590 | qDebug("CalendarLocal::rawEvents called "); | ||
591 | Event *event = 0; | 590 | Event *event = 0; |
592 | 591 | ||
593 | QPtrList<Event> eventList; | 592 | QPtrList<Event> eventList; |
594 | 593 | ||
595 | // Get non-recurring events | 594 | // Get non-recurring events |
596 | for( event = mEventList.first(); event; event = mEventList.next() ) { | 595 | for( event = mEventList.first(); event; event = mEventList.next() ) { |
597 | if ( event->doesRecur() ) { | 596 | if ( event->doesRecur() ) { |
598 | QDate rStart = event->dtStart().date(); | 597 | QDate rStart = event->dtStart().date(); |
599 | bool found = false; | 598 | bool found = false; |
600 | if ( inclusive ) { | 599 | if ( inclusive ) { |
601 | if ( rStart >= start && rStart <= end ) { | 600 | if ( rStart >= start && rStart <= end ) { |
602 | // Start date of event is in range. Now check for end date. | 601 | // Start date of event is in range. Now check for end date. |
603 | // if duration is negative, event recurs forever, so do not include it. | 602 | // if duration is negative, event recurs forever, so do not include it. |
604 | if ( event->recurrence()->duration() == 0 ) { // End date set | 603 | if ( event->recurrence()->duration() == 0 ) { // End date set |
605 | QDate rEnd = event->recurrence()->endDate(); | 604 | QDate rEnd = event->recurrence()->endDate(); |
606 | if ( rEnd >= start && rEnd <= end ) { // End date within range | 605 | if ( rEnd >= start && rEnd <= end ) { // End date within range |
607 | found = true; | 606 | found = true; |
608 | } | 607 | } |
609 | } else if ( event->recurrence()->duration() > 0 ) { // Duration set | 608 | } else if ( event->recurrence()->duration() > 0 ) { // Duration set |
610 | // TODO: Calculate end date from duration. Should be done in Event | 609 | // TODO: Calculate end date from duration. Should be done in Event |
611 | // For now exclude all events with a duration. | 610 | // For now exclude all events with a duration. |
612 | } | 611 | } |
613 | } | 612 | } |
614 | } else { | 613 | } else { |
615 | bool founOne; | 614 | bool founOne; |
616 | QDate next = event->getNextOccurence( start, &founOne ).date(); | 615 | QDate next = event->getNextOccurence( start, &founOne ).date(); |
617 | if ( founOne ) { | 616 | if ( founOne ) { |
618 | if ( next <= end ) { | 617 | if ( next <= end ) { |
619 | found = true; | 618 | found = true; |
620 | } | 619 | } |
621 | } | 620 | } |
622 | 621 | ||