summaryrefslogtreecommitdiffabout
path: root/libkcal
Unidiff
Diffstat (limited to 'libkcal') (more/less context) (ignore whitespace changes)
-rw-r--r--libkcal/calendar.h1
-rw-r--r--libkcal/calendarlocal.cpp14
-rw-r--r--libkcal/calendarlocal.h1
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
@@ -198,96 +198,97 @@ public:
198 */ 198 */
199 virtual QPtrList<Event> events(); 199 virtual QPtrList<Event> events();
200 /** 200 /**
201 Return unfiltered list of all events in calendar. 201 Return unfiltered list of all events in calendar.
202 */ 202 */
203 virtual QPtrList<Event> rawEvents() = 0; 203 virtual QPtrList<Event> rawEvents() = 0;
204 204
205 /** 205 /**
206 Add a todo to the todolist. 206 Add a todo to the todolist.
207 207
208 @return true on success, false on error. 208 @return true on success, false on error.
209 */ 209 */
210 virtual bool addTodo( Todo *todo ) = 0; 210 virtual bool addTodo( Todo *todo ) = 0;
211 virtual bool addTodoNoDup( Todo *todo ) = 0; 211 virtual bool addTodoNoDup( Todo *todo ) = 0;
212 /** 212 /**
213 Remove a todo from the todolist. 213 Remove a todo from the todolist.
214 */ 214 */
215 virtual void deleteTodo( Todo * ) = 0; 215 virtual void deleteTodo( Todo * ) = 0;
216 virtual void deleteJournal( Journal * ) = 0; 216 virtual void deleteJournal( Journal * ) = 0;
217 /** 217 /**
218 Return filterd list of todos. 218 Return filterd list of todos.
219 */ 219 */
220 virtual QPtrList<Todo> todos(); 220 virtual QPtrList<Todo> todos();
221 /** 221 /**
222 Searches todolist for an event with this unique string identifier, 222 Searches todolist for an event with this unique string identifier,
223 returns a pointer or null. 223 returns a pointer or null.
224 */ 224 */
225 virtual Todo *todo( const QString &uid ) = 0; 225 virtual Todo *todo( const QString &uid ) = 0;
226 virtual Todo *todo( QString, QString ) = 0; 226 virtual Todo *todo( QString, QString ) = 0;
227 /** 227 /**
228 Returns list of todos due on the specified date. 228 Returns list of todos due on the specified date.
229 */ 229 */
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 /**
262 Setup relations for an incidence. 263 Setup relations for an incidence.
263 */ 264 */
264 virtual void setupRelations( Incidence * ); 265 virtual void setupRelations( Incidence * );
265 /** 266 /**
266 Remove all relations to an incidence 267 Remove all relations to an incidence
267 */ 268 */
268 virtual void removeRelations( Incidence * ); 269 virtual void removeRelations( Incidence * );
269 270
270 /** 271 /**
271 Set calendar filter, which filters events for the events() functions. 272 Set calendar filter, which filters events for the events() functions.
272 The Filter object is owned by the caller. 273 The Filter object is owned by the caller.
273 */ 274 */
274 void setFilter( CalFilter * ); 275 void setFilter( CalFilter * );
275 /** 276 /**
276 Return calendar filter. 277 Return calendar filter.
277 */ 278 */
278 CalFilter *filter(); 279 CalFilter *filter();
279 virtual QDateTime nextAlarm( int daysTo ) = 0; 280 virtual QDateTime nextAlarm( int daysTo ) = 0;
280 virtual QString nextSummary( ) const = 0; 281 virtual QString nextSummary( ) const = 0;
281 virtual void reInitAlarmSettings() = 0; 282 virtual void reInitAlarmSettings() = 0;
282 virtual QDateTime nextAlarmEventDateTime() const = 0; 283 virtual QDateTime nextAlarmEventDateTime() const = 0;
283 virtual void checkAlarmForIncidence( Incidence *, bool ) = 0; 284 virtual void checkAlarmForIncidence( Incidence *, bool ) = 0;
284 /** 285 /**
285 Return all alarms, which ocur in the given time interval. 286 Return all alarms, which ocur in the given time interval.
286 */ 287 */
287 virtual Alarm::List alarms( const QDateTime &from, 288 virtual Alarm::List alarms( const QDateTime &from,
288 const QDateTime &to ) = 0; 289 const QDateTime &to ) = 0;
289 290
290 class Observer { 291 class Observer {
291 public: 292 public:
292 virtual void calendarModified( bool, Calendar * ) = 0; 293 virtual void calendarModified( bool, Calendar * ) = 0;
293 }; 294 };
diff --git a/libkcal/calendarlocal.cpp b/libkcal/calendarlocal.cpp
index 418bfca..ca64e66 100644
--- a/libkcal/calendarlocal.cpp
+++ b/libkcal/calendarlocal.cpp
@@ -731,121 +731,123 @@ QPtrList<Event> CalendarLocal::rawEvents( const QDate &start, const QDate &end,
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 ( ( e >= start && s <= 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
764QPtrList<Event> CalendarLocal::rawEventsForDate( const QDateTime &qdt ) 764QPtrList<Event> CalendarLocal::rawEventsForDate( const QDateTime &qdt )
765{ 765{
766 return rawEventsForDate( qdt.date() ); 766 return rawEventsForDate( qdt.date() );
767} 767}
768 768
769QPtrList<Event> CalendarLocal::rawEvents() 769QPtrList<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
777bool CalendarLocal::addJournal(Journal *journal) 777bool 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
794void CalendarLocal::deleteJournal( Journal *journal ) 789void 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
799QPtrList<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}
804Journal *CalendarLocal::journal( const QDate &date ) 806Journal *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
815Journal *CalendarLocal::journal( const QString &uid ) 817Journal *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 ) {
820 if ( retVal ) { 822 if ( retVal ) {
821 if ( retVal->calID() > it->calID() ) { 823 if ( retVal->calID() > it->calID() ) {
822 retVal = it; 824 retVal = it;
823 } 825 }
824 } else { 826 } else {
825 retVal = it; 827 retVal = it;
826 } 828 }
827 } 829 }
828 return retVal; 830 return retVal;
829} 831}
830 832
831QPtrList<Journal> CalendarLocal::journals() 833QPtrList<Journal> CalendarLocal::journals()
832{ 834{
833 QPtrList<Journal> el; 835 QPtrList<Journal> el;
834 for ( Journal *it = mJournalList.first(); it; it = mJournalList.next() ) 836 for ( Journal *it = mJournalList.first(); it; it = mJournalList.next() )
835 if ( it->calEnabled() ) el.append( it ); 837 if ( it->calEnabled() ) el.append( it );
836 return el; 838 return el;
837} 839}
838void CalendarLocal::setCalendarRemove( int id ) 840void CalendarLocal::setCalendarRemove( int id )
839{ 841{
840 842
841 { 843 {
842 QPtrList<Event> EventList = mEventList; 844 QPtrList<Event> EventList = mEventList;
843 Event * ev = EventList.first(); 845 Event * ev = EventList.first();
844 while ( ev ) { 846 while ( ev ) {
845 if ( ev->calID() == id ) 847 if ( ev->calID() == id )
846 deleteEvent( ev ); 848 deleteEvent( ev );
847 ev = EventList.next(); 849 ev = EventList.next();
848 } 850 }
849 } 851 }
850 { 852 {
851 853
diff --git a/libkcal/calendarlocal.h b/libkcal/calendarlocal.h
index d32597f..98d16a3 100644
--- a/libkcal/calendarlocal.h
+++ b/libkcal/calendarlocal.h
@@ -86,96 +86,97 @@ class CalendarLocal : public Calendar
86 */ 86 */
87 Event *event( const QString &uid ); 87 Event *event( const QString &uid );
88 /** 88 /**
89 Return unfiltered list of all events in calendar. 89 Return unfiltered list of all events in calendar.
90 */ 90 */
91 QPtrList<Event> rawEvents(); 91 QPtrList<Event> rawEvents();
92 QPtrList<Event> getExternLastSyncEvents(); 92 QPtrList<Event> getExternLastSyncEvents();
93 /** 93 /**
94 Add a todo to the todolist. 94 Add a todo to the todolist.
95 */ 95 */
96 bool addTodo( Todo *todo ); 96 bool addTodo( Todo *todo );
97 bool addTodoNoDup( Todo *todo ); 97 bool addTodoNoDup( Todo *todo );
98 /** 98 /**
99 Remove a todo from the todolist. 99 Remove a todo from the todolist.
100 */ 100 */
101 void deleteTodo( Todo * ); 101 void deleteTodo( Todo * );
102 /** 102 /**
103 Searches todolist for an event with this unique string identifier, 103 Searches todolist for an event with this unique string identifier,
104 returns a pointer or null. 104 returns a pointer or null.
105 */ 105 */
106 Todo *todo( const QString &uid ); 106 Todo *todo( const QString &uid );
107 /** 107 /**
108 Return list of all todos. 108 Return list of all todos.
109 */ 109 */
110 QPtrList<Todo> rawTodos(); 110 QPtrList<Todo> rawTodos();
111 /** 111 /**
112 Returns list of todos due on the specified date. 112 Returns list of todos due on the specified date.
113 */ 113 */
114 QPtrList<Todo> todos( const QDate &date ); 114 QPtrList<Todo> todos( const QDate &date );
115 /** 115 /**
116 Return list of all todos. 116 Return list of all todos.
117 117
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.
150 */ 151 */
151 Alarm::List alarmsTo( const QDateTime &to ); 152 Alarm::List alarmsTo( const QDateTime &to );
152 153
153 QDateTime nextAlarm( int daysTo ) ; 154 QDateTime nextAlarm( int daysTo ) ;
154 QDateTime nextAlarmEventDateTime() const; 155 QDateTime nextAlarmEventDateTime() const;
155 void checkAlarmForIncidence( Incidence *, bool deleted ) ; 156 void checkAlarmForIncidence( Incidence *, bool deleted ) ;
156 void registerAlarm(); 157 void registerAlarm();
157 void deRegisterAlarm(); 158 void deRegisterAlarm();
158 QString getAlarmNotification(); 159 QString getAlarmNotification();
159 QString nextSummary() const ; 160 QString nextSummary() const ;
160 /** 161 /**
161 This method should be called whenever a Event is modified directly 162 This method should be called whenever a Event is modified directly
162 via it's pointer. It makes sure that the calendar is internally 163 via it's pointer. It makes sure that the calendar is internally
163 consistent. 164 consistent.
164 */ 165 */
165 void update( IncidenceBase *incidence ); 166 void update( IncidenceBase *incidence );
166 167
167 /** 168 /**
168 Builds and then returns a list of all events that match for the 169 Builds and then returns a list of all events that match for the
169 date specified. useful for dayView, etc. etc. 170 date specified. useful for dayView, etc. etc.
170 */ 171 */
171 QPtrList<Event> rawEventsForDate( const QDate &date, bool sorted = false ); 172 QPtrList<Event> rawEventsForDate( const QDate &date, bool sorted = false );
172 /** 173 /**
173 Get unfiltered events for date \a qdt. 174 Get unfiltered events for date \a qdt.
174 */ 175 */
175 QPtrList<Event> rawEventsForDate( const QDateTime &qdt ); 176 QPtrList<Event> rawEventsForDate( const QDateTime &qdt );
176 /** 177 /**
177 Get unfiltered events in a range of dates. If inclusive is set to true, 178 Get unfiltered events in a range of dates. If inclusive is set to true,
178 only events are returned, which are completely included in the range. 179 only events are returned, which are completely included in the range.
179 */ 180 */
180 QPtrList<Event> rawEvents( const QDate &start, const QDate &end, 181 QPtrList<Event> rawEvents( const QDate &start, const QDate &end,
181 bool inclusive = false ); 182 bool inclusive = false );