-rw-r--r-- | korganizer/calendarview.cpp | 44 |
1 files changed, 23 insertions, 21 deletions
diff --git a/korganizer/calendarview.cpp b/korganizer/calendarview.cpp index 1800cf2..8385bcc 100644 --- a/korganizer/calendarview.cpp +++ b/korganizer/calendarview.cpp @@ -1730,10 +1730,9 @@ bool CalendarView::synchronizeCalendar( Calendar* local, Calendar* remote, int 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; @@ -1743,24 +1742,27 @@ bool CalendarView::synchronizeCalendar( Calendar* local, Calendar* remote, int else idS = inR->IDStr(); int calID = inR->calID(); remote->deleteIncidence( inR ); - inR = inL->clone(); - inR->setCalID_block( calID ); - inR->setTempSyncStat( SYNC_TEMPSTATE_INITIAL ); - if ( mGlobalSyncMode != SYNC_MODE_EXTERNAL ) - inR->setIDStr( idS ); - remote->addIncidence( inR ); - if ( mSyncManager->syncWithDesktop() ) - inR->setPilotId( 2 ); - ++changedRemote; + if ( !hasCalId ) { + inR = inL->clone(); + inR->setCalID_block( calID ); + inR->setTempSyncStat( SYNC_TEMPSTATE_INITIAL ); + if ( mGlobalSyncMode != SYNC_MODE_EXTERNAL ) + inR->setIDStr( idS ); + remote->addIncidence( inR ); + if ( mSyncManager->syncWithDesktop() ) + inR->setPilotId( 2 ); + ++changedRemote; + } else + ++deletedEventR; } else {// take remote ********************** if ( !inL->isReadOnly() ) { idS = inL->IDStr(); int pid = inL->pilotId(); int calID = inL->calID(); - if ( hasCalId ) - calID = hasCalId; + if ( hasCalId ) + calID = 0;// add to default calendar local->deleteIncidence( inL ); inL = inR->clone(); inL->setCalID_block( calID ); if ( mSyncManager->syncWithDesktop() ) @@ -1775,12 +1777,16 @@ bool CalendarView::synchronizeCalendar( Calendar* local, Calendar* remote, int } } } else { // 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 if ( !filterIN || filterIN->filterCalendarItem( inR ) ){ if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) { QString des = eventLSync->description(); @@ -2481,18 +2487,14 @@ void CalendarView::mergeFileResource( QString fn ,QString resource ) return; } clearAllViews(); mCalendar->setCalendarRemove( exclusiveResource ); - int def = mCalendar->defaultCalendar(); mCalendar->setDefaultCalendar(exclusiveResource); + mCalendar->setAllCalendarEnabled( true ); if ( !mCalendar->addCalendarFile( fn, exclusiveResource )) { qDebug("KO: CalendarView::mergeFileResource: error adding file %s", fn.latin1() ); } - mCalendar->setDefaultCalendar( def ); - mCalendar->reInitAlarmSettings(); - setSyncEventsReadOnly(); - updateUnmanagedViews(); - updateView(); + restoreCalendarSettings(); } void CalendarView::showOpenError() { KMessageBox::error(this,i18n("Couldn't load calendar\n.")); |