-rw-r--r-- | libkcal/calendarlocal.cpp | 23 |
1 files changed, 16 insertions, 7 deletions
diff --git a/libkcal/calendarlocal.cpp b/libkcal/calendarlocal.cpp index 980663f..8a5a76f 100644 --- a/libkcal/calendarlocal.cpp +++ b/libkcal/calendarlocal.cpp @@ -260,15 +260,15 @@ void CalendarLocal::addCalendar( Calendar* cal ) cal->setDontDeleteIncidencesOnClose(); setSyncEventsEnabled(); + QPtrList<Incidence> incList; { QPtrList<Event> EventList = cal->rawEvents(); - QPtrList<Event> el; Event * ev = EventList.first(); while ( ev ) { if ( ev->uid().left( 15 ) == QString("last-syncEvent-") ) { - Event * se = event( ev->uid() ); - if ( se ) - el.append( se ); ev->setCalID_block( 1 ); } + Event * se = event( ev->uid() ); + if ( se ) + incList.append( se ); ev->unRegisterObserver( cal ); ev->registerObserver( this ); @@ -276,7 +276,5 @@ void CalendarLocal::addCalendar( Calendar* cal ) ev = EventList.next(); } - for ( ev = el.first(); ev; ev = el.next() ) { - deleteIncidence ( ev ); - } + } { @@ -291,4 +289,7 @@ void CalendarLocal::addCalendar( Calendar* cal ) ev = TodoList.first(); while ( ev ) { + Todo * se = todo( ev->uid() ); + if ( se ) + incList.append( se ); ev->unRegisterObserver( cal ); ev->registerObserver( this ); @@ -302,4 +303,7 @@ void CalendarLocal::addCalendar( Calendar* cal ) Journal * ev = JournalList.first(); while ( ev ) { + Journal * se = journal( ev->uid() ); + if ( se ) + incList.append( se ); ev->unRegisterObserver( cal ); ev->registerObserver( this ); @@ -308,4 +312,9 @@ void CalendarLocal::addCalendar( Calendar* cal ) } } + { + for (Incidence * ev = incList.first(); ev; ev = incList.next() ) { + deleteIncidence ( ev ); + } + } setModified( true ); } |