author | zautrix <zautrix> | 2005-06-29 10:36:31 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2005-06-29 10:36:31 (UTC) |
commit | b7044dfc9516d546683973985555c481d59fc677 (patch) (unidiff) | |
tree | b521090cfc8eb6c8c6a6f6f8167c83058ea1361b /libkcal | |
parent | f226b4cd2ce06a6948811fe04d80fe3ffa44f695 (diff) | |
download | kdepimpi-b7044dfc9516d546683973985555c481d59fc677.zip kdepimpi-b7044dfc9516d546683973985555c481d59fc677.tar.gz kdepimpi-b7044dfc9516d546683973985555c481d59fc677.tar.bz2 |
journal fixxx
-rw-r--r-- | libkcal/calendar.h | 1 | ||||
-rw-r--r-- | libkcal/calendarlocal.cpp | 14 | ||||
-rw-r--r-- | libkcal/calendarlocal.h | 1 |
3 files changed, 10 insertions, 6 deletions
diff --git a/libkcal/calendar.h b/libkcal/calendar.h index 2efa355..4652fe5 100644 --- a/libkcal/calendar.h +++ b/libkcal/calendar.h | |||
@@ -230,32 +230,33 @@ public: | |||
230 | virtual QPtrList<Todo> todos( const QDate &date ) = 0; | 230 | virtual QPtrList<Todo> todos( const QDate &date ) = 0; |
231 | /** | 231 | /** |
232 | Return unfiltered list of todos. | 232 | Return unfiltered list of todos. |
233 | */ | 233 | */ |
234 | virtual QPtrList<Todo> rawTodos() = 0; | 234 | virtual QPtrList<Todo> rawTodos() = 0; |
235 | 235 | ||
236 | /** | 236 | /** |
237 | Add a Journal entry to calendar. | 237 | Add a Journal entry to calendar. |
238 | 238 | ||
239 | @return true on success, false on error. | 239 | @return true on success, false on error. |
240 | */ | 240 | */ |
241 | virtual bool addJournal( Journal * ) = 0; | 241 | virtual bool addJournal( Journal * ) = 0; |
242 | /** | 242 | /** |
243 | Return Journal for given date. | 243 | Return Journal for given date. |
244 | */ | 244 | */ |
245 | virtual Journal *journal( const QDate & ) = 0; | 245 | virtual Journal *journal( const QDate & ) = 0; |
246 | virtual QPtrList<Journal> journals4Date( const QDate & ) = 0; | ||
246 | /** | 247 | /** |
247 | Return Journal with given UID. | 248 | Return Journal with given UID. |
248 | */ | 249 | */ |
249 | virtual Journal *journal( const QString &UID ) = 0; | 250 | virtual Journal *journal( const QString &UID ) = 0; |
250 | /** | 251 | /** |
251 | Return list of all Journal entries. | 252 | Return list of all Journal entries. |
252 | */ | 253 | */ |
253 | virtual QPtrList<Journal> journals() = 0; | 254 | virtual QPtrList<Journal> journals() = 0; |
254 | 255 | ||
255 | /** | 256 | /** |
256 | Searches all incidence types for an incidence with this unique | 257 | Searches all incidence types for an incidence with this unique |
257 | string identifier, returns a pointer or null. | 258 | string identifier, returns a pointer or null. |
258 | */ | 259 | */ |
259 | Incidence* incidence( const QString&UID ); | 260 | Incidence* incidence( const QString&UID ); |
260 | 261 | ||
261 | /** | 262 | /** |
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 ) { |
diff --git a/libkcal/calendarlocal.h b/libkcal/calendarlocal.h index d32597f..98d16a3 100644 --- a/libkcal/calendarlocal.h +++ b/libkcal/calendarlocal.h | |||
@@ -118,32 +118,33 @@ class CalendarLocal : public Calendar | |||
118 | Workaround because compiler does not recognize function of base class. | 118 | Workaround because compiler does not recognize function of base class. |
119 | */ | 119 | */ |
120 | QPtrList<Todo> todos() { return Calendar::todos(); } | 120 | QPtrList<Todo> todos() { return Calendar::todos(); } |
121 | 121 | ||
122 | /** | 122 | /** |
123 | Add a Journal entry to calendar. | 123 | Add a Journal entry to calendar. |
124 | */ | 124 | */ |
125 | bool addJournal( Journal * ); | 125 | bool addJournal( Journal * ); |
126 | /** | 126 | /** |
127 | Remove a Journal from the calendar. | 127 | Remove a Journal from the calendar. |
128 | */ | 128 | */ |
129 | void deleteJournal( Journal * ); | 129 | void deleteJournal( Journal * ); |
130 | /** | 130 | /** |
131 | Return Journal for given date. | 131 | Return Journal for given date. |
132 | */ | 132 | */ |
133 | Journal *journal( const QDate & ); | 133 | Journal *journal( const QDate & ); |
134 | QPtrList<Journal> journals4Date( const QDate & ); | ||
134 | /** | 135 | /** |
135 | Return Journal with given UID. | 136 | Return Journal with given UID. |
136 | */ | 137 | */ |
137 | Journal *journal( const QString &uid ); | 138 | Journal *journal( const QString &uid ); |
138 | /** | 139 | /** |
139 | Return list of all Journals stored in calendar. | 140 | Return list of all Journals stored in calendar. |
140 | */ | 141 | */ |
141 | QPtrList<Journal> journals(); | 142 | QPtrList<Journal> journals(); |
142 | 143 | ||
143 | /** | 144 | /** |
144 | Return all alarms, which ocur in the given time interval. | 145 | Return all alarms, which ocur in the given time interval. |
145 | */ | 146 | */ |
146 | Alarm::List alarms( const QDateTime &from, const QDateTime &to ); | 147 | Alarm::List alarms( const QDateTime &from, const QDateTime &to ); |
147 | 148 | ||
148 | /** | 149 | /** |
149 | Return all alarms, which ocur before given date. | 150 | Return all alarms, which ocur before given date. |