summaryrefslogtreecommitdiffabout
path: root/libkcal/calendarlocal.cpp
Unidiff
Diffstat (limited to 'libkcal/calendarlocal.cpp') (more/less context) (show whitespace changes)
-rw-r--r--libkcal/calendarlocal.cpp1
1 files changed, 1 insertions, 0 deletions
diff --git a/libkcal/calendarlocal.cpp b/libkcal/calendarlocal.cpp
index 0eba6a9..e75154b 100644
--- a/libkcal/calendarlocal.cpp
+++ b/libkcal/calendarlocal.cpp
@@ -566,48 +566,49 @@ QPtrList<Event> CalendarLocal::rawEventsForDate( const QDate &qd, bool 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
587QPtrList<Event> CalendarLocal::rawEvents( const QDate &start, const QDate &end, 587QPtrList<Event> CalendarLocal::rawEvents( const QDate &start, const QDate &end,
588 bool inclusive ) 588 bool inclusive )
589{ 589{
590 qDebug("CalendarLocal::rawEvents called ");
590 Event *event = 0; 591 Event *event = 0;
591 592
592 QPtrList<Event> eventList; 593 QPtrList<Event> eventList;
593 594
594 // Get non-recurring events 595 // Get non-recurring events
595 for( event = mEventList.first(); event; event = mEventList.next() ) { 596 for( event = mEventList.first(); event; event = mEventList.next() ) {
596 if ( event->doesRecur() ) { 597 if ( event->doesRecur() ) {
597 QDate rStart = event->dtStart().date(); 598 QDate rStart = event->dtStart().date();
598 bool found = false; 599 bool found = false;
599 if ( inclusive ) { 600 if ( inclusive ) {
600 if ( rStart >= start && rStart <= end ) { 601 if ( rStart >= start && rStart <= end ) {
601 // Start date of event is in range. Now check for end date. 602 // Start date of event is in range. Now check for end date.
602 // if duration is negative, event recurs forever, so do not include it. 603 // if duration is negative, event recurs forever, so do not include it.
603 if ( event->recurrence()->duration() == 0 ) { // End date set 604 if ( event->recurrence()->duration() == 0 ) { // End date set
604 QDate rEnd = event->recurrence()->endDate(); 605 QDate rEnd = event->recurrence()->endDate();
605 if ( rEnd >= start && rEnd <= end ) { // End date within range 606 if ( rEnd >= start && rEnd <= end ) { // End date within range
606 found = true; 607 found = true;
607 } 608 }
608 } else if ( event->recurrence()->duration() > 0 ) { // Duration set 609 } else if ( event->recurrence()->duration() > 0 ) { // Duration set
609 // TODO: Calculate end date from duration. Should be done in Event 610 // TODO: Calculate end date from duration. Should be done in Event
610 // For now exclude all events with a duration. 611 // For now exclude all events with a duration.
611 } 612 }
612 } 613 }
613 } else { 614 } else {