-rw-r--r-- | libkcal/calendarlocal.cpp | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/libkcal/calendarlocal.cpp b/libkcal/calendarlocal.cpp index 418bfca..ca64e66 100644 --- a/libkcal/calendarlocal.cpp +++ b/libkcal/calendarlocal.cpp | |||
@@ -763,57 +763,59 @@ QPtrList<Event> CalendarLocal::rawEvents( const QDate &start, const QDate &end, | |||
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 | mJournalList.append(journal); |
780 | kdDebug(5800) << "Adding Journal on " << journal->dtStart().toString() << endl; | ||
781 | else | ||
782 | kdDebug(5800) << "Adding Journal without a DTSTART" << endl; | ||
783 | |||
784 | mJournalList.append(journal); | ||
785 | 780 | ||
786 | journal->registerObserver( this ); | 781 | journal->registerObserver( this ); |
787 | 782 | ||
788 | setModified( true ); | 783 | setModified( true ); |
789 | journal->setCalID( mDefaultCalendar ); | 784 | journal->setCalID( mDefaultCalendar ); |
790 | journal->setCalEnabled( true ); | 785 | journal->setCalEnabled( true ); |
791 | return true; | 786 | return true; |
792 | } | 787 | } |
793 | 788 | ||
794 | void CalendarLocal::deleteJournal( Journal *journal ) | 789 | void CalendarLocal::deleteJournal( Journal *journal ) |
795 | { | 790 | { |
796 | if ( mUndoIncidence ) delete mUndoIncidence; | 791 | if ( mUndoIncidence ) delete mUndoIncidence; |
797 | mUndoIncidence = journal->clone(); | 792 | mUndoIncidence = journal->clone(); |
798 | mUndoIncidence->setSummary( mUndoIncidence->description().left(25)); | 793 | mUndoIncidence->setSummary( mUndoIncidence->description().left(25)); |
799 | if ( mJournalList.removeRef(journal) ) { | 794 | if ( mJournalList.removeRef(journal) ) { |
800 | setModified( true ); | 795 | setModified( true ); |
801 | } | 796 | } |
802 | } | 797 | } |
803 | 798 | ||
799 | QPtrList<Journal> CalendarLocal::journals4Date( const QDate & date ) | ||
800 | { | ||
801 | QPtrList<Journal> el; | ||
802 | for ( Journal *it = mJournalList.first(); it; it = mJournalList.next() ) | ||
803 | if ( it->calEnabled() && it->dtStart().date() == date) el.append( it ); | ||
804 | return el; | ||
805 | } | ||
804 | Journal *CalendarLocal::journal( const QDate &date ) | 806 | Journal *CalendarLocal::journal( const QDate &date ) |
805 | { | 807 | { |
806 | // kdDebug(5800) << "CalendarLocal::journal() " << date.toString() << endl; | 808 | // kdDebug(5800) << "CalendarLocal::journal() " << date.toString() << endl; |
807 | 809 | ||
808 | for ( Journal *it = mJournalList.first(); it; it = mJournalList.next() ) | 810 | for ( Journal *it = mJournalList.first(); it; it = mJournalList.next() ) |
809 | if ( it->calEnabled() && it->dtStart().date() == date ) | 811 | if ( it->calEnabled() && it->dtStart().date() == date ) |
810 | return it; | 812 | return it; |
811 | 813 | ||
812 | return 0; | 814 | return 0; |
813 | } | 815 | } |
814 | 816 | ||
815 | Journal *CalendarLocal::journal( const QString &uid ) | 817 | Journal *CalendarLocal::journal( const QString &uid ) |
816 | { | 818 | { |
817 | Journal * retVal = 0; | 819 | Journal * retVal = 0; |
818 | for ( Journal *it = mJournalList.first(); it; it = mJournalList.next() ) | 820 | for ( Journal *it = mJournalList.first(); it; it = mJournalList.next() ) |
819 | if ( it->calEnabled() && it->uid() == uid ) { | 821 | if ( it->calEnabled() && it->uid() == uid ) { |