-rw-r--r-- | libkcal/calendarlocal.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/libkcal/calendarlocal.cpp b/libkcal/calendarlocal.cpp index 18f1af8..418bfca 100644 --- a/libkcal/calendarlocal.cpp +++ b/libkcal/calendarlocal.cpp | |||
@@ -706,97 +706,97 @@ QPtrList<Event> CalendarLocal::rawEvents( const QDate &start, const QDate &end, | |||
706 | found = true; | 706 | found = true; |
707 | } | 707 | } |
708 | } else if ( event->recurrence()->duration() > 0 ) { // Duration set | 708 | } else if ( event->recurrence()->duration() > 0 ) { // Duration set |
709 | // TODO: Calculate end date from duration. Should be done in Event | 709 | // TODO: Calculate end date from duration. Should be done in Event |
710 | // For now exclude all events with a duration. | 710 | // For now exclude all events with a duration. |
711 | } | 711 | } |
712 | } | 712 | } |
713 | } else { | 713 | } else { |
714 | bool founOne; | 714 | bool founOne; |
715 | QDate next = event->getNextOccurence( start, &founOne ).date(); | 715 | QDate next = event->getNextOccurence( start, &founOne ).date(); |
716 | if ( founOne ) { | 716 | if ( founOne ) { |
717 | if ( next <= end ) { | 717 | if ( next <= end ) { |
718 | found = true; | 718 | found = true; |
719 | } | 719 | } |
720 | } | 720 | } |
721 | 721 | ||
722 | /* | 722 | /* |
723 | // crap !!! | 723 | // crap !!! |
724 | if ( rStart <= end ) { // Start date not after range | 724 | if ( rStart <= end ) { // Start date not after range |
725 | if ( rStart >= start ) { // Start date within range | 725 | if ( rStart >= start ) { // Start date within range |
726 | found = true; | 726 | found = true; |
727 | } else if ( event->recurrence()->duration() == -1 ) { // Recurs forever | 727 | } else if ( event->recurrence()->duration() == -1 ) { // Recurs forever |
728 | found = true; | 728 | found = true; |
729 | } else if ( event->recurrence()->duration() == 0 ) { // End date set | 729 | } else if ( event->recurrence()->duration() == 0 ) { // End date set |
730 | QDate rEnd = event->recurrence()->endDate(); | 730 | QDate rEnd = event->recurrence()->endDate(); |
731 | if ( rEnd >= start && rEnd <= end ) { // End date within range | 731 | if ( rEnd >= start && rEnd <= end ) { // End date within range |
732 | found = true; | 732 | found = true; |
733 | } | 733 | } |
734 | } else { // Duration set | 734 | } else { // Duration set |
735 | // TODO: Calculate end date from duration. Should be done in Event | 735 | // TODO: Calculate end date from duration. Should be done in Event |
736 | // For now include all events with a duration. | 736 | // For now include all events with a duration. |
737 | found = true; | 737 | found = true; |
738 | } | 738 | } |
739 | } | 739 | } |
740 | */ | 740 | */ |
741 | 741 | ||
742 | } | 742 | } |
743 | 743 | ||
744 | if ( found ) eventList.append( event ); | 744 | if ( found ) eventList.append( event ); |
745 | } else { | 745 | } else { |
746 | QDate s = event->dtStart().date(); | 746 | QDate s = event->dtStart().date(); |
747 | QDate e = event->dtEnd().date(); | 747 | QDate e = event->dtEnd().date(); |
748 | 748 | ||
749 | if ( inclusive ) { | 749 | if ( inclusive ) { |
750 | if ( s >= start && e <= end ) { | 750 | if ( s >= start && e <= end ) { |
751 | eventList.append( event ); | 751 | eventList.append( event ); |
752 | } | 752 | } |
753 | } else { | 753 | } else { |
754 | if ( ( s >= start && s <= end ) || ( e >= start && e <= end ) ) { | 754 | if ( ( e >= start && s <= end ) ) { |
755 | eventList.append( event ); | 755 | eventList.append( event ); |
756 | } | 756 | } |
757 | } | 757 | } |
758 | } | 758 | } |
759 | } | 759 | } |
760 | 760 | ||
761 | return eventList; | 761 | return eventList; |
762 | } | 762 | } |
763 | 763 | ||
764 | QPtrList<Event> CalendarLocal::rawEventsForDate( const QDateTime &qdt ) | 764 | QPtrList<Event> CalendarLocal::rawEventsForDate( const QDateTime &qdt ) |
765 | { | 765 | { |
766 | return rawEventsForDate( qdt.date() ); | 766 | return rawEventsForDate( qdt.date() ); |
767 | } | 767 | } |
768 | 768 | ||
769 | QPtrList<Event> CalendarLocal::rawEvents() | 769 | QPtrList<Event> CalendarLocal::rawEvents() |
770 | { | 770 | { |
771 | QPtrList<Event> el; | 771 | QPtrList<Event> el; |
772 | for ( Event *it = mEventList.first(); it; it = mEventList.next() ) | 772 | for ( Event *it = mEventList.first(); it; it = mEventList.next() ) |
773 | if ( it->calEnabled() ) el.append( it ); | 773 | if ( it->calEnabled() ) el.append( it ); |
774 | return el; | 774 | return el; |
775 | } | 775 | } |
776 | 776 | ||
777 | bool CalendarLocal::addJournal(Journal *journal) | 777 | bool CalendarLocal::addJournal(Journal *journal) |
778 | { | 778 | { |
779 | if ( journal->dtStart().isValid()) | 779 | if ( journal->dtStart().isValid()) |
780 | kdDebug(5800) << "Adding Journal on " << journal->dtStart().toString() << endl; | 780 | kdDebug(5800) << "Adding Journal on " << journal->dtStart().toString() << endl; |
781 | else | 781 | else |
782 | kdDebug(5800) << "Adding Journal without a DTSTART" << endl; | 782 | kdDebug(5800) << "Adding Journal without a DTSTART" << endl; |
783 | 783 | ||
784 | mJournalList.append(journal); | 784 | mJournalList.append(journal); |
785 | 785 | ||
786 | journal->registerObserver( this ); | 786 | journal->registerObserver( this ); |
787 | 787 | ||
788 | setModified( true ); | 788 | setModified( true ); |
789 | journal->setCalID( mDefaultCalendar ); | 789 | journal->setCalID( mDefaultCalendar ); |
790 | journal->setCalEnabled( true ); | 790 | journal->setCalEnabled( true ); |
791 | return true; | 791 | return true; |
792 | } | 792 | } |
793 | 793 | ||
794 | void CalendarLocal::deleteJournal( Journal *journal ) | 794 | void CalendarLocal::deleteJournal( Journal *journal ) |
795 | { | 795 | { |
796 | if ( mUndoIncidence ) delete mUndoIncidence; | 796 | if ( mUndoIncidence ) delete mUndoIncidence; |
797 | mUndoIncidence = journal->clone(); | 797 | mUndoIncidence = journal->clone(); |
798 | mUndoIncidence->setSummary( mUndoIncidence->description().left(25)); | 798 | mUndoIncidence->setSummary( mUndoIncidence->description().left(25)); |
799 | if ( mJournalList.removeRef(journal) ) { | 799 | if ( mJournalList.removeRef(journal) ) { |
800 | setModified( true ); | 800 | setModified( true ); |
801 | } | 801 | } |
802 | } | 802 | } |