calendarlocal.h
00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021 #ifndef KCAL_CALENDARLOCAL_H
00022 #define KCAL_CALENDARLOCAL_H
00023
00024 #include <qintdict.h>
00025
00026 #include "calendar.h"
00027
00028 #define BIGPRIME 1031
00029
00030
00031 namespace KCal {
00032
00033 class CalFormat;
00034
00038 class CalendarLocal : public Calendar, public IncidenceBase::Observer
00039 {
00040 public:
00042 CalendarLocal();
00044 CalendarLocal( const QString &timeZoneId );
00045 virtual ~CalendarLocal();
00046
00053 bool load( const QString &fileName );
00060 bool save( const QString &fileName, CalFormat *format = 0 );
00061
00063 void close();
00064
00066 void addEvent(Event *anEvent);
00068 void deleteEvent(Event *);
00069
00073 Event *event(const QString &UniqueStr);
00077
00081 QPtrList<Event> rawEvents();
00082
00083
00084
00085
00086
00087 QString getHolidayForDate(const QDate &qd);
00088
00090 int numEvents(const QDate &qd);
00091
00095 void addTodo( Todo *todo );
00099 void deleteTodo( Todo * );
00104 Todo *todo( const QString &uid );
00108 QPtrList<Todo> rawTodos() const;
00112 QPtrList<Todo> todos( const QDate &date );
00118 QPtrList<Todo> todos() { return Calendar::todos(); }
00119
00121 virtual void addJournal(Journal *);
00123 virtual void deleteJournal(Journal *);
00125 virtual Journal *journal(const QDate &);
00127 virtual Journal *journal(const QString &UID);
00129 QPtrList<Journal> journals();
00130
00132 Alarm::List alarms( const QDateTime &from, const QDateTime &to );
00133
00135 Alarm::List alarmsTo( const QDateTime &to );
00136
00137
00141 void update(IncidenceBase *incidence);
00142
00147 QPtrList<Event> rawEventsForDate( const QDate &date, bool sorted = false );
00151 QPtrList<Event> rawEventsForDate( const QDateTime &qdt );
00156 QPtrList<Event> rawEvents( const QDate &start, const QDate &end,
00157 bool inclusive = false );
00158
00159
00160 protected:
00161
00163 void incidenceUpdated( IncidenceBase *i ) { update( i ); }
00164
00166 void insertEvent(const Event *anEvent);
00167
00169 long int makeKey(const QDateTime &dt);
00171 long int makeKey(const QDate &d);
00173 QDate keyToDate(long int key);
00174
00176 void appendAlarms( Alarm::List &alarms, Incidence *incidence,
00177 const QDateTime &from, const QDateTime &to );
00178
00180 void appendRecurringAlarms( Alarm::List &alarms, Incidence *incidence,
00181 const QDateTime &from, const QDateTime &to );
00182
00183 private:
00184 void init();
00185
00186 QIntDict<QPtrList<Event> > *mCalDict;
00187 QPtrList<Event> mRecursList;
00188
00189 QPtrList<Todo> mTodoList;
00190
00191 QPtrList<Journal> mJournalList;
00192
00193 QDate *mOldestDate;
00194 QDate *mNewestDate;
00195 };
00196
00197 }
00198
00199 #endif
This file is part of the documentation for kdelibs Version 3.1.4.