00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022 #ifndef KCAL_CALENDARLOCAL_H
00023 #define KCAL_CALENDARLOCAL_H
00024
00025 #include "calendar.h"
00026 #include <tqdict.h>
00027 #include <tdepimmacros.h>
00028
00029 namespace KCal {
00030
00031 class CalFormat;
00032
00036 class LIBKCAL_EXPORT CalendarLocal : public Calendar
00037 {
00038 public:
00042 CalendarLocal( const TQString &timeZoneId );
00043 ~CalendarLocal();
00044
00058 bool load( const TQString &fileName, CalFormat *format = 0 );
00059
00065 bool reload( const TQString &tz );
00066
00074 bool save( const TQString &fileName, CalFormat *format = 0 );
00075
00079 void close();
00080
00084 void closeEvents();
00085
00089 void closeTodos();
00090
00094 void closeJournals();
00095
00096 void save() {}
00097
00101 bool addEvent( Event *event );
00105 bool deleteEvent( Event *event );
00109 bool deleteChildEvents( Event *event );
00113 void deleteAllEvents();
00114
00118 Event *event( const TQString &uid );
00122 Event::List rawEvents( EventSortField sortField = EventSortUnsorted, SortDirection sortDirection = SortDirectionAscending );
00123
00127 bool addTodo( Todo *todo );
00131 bool deleteTodo( Todo * );
00135 bool deleteChildTodos( Todo *todo );
00139 void deleteAllTodos();
00144 Todo *todo( const TQString &uid );
00148 Todo::List rawTodos( TodoSortField sortField = TodoSortUnsorted, SortDirection sortDirection = SortDirectionAscending );
00152 Todo::List rawTodosForDate( const TQDate &date );
00153
00157 bool addJournal( Journal * );
00161 bool deleteJournal( Journal * );
00165 bool deleteChildJournals( Journal *journal );
00169 void deleteAllJournals();
00173 Journal *journal( const TQString &uid );
00177 Journal::List rawJournals( JournalSortField sortField = JournalSortUnsorted, SortDirection sortDirection = SortDirectionAscending );
00181 Journal::List rawJournalsForDate( const TQDate &date );
00182
00186 Alarm::List alarms( const TQDateTime &from, const TQDateTime &to );
00187
00191 Alarm::List alarmsTo( const TQDateTime &to );
00192
00197 Event::List rawEventsForDate( const TQDate &date, EventSortField sortField = EventSortUnsorted, SortDirection sortDirection = SortDirectionAscending );
00201 Event::List rawEventsForDate( const TQDateTime &qdt );
00211 Event::List rawEvents( const TQDate &start, const TQDate &end,
00212 bool inclusive = false );
00213
00219 void setTimeZoneIdViewOnly( const TQString& tz );
00220
00221 protected:
00222
00224 void incidenceUpdated( IncidenceBase *i );
00225
00227 void insertEvent( Event *event );
00228
00230 void appendAlarms( Alarm::List &alarms, Incidence *incidence,
00231 const TQDateTime &from, const TQDateTime &to );
00232
00234 void appendRecurringAlarms( Alarm::List &alarms, Incidence *incidence,
00235 const TQDateTime &from, const TQDateTime &to );
00236
00237 private:
00238 void init();
00239
00240 typedef TQDict<Event> EventDict;
00241 typedef TQDictIterator<Event> EventDictIterator;
00242 EventDict mEvents;
00243 Todo::List mTodoList;
00244 Journal::List mJournalList;
00245
00246 Incidence::List mDeletedIncidences;
00247 TQString mFileName;
00248
00249 class Private;
00250 Private *d;
00251 };
00252
00253 }
00254
00255 #endif