-rw-r--r-- | libkcal/calendarlocal.cpp | 27 |
1 files changed, 18 insertions, 9 deletions
diff --git a/libkcal/calendarlocal.cpp b/libkcal/calendarlocal.cpp index 980663f..8a5a76f 100644 --- a/libkcal/calendarlocal.cpp +++ b/libkcal/calendarlocal.cpp | |||
@@ -259,25 +259,23 @@ void CalendarLocal::addCalendar( Calendar* cal ) | |||
259 | { | 259 | { |
260 | cal->setDontDeleteIncidencesOnClose(); | 260 | cal->setDontDeleteIncidencesOnClose(); |
261 | setSyncEventsEnabled(); | 261 | setSyncEventsEnabled(); |
262 | QPtrList<Incidence> incList; | ||
262 | { | 263 | { |
263 | QPtrList<Event> EventList = cal->rawEvents(); | 264 | QPtrList<Event> EventList = cal->rawEvents(); |
264 | QPtrList<Event> el; | ||
265 | Event * ev = EventList.first(); | 265 | Event * ev = EventList.first(); |
266 | while ( ev ) { | 266 | while ( ev ) { |
267 | if ( ev->uid().left( 15 ) == QString("last-syncEvent-") ) { | 267 | if ( ev->uid().left( 15 ) == QString("last-syncEvent-") ) { |
268 | Event * se = event( ev->uid() ); | ||
269 | if ( se ) | ||
270 | el.append( se ); | ||
271 | ev->setCalID_block( 1 ); | 268 | ev->setCalID_block( 1 ); |
272 | } | 269 | } |
270 | Event * se = event( ev->uid() ); | ||
271 | if ( se ) | ||
272 | incList.append( se ); | ||
273 | ev->unRegisterObserver( cal ); | 273 | ev->unRegisterObserver( cal ); |
274 | ev->registerObserver( this ); | 274 | ev->registerObserver( this ); |
275 | mEventList.append( ev ); | 275 | mEventList.append( ev ); |
276 | ev = EventList.next(); | 276 | ev = EventList.next(); |
277 | } | 277 | } |
278 | for ( ev = el.first(); ev; ev = el.next() ) { | 278 | |
279 | deleteIncidence ( ev ); | ||
280 | } | ||
281 | } | 279 | } |
282 | { | 280 | { |
283 | 281 | ||
@@ -289,7 +287,10 @@ void CalendarLocal::addCalendar( Calendar* cal ) | |||
289 | } | 287 | } |
290 | //TodoList = cal->rawTodos(); | 288 | //TodoList = cal->rawTodos(); |
291 | ev = TodoList.first(); | 289 | ev = TodoList.first(); |
292 | while ( ev ) { | 290 | while ( ev ) { |
291 | Todo * se = todo( ev->uid() ); | ||
292 | if ( se ) | ||
293 | incList.append( se ); | ||
293 | ev->unRegisterObserver( cal ); | 294 | ev->unRegisterObserver( cal ); |
294 | ev->registerObserver( this ); | 295 | ev->registerObserver( this ); |
295 | mTodoList.append( ev ); | 296 | mTodoList.append( ev ); |
@@ -301,12 +302,20 @@ void CalendarLocal::addCalendar( Calendar* cal ) | |||
301 | QPtrList<Journal> JournalList = cal->journals(); | 302 | QPtrList<Journal> JournalList = cal->journals(); |
302 | Journal * ev = JournalList.first(); | 303 | Journal * ev = JournalList.first(); |
303 | while ( ev ) { | 304 | while ( ev ) { |
305 | Journal * se = journal( ev->uid() ); | ||
306 | if ( se ) | ||
307 | incList.append( se ); | ||
304 | ev->unRegisterObserver( cal ); | 308 | ev->unRegisterObserver( cal ); |
305 | ev->registerObserver( this ); | 309 | ev->registerObserver( this ); |
306 | mJournalList.append( ev ); | 310 | mJournalList.append( ev ); |
307 | ev = JournalList.next(); | 311 | ev = JournalList.next(); |
308 | } | 312 | } |
309 | } | 313 | } |
314 | { | ||
315 | for (Incidence * ev = incList.first(); ev; ev = incList.next() ) { | ||
316 | deleteIncidence ( ev ); | ||
317 | } | ||
318 | } | ||
310 | setModified( true ); | 319 | setModified( true ); |
311 | } | 320 | } |
312 | bool CalendarLocal::load( const QString &fileName ) | 321 | bool CalendarLocal::load( const QString &fileName ) |