calendarlocal.h
00001 /* 00002 This file is part of libkcal. 00003 00004 Copyright (c) 1998 Preston Brown <pbrown@kde.org> 00005 Copyright (c) 2001,2003 Cornelius Schumacher <schumacher@kde.org> 00006 00007 This library is free software; you can redistribute it and/or 00008 modify it under the terms of the GNU Library General Public 00009 License as published by the Free Software Foundation; either 00010 version 2 of the License, or (at your option) any later version. 00011 00012 This library is distributed in the hope that it will be useful, 00013 but WITHOUT ANY WARRANTY; without even the implied warranty of 00014 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00015 Library General Public License for more details. 00016 00017 You should have received a copy of the GNU Library General Public License 00018 along with this library; see the file COPYING.LIB. If not, write to 00019 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 00020 Boston, MA 02110-1301, USA. 00021 */ 00022 #ifndef KCAL_CALENDARLOCAL_H 00023 #define KCAL_CALENDARLOCAL_H 00024 00025 #include "calendar.h" 00026 #include <tqdict.h> 00027 #include <kdepimmacros.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