-rw-r--r-- | libkcal/calendarlocal.h | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/libkcal/calendarlocal.h b/libkcal/calendarlocal.h index ca0bd98..eb7bf34 100644 --- a/libkcal/calendarlocal.h +++ b/libkcal/calendarlocal.h | |||
@@ -1,231 +1,232 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of libkcal. | 2 | This file is part of libkcal. |
3 | 3 | ||
4 | Copyright (c) 1998 Preston Brown | 4 | Copyright (c) 1998 Preston Brown |
5 | Copyright (c) 2001,2003 Cornelius Schumacher <schumacher@kde.org> | 5 | Copyright (c) 2001,2003 Cornelius Schumacher <schumacher@kde.org> |
6 | 6 | ||
7 | This library is free software; you can redistribute it and/or | 7 | This library is free software; you can redistribute it and/or |
8 | modify it under the terms of the GNU Library General Public | 8 | modify it under the terms of the GNU Library General Public |
9 | License as published by the Free Software Foundation; either | 9 | License as published by the Free Software Foundation; either |
10 | version 2 of the License, or (at your option) any later version. | 10 | version 2 of the License, or (at your option) any later version. |
11 | 11 | ||
12 | This library is distributed in the hope that it will be useful, | 12 | This library is distributed in the hope that it will be useful, |
13 | but WITHOUT ANY WARRANTY; without even the implied warranty of | 13 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
15 | Library General Public License for more details. | 15 | Library General Public License for more details. |
16 | 16 | ||
17 | You should have received a copy of the GNU Library General Public License | 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 | 18 | along with this library; see the file COPYING.LIB. If not, write to |
19 | the Free Software Foundation, Inc., 59 Temple Place - Suite 330, | 19 | the Free Software Foundation, Inc., 59 Temple Place - Suite 330, |
20 | Boston, MA 02111-1307, USA. | 20 | Boston, MA 02111-1307, USA. |
21 | */ | 21 | */ |
22 | #ifndef KCAL_CALENDARLOCAL_H | 22 | #ifndef KCAL_CALENDARLOCAL_H |
23 | #define KCAL_CALENDARLOCAL_H | 23 | #define KCAL_CALENDARLOCAL_H |
24 | 24 | ||
25 | #include "calendar.h" | 25 | #include "calendar.h" |
26 | 26 | ||
27 | namespace KCal { | 27 | namespace KCal { |
28 | 28 | ||
29 | class CalFormat; | 29 | class CalFormat; |
30 | 30 | ||
31 | /** | 31 | /** |
32 | This class provides a calendar stored as a local file. | 32 | This class provides a calendar stored as a local file. |
33 | */ | 33 | */ |
34 | class CalendarLocal : public Calendar | 34 | class CalendarLocal : public Calendar |
35 | { | 35 | { |
36 | public: | 36 | public: |
37 | /** | 37 | /** |
38 | Constructs a new calendar, with variables initialized to sane values. | 38 | Constructs a new calendar, with variables initialized to sane values. |
39 | */ | 39 | */ |
40 | CalendarLocal(); | 40 | CalendarLocal(); |
41 | /** | 41 | /** |
42 | Constructs a new calendar, with variables initialized to sane values. | 42 | Constructs a new calendar, with variables initialized to sane values. |
43 | */ | 43 | */ |
44 | CalendarLocal( const QString &timeZoneId ); | 44 | CalendarLocal( const QString &timeZoneId ); |
45 | ~CalendarLocal(); | 45 | ~CalendarLocal(); |
46 | void addCalendar( Calendar* ); | 46 | void addCalendar( Calendar* ); |
47 | bool addCalendarFile( QString name, int id ); | 47 | bool addCalendarFile( QString name, int id ); |
48 | bool mergeCalendarFile( QString name ); | 48 | bool mergeCalendarFile( QString name ); |
49 | bool mergeCalendar( Calendar* cal ); | 49 | bool mergeCalendar( Calendar* cal ); |
50 | Incidence* incidenceForUid( const QString& uid, bool doNotCheckDuplicates ); | 50 | Incidence* incidenceForUid( const QString& uid, bool doNotCheckDuplicates ); |
51 | void setSyncEventsReadOnly(); | 51 | void setSyncEventsReadOnly(); |
52 | void setSyncEventsEnabled(); | ||
52 | void stopAllTodos(); | 53 | void stopAllTodos(); |
53 | /** | 54 | /** |
54 | Loads a calendar on disk in vCalendar or iCalendar format into the current | 55 | Loads a calendar on disk in vCalendar or iCalendar format into the current |
55 | calendar. Any information already present is lost. | 56 | calendar. Any information already present is lost. |
56 | @return true, if successfull, false on error. | 57 | @return true, if successfull, false on error. |
57 | @param fileName the name of the calendar on disk. | 58 | @param fileName the name of the calendar on disk. |
58 | */ | 59 | */ |
59 | bool load( const QString &fileName ); | 60 | bool load( const QString &fileName ); |
60 | /** | 61 | /** |
61 | Writes out the calendar to disk in the specified \a format. | 62 | Writes out the calendar to disk in the specified \a format. |
62 | CalendarLocal takes ownership of the CalFormat object. | 63 | CalendarLocal takes ownership of the CalFormat object. |
63 | @return true, if successfull, false on error. | 64 | @return true, if successfull, false on error. |
64 | @param fileName the name of the file | 65 | @param fileName the name of the file |
65 | */ | 66 | */ |
66 | bool save( const QString &fileName, CalFormat *format = 0 ); | 67 | bool save( const QString &fileName, CalFormat *format = 0 ); |
67 | 68 | ||
68 | /** | 69 | /** |
69 | Clears out the current calendar, freeing all used memory etc. etc. | 70 | Clears out the current calendar, freeing all used memory etc. etc. |
70 | */ | 71 | */ |
71 | void close(); | 72 | void close(); |
72 | 73 | ||
73 | void save() {} | 74 | void save() {} |
74 | 75 | ||
75 | /** | 76 | /** |
76 | Add Event to calendar. | 77 | Add Event to calendar. |
77 | */ | 78 | */ |
78 | void removeSyncInfo( QString syncProfile); | 79 | void removeSyncInfo( QString syncProfile); |
79 | bool addAnniversaryNoDup( Event *event ); | 80 | bool addAnniversaryNoDup( Event *event ); |
80 | bool addEventNoDup( Event *event ); | 81 | bool addEventNoDup( Event *event ); |
81 | bool addEvent( Event *event ); | 82 | bool addEvent( Event *event ); |
82 | /** | 83 | /** |
83 | Deletes an event from this calendar. | 84 | Deletes an event from this calendar. |
84 | */ | 85 | */ |
85 | void deleteEvent( Event *event ); | 86 | void deleteEvent( Event *event ); |
86 | 87 | ||
87 | /** | 88 | /** |
88 | Retrieves an event on the basis of the unique string ID. | 89 | Retrieves an event on the basis of the unique string ID. |
89 | */ | 90 | */ |
90 | Event *event( const QString &uid ); | 91 | Event *event( const QString &uid ); |
91 | /** | 92 | /** |
92 | Return unfiltered list of all events in calendar. | 93 | Return unfiltered list of all events in calendar. |
93 | */ | 94 | */ |
94 | QPtrList<Event> rawEvents(); | 95 | QPtrList<Event> rawEvents(); |
95 | QPtrList<Event> getExternLastSyncEvents(); | 96 | QPtrList<Event> getExternLastSyncEvents(); |
96 | /** | 97 | /** |
97 | Add a todo to the todolist. | 98 | Add a todo to the todolist. |
98 | */ | 99 | */ |
99 | bool addTodo( Todo *todo ); | 100 | bool addTodo( Todo *todo ); |
100 | bool addTodoNoDup( Todo *todo ); | 101 | bool addTodoNoDup( Todo *todo ); |
101 | /** | 102 | /** |
102 | Remove a todo from the todolist. | 103 | Remove a todo from the todolist. |
103 | */ | 104 | */ |
104 | void deleteTodo( Todo * ); | 105 | void deleteTodo( Todo * ); |
105 | /** | 106 | /** |
106 | Searches todolist for an event with this unique string identifier, | 107 | Searches todolist for an event with this unique string identifier, |
107 | returns a pointer or null. | 108 | returns a pointer or null. |
108 | */ | 109 | */ |
109 | Todo *todo( const QString &uid ); | 110 | Todo *todo( const QString &uid ); |
110 | /** | 111 | /** |
111 | Return list of all todos. | 112 | Return list of all todos. |
112 | */ | 113 | */ |
113 | QPtrList<Todo> rawTodos(); | 114 | QPtrList<Todo> rawTodos(); |
114 | /** | 115 | /** |
115 | Returns list of todos due on the specified date. | 116 | Returns list of todos due on the specified date. |
116 | */ | 117 | */ |
117 | QPtrList<Todo> todos( const QDate &date ); | 118 | QPtrList<Todo> todos( const QDate &date ); |
118 | /** | 119 | /** |
119 | Return list of all todos. | 120 | Return list of all todos. |
120 | 121 | ||
121 | Workaround because compiler does not recognize function of base class. | 122 | Workaround because compiler does not recognize function of base class. |
122 | */ | 123 | */ |
123 | QPtrList<Todo> todos() { return Calendar::todos(); } | 124 | QPtrList<Todo> todos() { return Calendar::todos(); } |
124 | 125 | ||
125 | /** | 126 | /** |
126 | Add a Journal entry to calendar. | 127 | Add a Journal entry to calendar. |
127 | */ | 128 | */ |
128 | bool addJournal( Journal * ); | 129 | bool addJournal( Journal * ); |
129 | /** | 130 | /** |
130 | Remove a Journal from the calendar. | 131 | Remove a Journal from the calendar. |
131 | */ | 132 | */ |
132 | void deleteJournal( Journal * ); | 133 | void deleteJournal( Journal * ); |
133 | /** | 134 | /** |
134 | Return Journal for given date. | 135 | Return Journal for given date. |
135 | */ | 136 | */ |
136 | Journal *journal( const QDate & ); | 137 | Journal *journal( const QDate & ); |
137 | QPtrList<Journal> journals4Date( const QDate & ); | 138 | QPtrList<Journal> journals4Date( const QDate & ); |
138 | /** | 139 | /** |
139 | Return Journal with given UID. | 140 | Return Journal with given UID. |
140 | */ | 141 | */ |
141 | Journal *journal( const QString &uid ); | 142 | Journal *journal( const QString &uid ); |
142 | /** | 143 | /** |
143 | Return list of all Journals stored in calendar. | 144 | Return list of all Journals stored in calendar. |
144 | */ | 145 | */ |
145 | QPtrList<Journal> journals(); | 146 | QPtrList<Journal> journals(); |
146 | 147 | ||
147 | /** | 148 | /** |
148 | Return all alarms, which ocur in the given time interval. | 149 | Return all alarms, which ocur in the given time interval. |
149 | */ | 150 | */ |
150 | Alarm::List alarms( const QDateTime &from, const QDateTime &to ); | 151 | Alarm::List alarms( const QDateTime &from, const QDateTime &to ); |
151 | 152 | ||
152 | /** | 153 | /** |
153 | Return all alarms, which ocur before given date. | 154 | Return all alarms, which ocur before given date. |
154 | */ | 155 | */ |
155 | Alarm::List alarmsTo( const QDateTime &to ); | 156 | Alarm::List alarmsTo( const QDateTime &to ); |
156 | 157 | ||
157 | QDateTime nextAlarm( int daysTo ) ; | 158 | QDateTime nextAlarm( int daysTo ) ; |
158 | QDateTime nextAlarmEventDateTime() const; | 159 | QDateTime nextAlarmEventDateTime() const; |
159 | void checkAlarmForIncidence( Incidence *, bool deleted ) ; | 160 | void checkAlarmForIncidence( Incidence *, bool deleted ) ; |
160 | void registerAlarm(); | 161 | void registerAlarm(); |
161 | void deRegisterAlarm(); | 162 | void deRegisterAlarm(); |
162 | QString getAlarmNotification(); | 163 | QString getAlarmNotification(); |
163 | QString nextSummary() const ; | 164 | QString nextSummary() const ; |
164 | /** | 165 | /** |
165 | This method should be called whenever a Event is modified directly | 166 | This method should be called whenever a Event is modified directly |
166 | via it's pointer. It makes sure that the calendar is internally | 167 | via it's pointer. It makes sure that the calendar is internally |
167 | consistent. | 168 | consistent. |
168 | */ | 169 | */ |
169 | void update( IncidenceBase *incidence ); | 170 | void update( IncidenceBase *incidence ); |
170 | 171 | ||
171 | /** | 172 | /** |
172 | Builds and then returns a list of all events that match for the | 173 | Builds and then returns a list of all events that match for the |
173 | date specified. useful for dayView, etc. etc. | 174 | date specified. useful for dayView, etc. etc. |
174 | */ | 175 | */ |
175 | QPtrList<Event> rawEventsForDate( const QDate &date, bool sorted = false ); | 176 | QPtrList<Event> rawEventsForDate( const QDate &date, bool sorted = false ); |
176 | /** | 177 | /** |
177 | Get unfiltered events for date \a qdt. | 178 | Get unfiltered events for date \a qdt. |
178 | */ | 179 | */ |
179 | QPtrList<Event> rawEventsForDate( const QDateTime &qdt ); | 180 | QPtrList<Event> rawEventsForDate( const QDateTime &qdt ); |
180 | /** | 181 | /** |
181 | Get unfiltered events in a range of dates. If inclusive is set to true, | 182 | Get unfiltered events in a range of dates. If inclusive is set to true, |
182 | only events are returned, which are completely included in the range. | 183 | only events are returned, which are completely included in the range. |
183 | */ | 184 | */ |
184 | QPtrList<Event> rawEvents( const QDate &start, const QDate &end, | 185 | QPtrList<Event> rawEvents( const QDate &start, const QDate &end, |
185 | bool inclusive = false ); | 186 | bool inclusive = false ); |
186 | Todo *todo( QString, QString ); | 187 | Todo *todo( QString, QString ); |
187 | Event *event( QString, QString ); | 188 | Event *event( QString, QString ); |
188 | void getIncidenceCount( int calId, int& events, int & todos, int & journals); | 189 | void getIncidenceCount( int calId, int& events, int & todos, int & journals); |
189 | 190 | ||
190 | public slots: | 191 | public slots: |
191 | void setCalendarEnabled( int id, bool enable ); | 192 | void setCalendarEnabled( int id, bool enable ); |
192 | void setAlarmEnabled( int id, bool enable ); | 193 | void setAlarmEnabled( int id, bool enable ); |
193 | void setReadOnly( int id, bool enable ); | 194 | void setReadOnly( int id, bool enable ); |
194 | void setDefaultCalendarEnabledOnly(); | 195 | void setDefaultCalendarEnabledOnly(); |
195 | void setCalendarRemove( int id ); | 196 | void setCalendarRemove( int id ); |
196 | 197 | ||
197 | protected: | 198 | protected: |
198 | 199 | ||
199 | // Event* mNextAlarmEvent; | 200 | // Event* mNextAlarmEvent; |
200 | QString mNextSummary; | 201 | QString mNextSummary; |
201 | QString mNextAlarmEventDateTimeString; | 202 | QString mNextAlarmEventDateTimeString; |
202 | QString mLastAlarmNotificationString; | 203 | QString mLastAlarmNotificationString; |
203 | QDateTime mNextAlarmEventDateTime; | 204 | QDateTime mNextAlarmEventDateTime; |
204 | QDateTime mNextAlarmDateTime; | 205 | QDateTime mNextAlarmDateTime; |
205 | void reInitAlarmSettings(); | 206 | void reInitAlarmSettings(); |
206 | 207 | ||
207 | /** Notification function of IncidenceBase::Observer. */ | 208 | /** Notification function of IncidenceBase::Observer. */ |
208 | void incidenceUpdated( IncidenceBase *i ) { update( i ); } | 209 | void incidenceUpdated( IncidenceBase *i ) { update( i ); } |
209 | 210 | ||
210 | /** inserts an event into its "proper place" in the calendar. */ | 211 | /** inserts an event into its "proper place" in the calendar. */ |
211 | void insertEvent( Event *event ); | 212 | void insertEvent( Event *event ); |
212 | 213 | ||
213 | /** Append alarms of incidence in interval to list of alarms. */ | 214 | /** Append alarms of incidence in interval to list of alarms. */ |
214 | void appendAlarms( Alarm::List &alarms, Incidence *incidence, | 215 | void appendAlarms( Alarm::List &alarms, Incidence *incidence, |
215 | const QDateTime &from, const QDateTime &to ); | 216 | const QDateTime &from, const QDateTime &to ); |
216 | 217 | ||
217 | /** Append alarms of recurring events in interval to list of alarms. */ | 218 | /** Append alarms of recurring events in interval to list of alarms. */ |
218 | void appendRecurringAlarms( Alarm::List &alarms, Incidence *incidence, | 219 | void appendRecurringAlarms( Alarm::List &alarms, Incidence *incidence, |
219 | const QDateTime &from, const QDateTime &to ); | 220 | const QDateTime &from, const QDateTime &to ); |
220 | 221 | ||
221 | private: | 222 | private: |
222 | void init(); | 223 | void init(); |
223 | 224 | ||
224 | QPtrList<Event> mEventList; | 225 | QPtrList<Event> mEventList; |
225 | QPtrList<Todo> mTodoList; | 226 | QPtrList<Todo> mTodoList; |
226 | QPtrList<Journal> mJournalList; | 227 | QPtrList<Journal> mJournalList; |
227 | }; | 228 | }; |
228 | 229 | ||
229 | } | 230 | } |
230 | 231 | ||
231 | #endif | 232 | #endif |