-rw-r--r-- | korganizer/calendarview.cpp | 34 |
1 files changed, 18 insertions, 16 deletions
diff --git a/korganizer/calendarview.cpp b/korganizer/calendarview.cpp index a350c3b..7044e90 100644 --- a/korganizer/calendarview.cpp +++ b/korganizer/calendarview.cpp @@ -1436,17 +1436,17 @@ bool CalendarView::synchronizeCalendar( Calendar* local, Calendar* remote, int ++incCounter; uid = inR->uid(); bool skipIncidence = false; if ( uid.left(15) == QString("last-syncEvent-") ) skipIncidence = true; QString idS; qApp->processEvents(); if ( !skipIncidence ) { - inL = local->incidence( uid ); + inL = local->incidenceForUid( uid , false ); if ( inL ) { // maybe conflict - same uid in both calendars 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 ) inL->setCsum( mCurrentSyncDevice, inR->getCsum(mCurrentSyncDevice) ); @@ -1459,31 +1459,33 @@ bool CalendarView::synchronizeCalendar( Calendar* local, Calendar* remote, int inR->setTempSyncStat( SYNC_TEMPSTATE_INITIAL ); if ( mGlobalSyncMode != SYNC_MODE_EXTERNAL ) inR->setIDStr( idS ); remote->addIncidence( inR ); if ( mSyncManager->syncWithDesktop() ) inR->setPilotId( 2 ); ++changedRemote; } else {// take remote ********************** - idS = inL->IDStr(); - int pid = inL->pilotId(); - int calID = inL->calID(); - local->deleteIncidence( inL ); - inL = inR->clone(); - inL->setCalID( calID ); - if ( mSyncManager->syncWithDesktop() ) - inL->setPilotId( pid ); - inL->setIDStr( idS ); - if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) { - inL->setCsum( mCurrentSyncDevice, inR->getCsum(mCurrentSyncDevice) ); - inL->setID( mCurrentSyncDevice, inR->getID(mCurrentSyncDevice) ); + if ( !inL->isReadOnly() ) { + idS = inL->IDStr(); + int pid = inL->pilotId(); + int calID = inL->calID(); + local->deleteIncidence( inL ); + inL = inR->clone(); + inL->setCalID( calID ); + if ( mSyncManager->syncWithDesktop() ) + inL->setPilotId( pid ); + inL->setIDStr( idS ); + if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) { + inL->setCsum( mCurrentSyncDevice, inR->getCsum(mCurrentSyncDevice) ); + inL->setID( mCurrentSyncDevice, inR->getID(mCurrentSyncDevice) ); + } + local->addIncidence( inL ); + ++changedLocal; } - local->addIncidence( inL ); - ++changedLocal; } } } else { // no conflict ********** add or delete remote if ( !filterIN || filterIN->filterCalendarItem( inR ) ){ if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) { QString des = eventLSync->description(); QString pref = "e"; if ( inR->typeID() == todoID ) @@ -1544,17 +1546,17 @@ bool CalendarView::synchronizeCalendar( Calendar* local, Calendar* remote, int ++incCounter; uid = inL->uid(); bool skipIncidence = false; if ( uid.left(15) == QString("last-syncEvent-") ) skipIncidence = true; if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL && inL->typeID() == journalID ) skipIncidence = true; if ( !skipIncidence ) { - inR = remote->incidence( uid ); + inR = remote->incidenceForUid( uid , true ); if ( ! inR ) { if ( !filterOUT || filterOUT->filterCalendarItem( inL ) ){ // no conflict ********** add or delete local if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) { if ( !inL->getID(mCurrentSyncDevice).isEmpty() && mode != 4 ) { checkExternSyncEvent(eventLSyncSharp, inL); local->deleteIncidence( inL ); ++deletedEventL; |