libkcal

calendarlocal.h
1 /*
2  This file is part of libkcal.
3 
4  Copyright (c) 1998 Preston Brown <pbrown@kde.org>
5  Copyright (c) 2001,2003 Cornelius Schumacher <schumacher@kde.org>
6 
7  This library is free software; you can redistribute it and/or
8  modify it under the terms of the GNU Library General Public
9  License as published by the Free Software Foundation; either
10  version 2 of the License, or (at your option) any later version.
11 
12  This library is distributed in the hope that it will be useful,
13  but WITHOUT ANY WARRANTY; without even the implied warranty of
14  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15  Library General Public License for more details.
16 
17  You should have received a copy of the GNU Library General Public License
18  along with this library; see the file COPYING.LIB. If not, write to
19  the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
20  Boston, MA 02110-1301, USA.
21 */
22 #ifndef KCAL_CALENDARLOCAL_H
23 #define KCAL_CALENDARLOCAL_H
24 
25 #include "calendar.h"
26 #include <tqdict.h>
27 #include <tdemacros.h>
28 
29 namespace KCal {
30 
31 class CalFormat;
32 
36 class LIBKCAL_EXPORT CalendarLocal : public Calendar
37 {
38  public:
42  CalendarLocal( const TQString &timeZoneId );
43  ~CalendarLocal();
44 
58  bool load( const TQString &fileName, CalFormat *format = 0 );
59 
65  bool reload( const TQString &tz );
66 
74  bool save( const TQString &fileName, CalFormat *format = 0 );
75 
79  void close();
80 
84  void closeEvents();
85 
89  void closeTodos();
90 
94  void closeJournals();
95 
96  void save() {}
97 
101  bool addEvent( Event *event );
105  bool deleteEvent( Event *event );
109  bool deleteChildEvents( Event *event );
113  void deleteAllEvents();
114 
118  Event *event( const TQString &uid );
122  Event::List rawEvents( EventSortField sortField = EventSortUnsorted, SortDirection sortDirection = SortDirectionAscending );
123 
127  bool addTodo( Todo *todo );
131  bool deleteTodo( Todo * );
135  bool deleteChildTodos( Todo *todo );
139  void deleteAllTodos();
144  Todo *todo( const TQString &uid );
148  Todo::List rawTodos( TodoSortField sortField = TodoSortUnsorted, SortDirection sortDirection = SortDirectionAscending );
152  Todo::List rawTodosForDate( const TQDate &date );
153 
157  bool addJournal( Journal * );
161  bool deleteJournal( Journal * );
165  bool deleteChildJournals( Journal *journal );
169  void deleteAllJournals();
173  Journal *journal( const TQString &uid );
177  Journal::List rawJournals( JournalSortField sortField = JournalSortUnsorted, SortDirection sortDirection = SortDirectionAscending );
181  Journal::List rawJournalsForDate( const TQDate &date );
182 
186  Alarm::List alarms( const TQDateTime &from, const TQDateTime &to );
187 
191  Alarm::List alarmsTo( const TQDateTime &to );
192 
197  Event::List rawEventsForDate( const TQDate &date, EventSortField sortField = EventSortUnsorted, SortDirection sortDirection = SortDirectionAscending );
201  Event::List rawEventsForDate( const TQDateTime &qdt );
211  Event::List rawEvents( const TQDate &start, const TQDate &end,
212  bool inclusive = false );
213 
219  void setTimeZoneIdViewOnly( const TQString& tz );
220 
221  protected:
222 
224  void incidenceUpdated( IncidenceBase *i );
225 
227  void insertEvent( Event *event );
228 
230  void appendAlarms( Alarm::List &alarms, Incidence *incidence,
231  const TQDateTime &from, const TQDateTime &to );
232 
234  void appendRecurringAlarms( Alarm::List &alarms, Incidence *incidence,
235  const TQDateTime &from, const TQDateTime &to );
236 
237  private:
238  void init();
239 
240  typedef TQDict<Event> EventDict;
241  typedef TQDictIterator<Event> EventDictIterator;
242  EventDict mEvents;
243  Todo::List mTodoList;
244  Journal::List mJournalList;
245 
246  Incidence::List mDeletedIncidences;
247  TQString mFileName;
248 
249  class Private;
250  Private *d;
251 };
252 
253 }
254 
255 #endif
Provides the main "calendar" object class.
This is the base class for calendar formats.
Definition: calformat.h:44
This class provides a calendar stored as a local file.
Definition: calendarlocal.h:37
void save()
Sync changes in memory to persistant storage.
Definition: calendarlocal.h:96
This is the main "calendar" object class.
Definition: calendar.h:171
This class provides an Event in the sense of RFC2445.
Definition: event.h:33
This class provides the base class common to all calendar components.
Definition: incidencebase.h:46
This class provides the base class common to all calendar components.
Definition: incidence.h:48
This class provides a Journal in the sense of RFC2445.
Definition: journal.h:34
This class provides a Todo in the sense of RFC2445.
Definition: todo.h:32
Namespace KCal is for global classes, objects and/or functions in libkcal.
Definition: alarm.h:38
TodoSortField
How Todos are to be sorted.
Definition: calendar.h:91
@ TodoSortUnsorted
Todos are to be unsorted.
Definition: calendar.h:93
JournalSortField
How Journals are to be sorted.
Definition: calendar.h:111
@ JournalSortUnsorted
Journals are to be unsorted.
Definition: calendar.h:113
EventSortField
How Events are to be sorted.
Definition: calendar.h:75
@ EventSortUnsorted
Events are to be unsorted.
Definition: calendar.h:77
SortDirection
Sort direction.
Definition: calendar.h:63
@ SortDirectionAscending
Sort in ascending order (first to last)
Definition: calendar.h:65