author | zautrix <zautrix> | 2004-10-26 22:19:18 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2004-10-26 22:19:18 (UTC) |
commit | 6385f303bef3cbcd19d097a7b05c30e144d5dd6e (patch) (unidiff) | |
tree | 770795d94ea6ec1dc8bcaa67cc174a9c0add564a /libkcal | |
parent | 13e996beddabc5e88f4f2fe49b2ce6cb8408eb30 (diff) | |
download | kdepimpi-6385f303bef3cbcd19d097a7b05c30e144d5dd6e.zip kdepimpi-6385f303bef3cbcd19d097a7b05c30e144d5dd6e.tar.gz kdepimpi-6385f303bef3cbcd19d097a7b05c30e144d5dd6e.tar.bz2 |
implemented remove sync info for kopi and kapi
-rw-r--r-- | libkcal/calendar.h | 1 | ||||
-rw-r--r-- | libkcal/calendarlocal.cpp | 23 | ||||
-rw-r--r-- | libkcal/calendarlocal.h | 1 | ||||
-rw-r--r-- | libkcal/incidencebase.cpp | 5 |
4 files changed, 28 insertions, 2 deletions
diff --git a/libkcal/calendar.h b/libkcal/calendar.h index b801186..b7d6a1f 100644 --- a/libkcal/calendar.h +++ b/libkcal/calendar.h | |||
@@ -17,128 +17,129 @@ | |||
17 | along with this library; see the file COPYING.LIB. If not, write to | 17 | along with this library; see the file COPYING.LIB. If not, write to |
18 | the Free Software Foundation, Inc., 59 Temple Place - Suite 330, | 18 | the Free Software Foundation, Inc., 59 Temple Place - Suite 330, |
19 | Boston, MA 02111-1307, USA. | 19 | Boston, MA 02111-1307, USA. |
20 | */ | 20 | */ |
21 | 21 | ||
22 | #ifndef CALENDAR_H | 22 | #ifndef CALENDAR_H |
23 | #define CALENDAR_H | 23 | #define CALENDAR_H |
24 | 24 | ||
25 | #include <qobject.h> | 25 | #include <qobject.h> |
26 | #include <qstring.h> | 26 | #include <qstring.h> |
27 | #include <qdatetime.h> | 27 | #include <qdatetime.h> |
28 | #include <qptrlist.h> | 28 | #include <qptrlist.h> |
29 | #include <qdict.h> | 29 | #include <qdict.h> |
30 | 30 | ||
31 | #include "customproperties.h" | 31 | #include "customproperties.h" |
32 | #include "event.h" | 32 | #include "event.h" |
33 | #include "todo.h" | 33 | #include "todo.h" |
34 | #include "journal.h" | 34 | #include "journal.h" |
35 | #include "calfilter.h" | 35 | #include "calfilter.h" |
36 | 36 | ||
37 | //#define _TIME_ZONE "-0500" /* hardcoded, overridden in config file. */ | 37 | //#define _TIME_ZONE "-0500" /* hardcoded, overridden in config file. */ |
38 | 38 | ||
39 | class KConfig; | 39 | class KConfig; |
40 | 40 | ||
41 | namespace KCal { | 41 | namespace KCal { |
42 | 42 | ||
43 | 43 | ||
44 | /** | 44 | /** |
45 | This is the main "calendar" object class for KOrganizer. It holds | 45 | This is the main "calendar" object class for KOrganizer. It holds |
46 | information like all appointments/events, user information, etc. etc. | 46 | information like all appointments/events, user information, etc. etc. |
47 | one calendar is associated with each CalendarView (@see calendarview.h). | 47 | one calendar is associated with each CalendarView (@see calendarview.h). |
48 | This is an abstract base class defining the interface to a calendar. It is | 48 | This is an abstract base class defining the interface to a calendar. It is |
49 | implemented by subclasses like @see CalendarLocal, which use different | 49 | implemented by subclasses like @see CalendarLocal, which use different |
50 | methods to store and access the data. | 50 | methods to store and access the data. |
51 | 51 | ||
52 | Ownership of events etc. is handled by the following policy: As soon as an | 52 | Ownership of events etc. is handled by the following policy: As soon as an |
53 | event (or any other subclass of IncidenceBase) object is added to the | 53 | event (or any other subclass of IncidenceBase) object is added to the |
54 | Calendar by addEvent() it is owned by the Calendar object. The Calendar takes | 54 | Calendar by addEvent() it is owned by the Calendar object. The Calendar takes |
55 | care of deleting it. All Events returned by the query functions are returned | 55 | care of deleting it. All Events returned by the query functions are returned |
56 | as pointers, that means all changes to the returned events are immediately | 56 | as pointers, that means all changes to the returned events are immediately |
57 | visible in the Calendar. You shouldn't delete any Event object you get from | 57 | visible in the Calendar. You shouldn't delete any Event object you get from |
58 | Calendar. | 58 | Calendar. |
59 | */ | 59 | */ |
60 | class Calendar : public QObject, public CustomProperties, | 60 | class Calendar : public QObject, public CustomProperties, |
61 | public IncidenceBase::Observer | 61 | public IncidenceBase::Observer |
62 | { | 62 | { |
63 | Q_OBJECT | 63 | Q_OBJECT |
64 | public: | 64 | public: |
65 | Calendar(); | 65 | Calendar(); |
66 | Calendar(const QString &timeZoneId); | 66 | Calendar(const QString &timeZoneId); |
67 | virtual ~Calendar(); | 67 | virtual ~Calendar(); |
68 | void deleteIncidence(Incidence *in); | 68 | void deleteIncidence(Incidence *in); |
69 | void resetTempSyncStat(); | 69 | void resetTempSyncStat(); |
70 | void resetPilotStat(int id); | 70 | void resetPilotStat(int id); |
71 | /** | 71 | /** |
72 | Clears out the current calendar, freeing all used memory etc. | 72 | Clears out the current calendar, freeing all used memory etc. |
73 | */ | 73 | */ |
74 | virtual void close() = 0; | 74 | virtual void close() = 0; |
75 | 75 | ||
76 | /** | 76 | /** |
77 | Sync changes in memory to persistant storage. | 77 | Sync changes in memory to persistant storage. |
78 | */ | 78 | */ |
79 | virtual void save() = 0; | 79 | virtual void save() = 0; |
80 | virtual QPtrList<Event> getExternLastSyncEvents() = 0; | 80 | virtual QPtrList<Event> getExternLastSyncEvents() = 0; |
81 | virtual void removeSyncInfo( QString syncProfile) = 0; | ||
81 | virtual bool isSaving() { return false; } | 82 | virtual bool isSaving() { return false; } |
82 | 83 | ||
83 | /** | 84 | /** |
84 | Return the owner of the calendar's full name. | 85 | Return the owner of the calendar's full name. |
85 | */ | 86 | */ |
86 | const QString &getOwner() const; | 87 | const QString &getOwner() const; |
87 | /** | 88 | /** |
88 | Set the owner of the calendar. Should be owner's full name. | 89 | Set the owner of the calendar. Should be owner's full name. |
89 | */ | 90 | */ |
90 | void setOwner( const QString &os ); | 91 | void setOwner( const QString &os ); |
91 | /** | 92 | /** |
92 | Return the email address of the calendar owner. | 93 | Return the email address of the calendar owner. |
93 | */ | 94 | */ |
94 | const QString &getEmail(); | 95 | const QString &getEmail(); |
95 | /** | 96 | /** |
96 | Set the email address of the calendar owner. | 97 | Set the email address of the calendar owner. |
97 | */ | 98 | */ |
98 | void setEmail( const QString & ); | 99 | void setEmail( const QString & ); |
99 | 100 | ||
100 | /** | 101 | /** |
101 | Set time zone from a timezone string (e.g. -2:00) | 102 | Set time zone from a timezone string (e.g. -2:00) |
102 | */ | 103 | */ |
103 | void setTimeZone( const QString &tz ); | 104 | void setTimeZone( const QString &tz ); |
104 | /** | 105 | /** |
105 | Set time zone from a minutes value (e.g. -60) | 106 | Set time zone from a minutes value (e.g. -60) |
106 | */ | 107 | */ |
107 | void setTimeZone( int tz ); | 108 | void setTimeZone( int tz ); |
108 | /** | 109 | /** |
109 | Return time zone as offest in minutes. | 110 | Return time zone as offest in minutes. |
110 | */ | 111 | */ |
111 | int getTimeZone() const; | 112 | int getTimeZone() const; |
112 | /** | 113 | /** |
113 | Compute an ISO 8601 format string from the time zone. | 114 | Compute an ISO 8601 format string from the time zone. |
114 | */ | 115 | */ |
115 | QString getTimeZoneStr() const; | 116 | QString getTimeZoneStr() const; |
116 | /** | 117 | /** |
117 | Set time zone id (see /usr/share/zoneinfo/zone.tab for list of legal | 118 | Set time zone id (see /usr/share/zoneinfo/zone.tab for list of legal |
118 | values). | 119 | values). |
119 | */ | 120 | */ |
120 | void setTimeZoneId( const QString & ); | 121 | void setTimeZoneId( const QString & ); |
121 | /** | 122 | /** |
122 | Return time zone id. | 123 | Return time zone id. |
123 | */ | 124 | */ |
124 | QString timeZoneId() const; | 125 | QString timeZoneId() const; |
125 | /** | 126 | /** |
126 | Use local time, not UTC or a time zone. | 127 | Use local time, not UTC or a time zone. |
127 | */ | 128 | */ |
128 | void setLocalTime(); | 129 | void setLocalTime(); |
129 | /** | 130 | /** |
130 | Return whether local time is being used. | 131 | Return whether local time is being used. |
131 | */ | 132 | */ |
132 | bool isLocalTime() const; | 133 | bool isLocalTime() const; |
133 | 134 | ||
134 | /** | 135 | /** |
135 | Add an incidence to calendar. | 136 | Add an incidence to calendar. |
136 | 137 | ||
137 | @return true on success, false on error. | 138 | @return true on success, false on error. |
138 | */ | 139 | */ |
139 | virtual bool addIncidence( Incidence * ); | 140 | virtual bool addIncidence( Incidence * ); |
140 | /** | 141 | /** |
141 | Return filtered list of all incidences of this calendar. | 142 | Return filtered list of all incidences of this calendar. |
142 | */ | 143 | */ |
143 | virtual QPtrList<Incidence> incidences(); | 144 | virtual QPtrList<Incidence> incidences(); |
144 | 145 | ||
diff --git a/libkcal/calendarlocal.cpp b/libkcal/calendarlocal.cpp index 21b4aaf..3f46d53 100644 --- a/libkcal/calendarlocal.cpp +++ b/libkcal/calendarlocal.cpp | |||
@@ -160,129 +160,150 @@ void CalendarLocal::deleteEvent( Event *event ) | |||
160 | } | 160 | } |
161 | 161 | ||
162 | 162 | ||
163 | Event *CalendarLocal::event( const QString &uid ) | 163 | Event *CalendarLocal::event( const QString &uid ) |
164 | { | 164 | { |
165 | 165 | ||
166 | Event *event; | 166 | Event *event; |
167 | 167 | ||
168 | for ( event = mEventList.first(); event; event = mEventList.next() ) { | 168 | for ( event = mEventList.first(); event; event = mEventList.next() ) { |
169 | if ( event->uid() == uid ) { | 169 | if ( event->uid() == uid ) { |
170 | return event; | 170 | return event; |
171 | } | 171 | } |
172 | } | 172 | } |
173 | 173 | ||
174 | return 0; | 174 | return 0; |
175 | } | 175 | } |
176 | bool CalendarLocal::addTodoNoDup( Todo *todo ) | 176 | bool CalendarLocal::addTodoNoDup( Todo *todo ) |
177 | { | 177 | { |
178 | Todo * eve; | 178 | Todo * eve; |
179 | for ( eve = mTodoList.first(); eve ; eve = mTodoList.next() ) { | 179 | for ( eve = mTodoList.first(); eve ; eve = mTodoList.next() ) { |
180 | if ( *eve == *todo ) { | 180 | if ( *eve == *todo ) { |
181 | //qDebug("duplicate todo found! not inserted! "); | 181 | //qDebug("duplicate todo found! not inserted! "); |
182 | return false; | 182 | return false; |
183 | } | 183 | } |
184 | } | 184 | } |
185 | return addTodo( todo ); | 185 | return addTodo( todo ); |
186 | } | 186 | } |
187 | bool CalendarLocal::addTodo( Todo *todo ) | 187 | bool CalendarLocal::addTodo( Todo *todo ) |
188 | { | 188 | { |
189 | mTodoList.append( todo ); | 189 | mTodoList.append( todo ); |
190 | 190 | ||
191 | todo->registerObserver( this ); | 191 | todo->registerObserver( this ); |
192 | 192 | ||
193 | // Set up subtask relations | 193 | // Set up subtask relations |
194 | setupRelations( todo ); | 194 | setupRelations( todo ); |
195 | 195 | ||
196 | setModified( true ); | 196 | setModified( true ); |
197 | 197 | ||
198 | return true; | 198 | return true; |
199 | } | 199 | } |
200 | 200 | ||
201 | void CalendarLocal::deleteTodo( Todo *todo ) | 201 | void CalendarLocal::deleteTodo( Todo *todo ) |
202 | { | 202 | { |
203 | // Handle orphaned children | 203 | // Handle orphaned children |
204 | removeRelations( todo ); | 204 | removeRelations( todo ); |
205 | 205 | ||
206 | if ( mTodoList.removeRef( todo ) ) { | 206 | if ( mTodoList.removeRef( todo ) ) { |
207 | setModified( true ); | 207 | setModified( true ); |
208 | } | 208 | } |
209 | } | 209 | } |
210 | 210 | ||
211 | QPtrList<Todo> CalendarLocal::rawTodos() | 211 | QPtrList<Todo> CalendarLocal::rawTodos() |
212 | { | 212 | { |
213 | return mTodoList; | 213 | return mTodoList; |
214 | } | 214 | } |
215 | Todo *CalendarLocal::todo( QString syncProf, QString id ) | 215 | Todo *CalendarLocal::todo( QString syncProf, QString id ) |
216 | { | 216 | { |
217 | Todo *todo; | 217 | Todo *todo; |
218 | for ( todo = mTodoList.first(); todo; todo = mTodoList.next() ) { | 218 | for ( todo = mTodoList.first(); todo; todo = mTodoList.next() ) { |
219 | if ( todo->getID( syncProf ) == id ) return todo; | 219 | if ( todo->getID( syncProf ) == id ) return todo; |
220 | } | 220 | } |
221 | 221 | ||
222 | return 0; | 222 | return 0; |
223 | } | 223 | } |
224 | 224 | void CalendarLocal::removeSyncInfo( QString syncProfile) | |
225 | { | ||
226 | QPtrList<Incidence> all = rawIncidences() ; | ||
227 | Incidence *inc; | ||
228 | for ( inc = all.first(); inc; inc = all.next() ) { | ||
229 | inc->removeID( syncProfile ); | ||
230 | } | ||
231 | if ( syncProfile.isEmpty() ) { | ||
232 | QPtrList<Event> el; | ||
233 | Event *todo; | ||
234 | for ( todo = mEventList.first(); todo; todo = mEventList.next() ) { | ||
235 | if ( todo->uid().left( 15 ) == QString("last-syncEvent-") ) | ||
236 | el.append( todo ); | ||
237 | } | ||
238 | for ( todo = el.first(); todo; todo = el.next() ) { | ||
239 | deleteIncidence ( todo ); | ||
240 | } | ||
241 | } else { | ||
242 | Event *lse = event( "last-syncEvent-"+ syncProfile); | ||
243 | deleteIncidence ( lse ); | ||
244 | } | ||
245 | } | ||
225 | QPtrList<Event> CalendarLocal::getExternLastSyncEvents() | 246 | QPtrList<Event> CalendarLocal::getExternLastSyncEvents() |
226 | { | 247 | { |
227 | QPtrList<Event> el; | 248 | QPtrList<Event> el; |
228 | Event *todo; | 249 | Event *todo; |
229 | for ( todo = mEventList.first(); todo; todo = mEventList.next() ) { | 250 | for ( todo = mEventList.first(); todo; todo = mEventList.next() ) { |
230 | if ( todo->uid().left( 15 ) == QString("last-syncEvent-") ) | 251 | if ( todo->uid().left( 15 ) == QString("last-syncEvent-") ) |
231 | if ( todo->summary().left(3) == "E: " ) | 252 | if ( todo->summary().left(3) == "E: " ) |
232 | el.append( todo ); | 253 | el.append( todo ); |
233 | } | 254 | } |
234 | 255 | ||
235 | return el; | 256 | return el; |
236 | 257 | ||
237 | } | 258 | } |
238 | Event *CalendarLocal::event( QString syncProf, QString id ) | 259 | Event *CalendarLocal::event( QString syncProf, QString id ) |
239 | { | 260 | { |
240 | Event *todo; | 261 | Event *todo; |
241 | for ( todo = mEventList.first(); todo; todo = mEventList.next() ) { | 262 | for ( todo = mEventList.first(); todo; todo = mEventList.next() ) { |
242 | if ( todo->getID( syncProf ) == id ) return todo; | 263 | if ( todo->getID( syncProf ) == id ) return todo; |
243 | } | 264 | } |
244 | 265 | ||
245 | return 0; | 266 | return 0; |
246 | } | 267 | } |
247 | Todo *CalendarLocal::todo( const QString &uid ) | 268 | Todo *CalendarLocal::todo( const QString &uid ) |
248 | { | 269 | { |
249 | Todo *todo; | 270 | Todo *todo; |
250 | for ( todo = mTodoList.first(); todo; todo = mTodoList.next() ) { | 271 | for ( todo = mTodoList.first(); todo; todo = mTodoList.next() ) { |
251 | if ( todo->uid() == uid ) return todo; | 272 | if ( todo->uid() == uid ) return todo; |
252 | } | 273 | } |
253 | 274 | ||
254 | return 0; | 275 | return 0; |
255 | } | 276 | } |
256 | QString CalendarLocal::nextSummary() const | 277 | QString CalendarLocal::nextSummary() const |
257 | { | 278 | { |
258 | return mNextSummary; | 279 | return mNextSummary; |
259 | } | 280 | } |
260 | QDateTime CalendarLocal::nextAlarmEventDateTime() const | 281 | QDateTime CalendarLocal::nextAlarmEventDateTime() const |
261 | { | 282 | { |
262 | return mNextAlarmEventDateTime; | 283 | return mNextAlarmEventDateTime; |
263 | } | 284 | } |
264 | void CalendarLocal::checkAlarmForIncidence( Incidence * incidence, bool deleted) | 285 | void CalendarLocal::checkAlarmForIncidence( Incidence * incidence, bool deleted) |
265 | { | 286 | { |
266 | //mNextAlarmIncidence | 287 | //mNextAlarmIncidence |
267 | //mNextAlarmDateTime | 288 | //mNextAlarmDateTime |
268 | //return mNextSummary; | 289 | //return mNextSummary; |
269 | //return mNextAlarmEventDateTime; | 290 | //return mNextAlarmEventDateTime; |
270 | bool newNextAlarm = false; | 291 | bool newNextAlarm = false; |
271 | bool computeNextAlarm = false; | 292 | bool computeNextAlarm = false; |
272 | bool ok; | 293 | bool ok; |
273 | int offset; | 294 | int offset; |
274 | QDateTime nextA; | 295 | QDateTime nextA; |
275 | // QString nextSum; | 296 | // QString nextSum; |
276 | //QDateTime nextEvent; | 297 | //QDateTime nextEvent; |
277 | if ( mNextAlarmIncidence == 0 || incidence == 0 ) { | 298 | if ( mNextAlarmIncidence == 0 || incidence == 0 ) { |
278 | computeNextAlarm = true; | 299 | computeNextAlarm = true; |
279 | } else { | 300 | } else { |
280 | if ( ! deleted ) { | 301 | if ( ! deleted ) { |
281 | nextA = incidence->getNextAlarmDateTime(& ok, &offset ) ; | 302 | nextA = incidence->getNextAlarmDateTime(& ok, &offset ) ; |
282 | if ( ok ) { | 303 | if ( ok ) { |
283 | if ( nextA < mNextAlarmDateTime ) { | 304 | if ( nextA < mNextAlarmDateTime ) { |
284 | deRegisterAlarm(); | 305 | deRegisterAlarm(); |
285 | mNextAlarmDateTime = nextA; | 306 | mNextAlarmDateTime = nextA; |
286 | mNextSummary = incidence->summary(); | 307 | mNextSummary = incidence->summary(); |
287 | mNextAlarmEventDateTime = nextA.addSecs(offset ) ; | 308 | mNextAlarmEventDateTime = nextA.addSecs(offset ) ; |
288 | mNextAlarmEventDateTimeString = KGlobal::locale()->formatDateTime(mNextAlarmEventDateTime); | 309 | mNextAlarmEventDateTimeString = KGlobal::locale()->formatDateTime(mNextAlarmEventDateTime); |
diff --git a/libkcal/calendarlocal.h b/libkcal/calendarlocal.h index 5b6c64c..98ec710 100644 --- a/libkcal/calendarlocal.h +++ b/libkcal/calendarlocal.h | |||
@@ -8,128 +8,129 @@ | |||
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. |
diff --git a/libkcal/incidencebase.cpp b/libkcal/incidencebase.cpp index b36dc1a..9aa517c 100644 --- a/libkcal/incidencebase.cpp +++ b/libkcal/incidencebase.cpp | |||
@@ -292,116 +292,119 @@ Attendee *IncidenceBase::attendeeByMails(const QStringList &emails, const QStrin | |||
292 | if (qli.current()->email().lower() == (*it).lower()) | 292 | if (qli.current()->email().lower() == (*it).lower()) |
293 | return qli.current(); | 293 | return qli.current(); |
294 | } | 294 | } |
295 | 295 | ||
296 | ++qli; | 296 | ++qli; |
297 | } | 297 | } |
298 | return 0L; | 298 | return 0L; |
299 | } | 299 | } |
300 | 300 | ||
301 | void IncidenceBase::setDuration(int seconds) | 301 | void IncidenceBase::setDuration(int seconds) |
302 | { | 302 | { |
303 | mDuration = seconds; | 303 | mDuration = seconds; |
304 | setHasDuration(true); | 304 | setHasDuration(true); |
305 | } | 305 | } |
306 | 306 | ||
307 | int IncidenceBase::duration() const | 307 | int IncidenceBase::duration() const |
308 | { | 308 | { |
309 | return mDuration; | 309 | return mDuration; |
310 | } | 310 | } |
311 | 311 | ||
312 | void IncidenceBase::setHasDuration(bool b) | 312 | void IncidenceBase::setHasDuration(bool b) |
313 | { | 313 | { |
314 | mHasDuration = b; | 314 | mHasDuration = b; |
315 | } | 315 | } |
316 | 316 | ||
317 | bool IncidenceBase::hasDuration() const | 317 | bool IncidenceBase::hasDuration() const |
318 | { | 318 | { |
319 | return mHasDuration; | 319 | return mHasDuration; |
320 | } | 320 | } |
321 | 321 | ||
322 | void IncidenceBase::setSyncStatus(int stat) | 322 | void IncidenceBase::setSyncStatus(int stat) |
323 | { | 323 | { |
324 | if (mReadOnly) return; | 324 | if (mReadOnly) return; |
325 | mSyncStatus = stat; | 325 | mSyncStatus = stat; |
326 | } | 326 | } |
327 | 327 | ||
328 | int IncidenceBase::syncStatus() const | 328 | int IncidenceBase::syncStatus() const |
329 | { | 329 | { |
330 | return mSyncStatus; | 330 | return mSyncStatus; |
331 | } | 331 | } |
332 | 332 | ||
333 | void IncidenceBase::setPilotId( int id ) | 333 | void IncidenceBase::setPilotId( int id ) |
334 | { | 334 | { |
335 | if (mReadOnly) return; | 335 | if (mReadOnly) return; |
336 | mPilotId = id; | 336 | mPilotId = id; |
337 | } | 337 | } |
338 | 338 | ||
339 | int IncidenceBase::pilotId() const | 339 | int IncidenceBase::pilotId() const |
340 | { | 340 | { |
341 | return mPilotId; | 341 | return mPilotId; |
342 | } | 342 | } |
343 | 343 | ||
344 | int IncidenceBase::tempSyncStat() const | 344 | int IncidenceBase::tempSyncStat() const |
345 | { | 345 | { |
346 | return mTempSyncStat; | 346 | return mTempSyncStat; |
347 | } | 347 | } |
348 | void IncidenceBase::setTempSyncStat( int id ) | 348 | void IncidenceBase::setTempSyncStat( int id ) |
349 | { | 349 | { |
350 | if (mReadOnly) return; | 350 | if (mReadOnly) return; |
351 | mTempSyncStat = id; | 351 | mTempSyncStat = id; |
352 | } | 352 | } |
353 | 353 | ||
354 | void IncidenceBase::removeID(const QString &prof) | 354 | void IncidenceBase::removeID(const QString &prof) |
355 | { | 355 | { |
356 | mExternalId = KIdManager::removeId ( mExternalId, prof); | 356 | if ( prof.isEmpty() ) |
357 | mExternalId = ":"; | ||
358 | else | ||
359 | mExternalId = KIdManager::removeId ( mExternalId, prof); | ||
357 | 360 | ||
358 | } | 361 | } |
359 | void IncidenceBase::setID( const QString & prof , const QString & id ) | 362 | void IncidenceBase::setID( const QString & prof , const QString & id ) |
360 | { | 363 | { |
361 | mExternalId = KIdManager::setId ( mExternalId, prof, id ); | 364 | mExternalId = KIdManager::setId ( mExternalId, prof, id ); |
362 | } | 365 | } |
363 | QString IncidenceBase::getID( const QString & prof) | 366 | QString IncidenceBase::getID( const QString & prof) |
364 | { | 367 | { |
365 | return KIdManager::getId ( mExternalId, prof ); | 368 | return KIdManager::getId ( mExternalId, prof ); |
366 | } | 369 | } |
367 | 370 | ||
368 | // example :Sharp_DTM;22;23566:TP;-1;8654:TPP;18;0: | 371 | // example :Sharp_DTM;22;23566:TP;-1;8654:TPP;18;0: |
369 | // format name;III;JJJ: III >= 0, may be -1. JJJ always >= 0 | 372 | // format name;III;JJJ: III >= 0, may be -1. JJJ always >= 0 |
370 | void IncidenceBase::setCsum( const QString & prof , const QString & id ) | 373 | void IncidenceBase::setCsum( const QString & prof , const QString & id ) |
371 | { | 374 | { |
372 | mExternalId = KIdManager::setCsum ( mExternalId, prof, id ); | 375 | mExternalId = KIdManager::setCsum ( mExternalId, prof, id ); |
373 | } | 376 | } |
374 | QString IncidenceBase::getCsum( const QString & prof) | 377 | QString IncidenceBase::getCsum( const QString & prof) |
375 | { | 378 | { |
376 | return KIdManager::getCsum ( mExternalId, prof ); | 379 | return KIdManager::getCsum ( mExternalId, prof ); |
377 | } | 380 | } |
378 | 381 | ||
379 | void IncidenceBase::setIDStr( const QString & s ) | 382 | void IncidenceBase::setIDStr( const QString & s ) |
380 | { | 383 | { |
381 | if (mReadOnly) return; | 384 | if (mReadOnly) return; |
382 | mExternalId = s; | 385 | mExternalId = s; |
383 | } | 386 | } |
384 | 387 | ||
385 | QString IncidenceBase::IDStr() const | 388 | QString IncidenceBase::IDStr() const |
386 | { | 389 | { |
387 | return mExternalId ; | 390 | return mExternalId ; |
388 | } | 391 | } |
389 | void IncidenceBase::registerObserver( IncidenceBase::Observer *observer ) | 392 | void IncidenceBase::registerObserver( IncidenceBase::Observer *observer ) |
390 | { | 393 | { |
391 | if( !mObservers.contains(observer) ) mObservers.append( observer ); | 394 | if( !mObservers.contains(observer) ) mObservers.append( observer ); |
392 | } | 395 | } |
393 | 396 | ||
394 | void IncidenceBase::unRegisterObserver( IncidenceBase::Observer *observer ) | 397 | void IncidenceBase::unRegisterObserver( IncidenceBase::Observer *observer ) |
395 | { | 398 | { |
396 | mObservers.remove( observer ); | 399 | mObservers.remove( observer ); |
397 | } | 400 | } |
398 | 401 | ||
399 | void IncidenceBase::updated() | 402 | void IncidenceBase::updated() |
400 | { | 403 | { |
401 | QPtrListIterator<Observer> it(mObservers); | 404 | QPtrListIterator<Observer> it(mObservers); |
402 | while( it.current() ) { | 405 | while( it.current() ) { |
403 | Observer *o = it.current(); | 406 | Observer *o = it.current(); |
404 | ++it; | 407 | ++it; |
405 | o->incidenceUpdated( this ); | 408 | o->incidenceUpdated( this ); |
406 | } | 409 | } |
407 | } | 410 | } |