-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 a7a85c8..ca0bd98 100644 --- a/libkcal/calendarlocal.h +++ b/libkcal/calendarlocal.h | |||
@@ -1,230 +1,231 @@ | |||
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 stopAllTodos(); | 52 | void stopAllTodos(); |
53 | /** | 53 | /** |
54 | Loads a calendar on disk in vCalendar or iCalendar format into the current | 54 | Loads a calendar on disk in vCalendar or iCalendar format into the current |
55 | calendar. Any information already present is lost. | 55 | calendar. Any information already present is lost. |
56 | @return true, if successfull, false on error. | 56 | @return true, if successfull, false on error. |
57 | @param fileName the name of the calendar on disk. | 57 | @param fileName the name of the calendar on disk. |
58 | */ | 58 | */ |
59 | bool load( const QString &fileName ); | 59 | bool load( const QString &fileName ); |
60 | /** | 60 | /** |
61 | Writes out the calendar to disk in the specified \a format. | 61 | Writes out the calendar to disk in the specified \a format. |
62 | CalendarLocal takes ownership of the CalFormat object. | 62 | CalendarLocal takes ownership of the CalFormat object. |
63 | @return true, if successfull, false on error. | 63 | @return true, if successfull, false on error. |
64 | @param fileName the name of the file | 64 | @param fileName the name of the file |
65 | */ | 65 | */ |
66 | bool save( const QString &fileName, CalFormat *format = 0 ); | 66 | bool save( const QString &fileName, CalFormat *format = 0 ); |
67 | 67 | ||
68 | /** | 68 | /** |
69 | Clears out the current calendar, freeing all used memory etc. etc. | 69 | Clears out the current calendar, freeing all used memory etc. etc. |
70 | */ | 70 | */ |
71 | void close(); | 71 | void close(); |
72 | 72 | ||
73 | void save() {} | 73 | void save() {} |
74 | 74 | ||
75 | /** | 75 | /** |
76 | Add Event to calendar. | 76 | Add Event to calendar. |
77 | */ | 77 | */ |
78 | void removeSyncInfo( QString syncProfile); | 78 | void removeSyncInfo( QString syncProfile); |
79 | bool addAnniversaryNoDup( Event *event ); | 79 | bool addAnniversaryNoDup( Event *event ); |
80 | bool addEventNoDup( Event *event ); | 80 | bool addEventNoDup( Event *event ); |
81 | bool addEvent( Event *event ); | 81 | bool addEvent( Event *event ); |
82 | /** | 82 | /** |
83 | Deletes an event from this calendar. | 83 | Deletes an event from this calendar. |
84 | */ | 84 | */ |
85 | void deleteEvent( Event *event ); | 85 | void deleteEvent( Event *event ); |
86 | 86 | ||
87 | /** | 87 | /** |
88 | Retrieves an event on the basis of the unique string ID. | 88 | Retrieves an event on the basis of the unique string ID. |
89 | */ | 89 | */ |
90 | Event *event( const QString &uid ); | 90 | Event *event( const QString &uid ); |
91 | /** | 91 | /** |
92 | Return unfiltered list of all events in calendar. | 92 | Return unfiltered list of all events in calendar. |
93 | */ | 93 | */ |
94 | QPtrList<Event> rawEvents(); | 94 | QPtrList<Event> rawEvents(); |
95 | QPtrList<Event> getExternLastSyncEvents(); | 95 | QPtrList<Event> getExternLastSyncEvents(); |
96 | /** | 96 | /** |
97 | Add a todo to the todolist. | 97 | Add a todo to the todolist. |
98 | */ | 98 | */ |
99 | bool addTodo( Todo *todo ); | 99 | bool addTodo( Todo *todo ); |
100 | bool addTodoNoDup( Todo *todo ); | 100 | bool addTodoNoDup( Todo *todo ); |
101 | /** | 101 | /** |
102 | Remove a todo from the todolist. | 102 | Remove a todo from the todolist. |
103 | */ | 103 | */ |
104 | void deleteTodo( Todo * ); | 104 | void deleteTodo( Todo * ); |
105 | /** | 105 | /** |
106 | Searches todolist for an event with this unique string identifier, | 106 | Searches todolist for an event with this unique string identifier, |
107 | returns a pointer or null. | 107 | returns a pointer or null. |
108 | */ | 108 | */ |
109 | Todo *todo( const QString &uid ); | 109 | Todo *todo( const QString &uid ); |
110 | /** | 110 | /** |
111 | Return list of all todos. | 111 | Return list of all todos. |
112 | */ | 112 | */ |
113 | QPtrList<Todo> rawTodos(); | 113 | QPtrList<Todo> rawTodos(); |
114 | /** | 114 | /** |
115 | Returns list of todos due on the specified date. | 115 | Returns list of todos due on the specified date. |
116 | */ | 116 | */ |
117 | QPtrList<Todo> todos( const QDate &date ); | 117 | QPtrList<Todo> todos( const QDate &date ); |
118 | /** | 118 | /** |
119 | Return list of all todos. | 119 | Return list of all todos. |
120 | 120 | ||
121 | Workaround because compiler does not recognize function of base class. | 121 | Workaround because compiler does not recognize function of base class. |
122 | */ | 122 | */ |
123 | QPtrList<Todo> todos() { return Calendar::todos(); } | 123 | QPtrList<Todo> todos() { return Calendar::todos(); } |
124 | 124 | ||
125 | /** | 125 | /** |
126 | Add a Journal entry to calendar. | 126 | Add a Journal entry to calendar. |
127 | */ | 127 | */ |
128 | bool addJournal( Journal * ); | 128 | bool addJournal( Journal * ); |
129 | /** | 129 | /** |
130 | Remove a Journal from the calendar. | 130 | Remove a Journal from the calendar. |
131 | */ | 131 | */ |
132 | void deleteJournal( Journal * ); | 132 | void deleteJournal( Journal * ); |
133 | /** | 133 | /** |
134 | Return Journal for given date. | 134 | Return Journal for given date. |
135 | */ | 135 | */ |
136 | Journal *journal( const QDate & ); | 136 | Journal *journal( const QDate & ); |
137 | QPtrList<Journal> journals4Date( const QDate & ); | 137 | QPtrList<Journal> journals4Date( const QDate & ); |
138 | /** | 138 | /** |
139 | Return Journal with given UID. | 139 | Return Journal with given UID. |
140 | */ | 140 | */ |
141 | Journal *journal( const QString &uid ); | 141 | Journal *journal( const QString &uid ); |
142 | /** | 142 | /** |
143 | Return list of all Journals stored in calendar. | 143 | Return list of all Journals stored in calendar. |
144 | */ | 144 | */ |
145 | QPtrList<Journal> journals(); | 145 | QPtrList<Journal> journals(); |
146 | 146 | ||
147 | /** | 147 | /** |
148 | Return all alarms, which ocur in the given time interval. | 148 | Return all alarms, which ocur in the given time interval. |
149 | */ | 149 | */ |
150 | Alarm::List alarms( const QDateTime &from, const QDateTime &to ); | 150 | Alarm::List alarms( const QDateTime &from, const QDateTime &to ); |
151 | 151 | ||
152 | /** | 152 | /** |
153 | Return all alarms, which ocur before given date. | 153 | Return all alarms, which ocur before given date. |
154 | */ | 154 | */ |
155 | Alarm::List alarmsTo( const QDateTime &to ); | 155 | Alarm::List alarmsTo( const QDateTime &to ); |
156 | 156 | ||
157 | QDateTime nextAlarm( int daysTo ) ; | 157 | QDateTime nextAlarm( int daysTo ) ; |
158 | QDateTime nextAlarmEventDateTime() const; | 158 | QDateTime nextAlarmEventDateTime() const; |
159 | void checkAlarmForIncidence( Incidence *, bool deleted ) ; | 159 | void checkAlarmForIncidence( Incidence *, bool deleted ) ; |
160 | void registerAlarm(); | 160 | void registerAlarm(); |
161 | void deRegisterAlarm(); | 161 | void deRegisterAlarm(); |
162 | QString getAlarmNotification(); | 162 | QString getAlarmNotification(); |
163 | QString nextSummary() const ; | 163 | QString nextSummary() const ; |
164 | /** | 164 | /** |
165 | This method should be called whenever a Event is modified directly | 165 | This method should be called whenever a Event is modified directly |
166 | via it's pointer. It makes sure that the calendar is internally | 166 | via it's pointer. It makes sure that the calendar is internally |
167 | consistent. | 167 | consistent. |
168 | */ | 168 | */ |
169 | void update( IncidenceBase *incidence ); | 169 | void update( IncidenceBase *incidence ); |
170 | 170 | ||
171 | /** | 171 | /** |
172 | Builds and then returns a list of all events that match for the | 172 | Builds and then returns a list of all events that match for the |
173 | date specified. useful for dayView, etc. etc. | 173 | date specified. useful for dayView, etc. etc. |
174 | */ | 174 | */ |
175 | QPtrList<Event> rawEventsForDate( const QDate &date, bool sorted = false ); | 175 | QPtrList<Event> rawEventsForDate( const QDate &date, bool sorted = false ); |
176 | /** | 176 | /** |
177 | Get unfiltered events for date \a qdt. | 177 | Get unfiltered events for date \a qdt. |
178 | */ | 178 | */ |
179 | QPtrList<Event> rawEventsForDate( const QDateTime &qdt ); | 179 | QPtrList<Event> rawEventsForDate( const QDateTime &qdt ); |
180 | /** | 180 | /** |
181 | Get unfiltered events in a range of dates. If inclusive is set to true, | 181 | 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. | 182 | only events are returned, which are completely included in the range. |
183 | */ | 183 | */ |
184 | QPtrList<Event> rawEvents( const QDate &start, const QDate &end, | 184 | QPtrList<Event> rawEvents( const QDate &start, const QDate &end, |
185 | bool inclusive = false ); | 185 | bool inclusive = false ); |
186 | Todo *todo( QString, QString ); | 186 | Todo *todo( QString, QString ); |
187 | Event *event( QString, QString ); | 187 | Event *event( QString, QString ); |
188 | void getIncidenceCount( int calId, int& events, int & todos, int & journals); | ||
188 | 189 | ||
189 | public slots: | 190 | public slots: |
190 | void setCalendarEnabled( int id, bool enable ); | 191 | void setCalendarEnabled( int id, bool enable ); |
191 | void setAlarmEnabled( int id, bool enable ); | 192 | void setAlarmEnabled( int id, bool enable ); |
192 | void setReadOnly( int id, bool enable ); | 193 | void setReadOnly( int id, bool enable ); |
193 | void setDefaultCalendarEnabledOnly(); | 194 | void setDefaultCalendarEnabledOnly(); |
194 | void setCalendarRemove( int id ); | 195 | void setCalendarRemove( int id ); |
195 | 196 | ||
196 | protected: | 197 | protected: |
197 | 198 | ||
198 | // Event* mNextAlarmEvent; | 199 | // Event* mNextAlarmEvent; |
199 | QString mNextSummary; | 200 | QString mNextSummary; |
200 | QString mNextAlarmEventDateTimeString; | 201 | QString mNextAlarmEventDateTimeString; |
201 | QString mLastAlarmNotificationString; | 202 | QString mLastAlarmNotificationString; |
202 | QDateTime mNextAlarmEventDateTime; | 203 | QDateTime mNextAlarmEventDateTime; |
203 | QDateTime mNextAlarmDateTime; | 204 | QDateTime mNextAlarmDateTime; |
204 | void reInitAlarmSettings(); | 205 | void reInitAlarmSettings(); |
205 | 206 | ||
206 | /** Notification function of IncidenceBase::Observer. */ | 207 | /** Notification function of IncidenceBase::Observer. */ |
207 | void incidenceUpdated( IncidenceBase *i ) { update( i ); } | 208 | void incidenceUpdated( IncidenceBase *i ) { update( i ); } |
208 | 209 | ||
209 | /** inserts an event into its "proper place" in the calendar. */ | 210 | /** inserts an event into its "proper place" in the calendar. */ |
210 | void insertEvent( Event *event ); | 211 | void insertEvent( Event *event ); |
211 | 212 | ||
212 | /** Append alarms of incidence in interval to list of alarms. */ | 213 | /** Append alarms of incidence in interval to list of alarms. */ |
213 | void appendAlarms( Alarm::List &alarms, Incidence *incidence, | 214 | void appendAlarms( Alarm::List &alarms, Incidence *incidence, |
214 | const QDateTime &from, const QDateTime &to ); | 215 | const QDateTime &from, const QDateTime &to ); |
215 | 216 | ||
216 | /** Append alarms of recurring events in interval to list of alarms. */ | 217 | /** Append alarms of recurring events in interval to list of alarms. */ |
217 | void appendRecurringAlarms( Alarm::List &alarms, Incidence *incidence, | 218 | void appendRecurringAlarms( Alarm::List &alarms, Incidence *incidence, |
218 | const QDateTime &from, const QDateTime &to ); | 219 | const QDateTime &from, const QDateTime &to ); |
219 | 220 | ||
220 | private: | 221 | private: |
221 | void init(); | 222 | void init(); |
222 | 223 | ||
223 | QPtrList<Event> mEventList; | 224 | QPtrList<Event> mEventList; |
224 | QPtrList<Todo> mTodoList; | 225 | QPtrList<Todo> mTodoList; |
225 | QPtrList<Journal> mJournalList; | 226 | QPtrList<Journal> mJournalList; |
226 | }; | 227 | }; |
227 | 228 | ||
228 | } | 229 | } |
229 | 230 | ||
230 | #endif | 231 | #endif |