From b7522a13b64225bb91bdab4a21b44282f8c3e3b4 Mon Sep 17 00:00:00 2001 From: zautrix Date: Mon, 28 Nov 2005 03:27:16 +0000 Subject: sync --- (limited to 'libkcal') 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 ) { cal->setDontDeleteIncidencesOnClose(); setSyncEventsEnabled(); + QPtrList incList; { QPtrList EventList = cal->rawEvents(); - QPtrList 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 ); + if ( ev->uid().left( 15 ) == QString("last-syncEvent-") ) { ev->setCalID_block( 1 ); } + Event * se = event( ev->uid() ); + if ( se ) + incList.append( se ); ev->unRegisterObserver( cal ); ev->registerObserver( this ); mEventList.append( ev ); ev = EventList.next(); } - for ( ev = el.first(); ev; ev = el.next() ) { - deleteIncidence ( ev ); - } + } { @@ -289,7 +287,10 @@ void CalendarLocal::addCalendar( Calendar* cal ) } //TodoList = cal->rawTodos(); ev = TodoList.first(); - while ( ev ) { + while ( ev ) { + Todo * se = todo( ev->uid() ); + if ( se ) + incList.append( se ); ev->unRegisterObserver( cal ); ev->registerObserver( this ); mTodoList.append( ev ); @@ -301,12 +302,20 @@ void CalendarLocal::addCalendar( Calendar* cal ) QPtrList JournalList = cal->journals(); Journal * ev = JournalList.first(); while ( ev ) { + Journal * se = journal( ev->uid() ); + if ( se ) + incList.append( se ); ev->unRegisterObserver( cal ); ev->registerObserver( this ); mJournalList.append( ev ); ev = JournalList.next(); } } + { + for (Incidence * ev = incList.first(); ev; ev = incList.next() ) { + deleteIncidence ( ev ); + } + } setModified( true ); } bool CalendarLocal::load( const QString &fileName ) -- cgit v0.9.0.2