-rw-r--r-- | korganizer/calendarview.cpp | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/korganizer/calendarview.cpp b/korganizer/calendarview.cpp index fab4540..5150455 100644 --- a/korganizer/calendarview.cpp +++ b/korganizer/calendarview.cpp @@ -724,13 +724,13 @@ int CalendarView::takeEvent( Incidence* local, Incidence* remote, int mode , b // 1 take local // 2 take remote // 3 cancel QDateTime lastSync = mLastCalendarSync; if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) { bool remCh, locCh; - remCh = ( remote->zaurusUid() != local->zaurusUid() ); + remCh = ( remote->getCsum(mCurrentSyncDevice) != local->getCsum(mCurrentSyncDevice) ); locCh = ( local->lastModified() > mLastCalendarSync ); //qDebug("locCh %d remCh %d locuid %d remuid %d", locCh, remCh,local->zaurusUid(), remote->zaurusUid() ); if ( !remCh && ! locCh ) { //qDebug("both not changed "); lastSync = local->lastModified().addDays(1); } else { @@ -770,13 +770,13 @@ int CalendarView::takeEvent( Incidence* local, Incidence* remote, int mode , b equ = (*((Todo*) local) == (*(Todo*) remote)); else if ( local->type() =="Journal" ) equ = (*((Journal*) local) == *((Journal*) remote)); if ( equ ) { //qDebug("equal "); if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) { - local->setZaurusUid( remote->zaurusUid() ); + local->setCsum( mCurrentSyncDevice, remote->getCsum(mCurrentSyncDevice) ); } if ( mode < SYNC_PREF_FORCE_LOCAL ) return 0; }//else //debug only //qDebug("not equal %s %s ", local->summary().latin1(), remote->summary().latin1()); @@ -892,19 +892,19 @@ void CalendarView::checkExternSyncEvent( QPtrList<Event> lastSync , Incidence* t if ( toDelete->type() == "Journal" ) return; Event* eve = lastSync.first(); while ( eve ) { - int id = toDelete->getID( eve->uid().mid( 15 ) ); // this is the sync profile name - if ( id >= 0 ) { + QString id = toDelete->getID( eve->uid().mid( 15 ) ); // this is the sync profile name + if ( !id.isEmpty() ) { QString des = eve->description(); QString pref = "e"; if ( toDelete->type() == "Todo" ) pref = "t"; - des += pref+ QString::number ( id ) + ","; + des += pref+ id + ","; eve->setReadOnly( false ); eve->setDescription( des ); eve->setReadOnly( true ); } eve = lastSync.next(); } @@ -1010,13 +1010,13 @@ bool CalendarView::synchronizeCalendar( Calendar* local, Calendar* remote, int maxrev = inR->revision(); 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 - inL->setZaurusUid( inR->zaurusUid() ); + inL->setCsum( mCurrentSyncDevice, inR->getCsum(mCurrentSyncDevice) ); remote->deleteIncidence( inR ); if ( inL->revision() < maxrev ) inL->setRevision( maxrev ); remote->addIncidence( inL->clone() ); ++changedRemote; } else { @@ -1030,13 +1030,13 @@ bool CalendarView::synchronizeCalendar( Calendar* local, Calendar* remote, int } else { // no conflict if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) { QString des = eventLSync->description(); QString pref = "e"; if ( inR->type() == "Todo" ) pref = "t"; - if ( des.find(pref+QString::number( inR->getID(mCurrentSyncDevice) ) +"," ) >= 0 && mode != 5) { // delete it + if ( des.find(pref+ inR->getID(mCurrentSyncDevice) +"," ) >= 0 && mode != 5) { // delete it inR->setTempSyncStat( SYNC_TEMPSTATE_DELETE ); //remote->deleteIncidence( inR ); ++deletedEventR; } else { inR->setLastModified( modifiedCalendar ); local->addIncidence( inR->clone() ); @@ -1080,18 +1080,18 @@ bool CalendarView::synchronizeCalendar( Calendar* local, Calendar* remote, int if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL && inL->type() == "Journal" ) skipIncidence = true; if ( !skipIncidence ) { inR = remote->incidence( uid ); if ( ! inR ) { if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) { - if ( inL->getID(mCurrentSyncDevice) >= 0 && mode != 4 ) { + if ( !inL->getID(mCurrentSyncDevice).isEmpty() && mode != 4 ) { local->deleteIncidence( inL ); ++deletedEventL; } else { if ( ! KOPrefs::instance()->mWriteBackExistingOnly ) { - inL->setID(mCurrentSyncDevice, -1 ); + inL->removeID(mCurrentSyncDevice ); ++addedEventR; inL->setLastModified( modifiedCalendar ); remote->addIncidence( inL->clone() ); } } } else { @@ -1205,13 +1205,13 @@ void CalendarView::syncSharp() Incidence* loc; while ( inc ) { if ( inc->tempSyncStat() == SYNC_TEMPSTATE_NEW_ID ) { loc = mCalendar->incidence(inc->uid() ); if ( loc ) { loc->setID(mCurrentSyncDevice, inc->getID(mCurrentSyncDevice) ); - loc->setZaurusUid( inc->zaurusUid() ); + loc->setCsum( mCurrentSyncDevice, inc->getCsum(mCurrentSyncDevice) ); } } inc = iL.next(); } Incidence* lse = getLastSyncEvent(); if ( lse ) { |