-rw-r--r-- | korganizer/calendarview.cpp | 24 | ||||
-rw-r--r-- | libkcal/calendarlocal.cpp | 23 |
2 files changed, 29 insertions, 18 deletions
diff --git a/korganizer/calendarview.cpp b/korganizer/calendarview.cpp index 1800cf2..8385bcc 100644 --- a/korganizer/calendarview.cpp +++ b/korganizer/calendarview.cpp @@ -1733,4 +1733,3 @@ bool CalendarView::synchronizeCalendar( Calendar* local, Calendar* remote, int if ( inL ) { // maybe conflict - same uid in both calendars - if ( hasCalId ) - qDebug("KO: Cal id %d conflict detected: %s ", hasCalId, inL->summary().latin1()); + if ( (take = takeEvent( inL, inR, mode, fullDateRange )) > 0 ) { @@ -1746,2 +1745,3 @@ bool CalendarView::synchronizeCalendar( Calendar* local, Calendar* remote, int remote->deleteIncidence( inR ); + if ( !hasCalId ) { inR = inL->clone(); @@ -1755,2 +1755,4 @@ bool CalendarView::synchronizeCalendar( Calendar* local, Calendar* remote, int ++changedRemote; + } else + ++deletedEventR; } else {// take remote ********************** @@ -1761,3 +1763,3 @@ bool CalendarView::synchronizeCalendar( Calendar* local, Calendar* remote, int if ( hasCalId ) - calID = hasCalId; + calID = 0;// add to default calendar local->deleteIncidence( inL ); @@ -1778,6 +1780,10 @@ bool CalendarView::synchronizeCalendar( Calendar* local, Calendar* remote, int // take == 0; events equal - if ( hasCalId ) - qDebug("EV EQUALLLL **************************** "); + if ( hasCalId ) { + qDebug("KO: Changing Cal id %d to %d for : %s ", hasCalId, local->defaultCalendar(),inL->summary().latin1()); + inL->setCalID( local->defaultCalendar() ); + } } + + } else { // no conflict ********** add or delete remote @@ -2484,4 +2490,4 @@ void CalendarView::mergeFileResource( QString fn ,QString resource ) mCalendar->setCalendarRemove( exclusiveResource ); - int def = mCalendar->defaultCalendar(); mCalendar->setDefaultCalendar(exclusiveResource); + mCalendar->setAllCalendarEnabled( true ); if ( !mCalendar->addCalendarFile( fn, exclusiveResource )) { @@ -2489,7 +2495,3 @@ void CalendarView::mergeFileResource( QString fn ,QString resource ) } - mCalendar->setDefaultCalendar( def ); - mCalendar->reInitAlarmSettings(); - setSyncEventsReadOnly(); - updateUnmanagedViews(); - updateView(); + restoreCalendarSettings(); } diff --git a/libkcal/calendarlocal.cpp b/libkcal/calendarlocal.cpp index 980663f..8a5a76f 100644 --- a/libkcal/calendarlocal.cpp +++ b/libkcal/calendarlocal.cpp @@ -261,5 +261,5 @@ void CalendarLocal::addCalendar( Calendar* cal ) setSyncEventsEnabled(); + QPtrList<Incidence> incList; { QPtrList<Event> EventList = cal->rawEvents(); - QPtrList<Event> el; Event * ev = EventList.first(); @@ -267,7 +267,7 @@ void CalendarLocal::addCalendar( Calendar* cal ) 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 ); @@ -277,5 +277,3 @@ void CalendarLocal::addCalendar( Calendar* cal ) } - for ( ev = el.first(); ev; ev = el.next() ) { - deleteIncidence ( ev ); - } + } @@ -292,2 +290,5 @@ void CalendarLocal::addCalendar( Calendar* cal ) while ( ev ) { + Todo * se = todo( ev->uid() ); + if ( se ) + incList.append( se ); ev->unRegisterObserver( cal ); @@ -303,2 +304,5 @@ void CalendarLocal::addCalendar( Calendar* cal ) while ( ev ) { + Journal * se = journal( ev->uid() ); + if ( se ) + incList.append( se ); ev->unRegisterObserver( cal ); @@ -309,2 +313,7 @@ void CalendarLocal::addCalendar( Calendar* cal ) } + { + for (Incidence * ev = incList.first(); ev; ev = incList.next() ) { + deleteIncidence ( ev ); + } + } setModified( true ); |