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