-rw-r--r-- | korganizer/calendarview.cpp | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/korganizer/calendarview.cpp b/korganizer/calendarview.cpp index 8d024c1..1800cf2 100644 --- a/korganizer/calendarview.cpp +++ b/korganizer/calendarview.cpp @@ -1601,12 +1601,13 @@ void CalendarView::checkExternSyncEvent( QPtrList<Event> lastSync , Incidence* t void CalendarView::checkExternalId( Incidence * inc ) { QPtrList<Event> lastSync = mCalendar->getExternLastSyncEvents() ; checkExternSyncEvent( lastSync, inc ); } +// SSSSSSSSSSSSSSSSSSSSSS bool CalendarView::synchronizeCalendar( Calendar* local, Calendar* remote, int mode ) { bool syncOK = true; int addedEvent = 0; int addedEventR = 0; @@ -1720,14 +1721,21 @@ bool CalendarView::synchronizeCalendar( Calendar* local, Calendar* remote, int bool skipIncidence = false; if ( uid.left(15) == QString("last-syncEvent-") ) skipIncidence = true; QString idS; qApp->processEvents(); if ( !skipIncidence ) { - inL = local->incidenceForUid( uid , false , true ); + int hasCalId = 0; + inL = local->incidenceForUid( uid , false , true, &hasCalId ); + if ( hasCalId && !inL ) + inL = local->incidenceForUid( uid , false , true, &hasCalId ); + else + hasCalId = 0; 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 ) { //qDebug("take %d %s ", take, inL->summary().latin1()); if ( take == 3 ) return false; if ( take == 1 ) {// take local ********************** if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) @@ -1747,12 +1755,14 @@ bool CalendarView::synchronizeCalendar( Calendar* local, Calendar* remote, int ++changedRemote; } else {// take remote ********************** if ( !inL->isReadOnly() ) { idS = inL->IDStr(); int pid = inL->pilotId(); int calID = inL->calID(); + if ( hasCalId ) + calID = hasCalId; local->deleteIncidence( inL ); inL = inR->clone(); inL->setCalID_block( calID ); if ( mSyncManager->syncWithDesktop() ) inL->setPilotId( pid ); inL->setIDStr( idS ); @@ -1761,12 +1771,17 @@ bool CalendarView::synchronizeCalendar( Calendar* local, Calendar* remote, int inL->setID( mCurrentSyncDevice, inR->getID(mCurrentSyncDevice) ); } local->addIncidence( inL ); ++changedLocal; } } + } else { + // take == 0; events equal + if ( hasCalId ) + qDebug("EV EQUALLLL **************************** "); + } } else { // no conflict ********** add or delete remote if ( !filterIN || filterIN->filterCalendarItem( inR ) ){ if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) { QString des = eventLSync->description(); QString pref = "e"; |