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