author | zautrix <zautrix> | 2005-04-03 22:00:17 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2005-04-03 22:00:17 (UTC) |
commit | 30359da3c126e67f6c75400323fcca4c159c3d93 (patch) (side-by-side diff) | |
tree | 71fbc8d5574ebe5156171af935f9c5da99d9ffcf | |
parent | 23d4df2516068bfbf8d968b94763d0a6d6e13271 (diff) | |
download | kdepimpi-30359da3c126e67f6c75400323fcca4c159c3d93.zip kdepimpi-30359da3c126e67f6c75400323fcca4c159c3d93.tar.gz kdepimpi-30359da3c126e67f6c75400323fcca4c159c3d93.tar.bz2 |
sync fixes
-rw-r--r-- | kaddressbook/kabcore.cpp | 6 | ||||
-rw-r--r-- | korganizer/calendarview.cpp | 16 |
2 files changed, 17 insertions, 5 deletions
diff --git a/kaddressbook/kabcore.cpp b/kaddressbook/kabcore.cpp index eba74a6..20b107e 100644 --- a/kaddressbook/kabcore.cpp +++ b/kaddressbook/kabcore.cpp @@ -2847,62 +2847,64 @@ int KABCore::takeAddressee( KABC::Addressee* local, KABC::Addressee* remote, i 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()); } int result; bool localIsNew; //qDebug("%s -- %s mLastCalendarSync %s lastsync %s --- local %s remote %s ",local->summary().latin1(), remote->summary().latin1(),mLastCalendarSync.toString().latin1() ,lastSync.toString().latin1() , local->lastModified().toString().latin1() , remote->lastModified().toString().latin1() ); if ( full && mode < SYNC_PREF_NEWEST ) mode = SYNC_PREF_ASK; switch( mode ) { case SYNC_PREF_LOCAL: if ( lastSync > remoteMod ) return 1; if ( lastSync > localMod ) return 2; return 1; break; case SYNC_PREF_REMOTE: - if ( lastSync > remoteMod ) - return 1; if ( lastSync > localMod ) return 2; + if ( lastSync > remoteMod ) + return 1; return 2; break; case SYNC_PREF_NEWEST: if ( localMod > remoteMod ) return 1; else return 2; break; case SYNC_PREF_ASK: //qDebug("lsy %s --- lo %s --- re %s ", lastSync.toString().latin1(), localMod.toString().latin1(), remoteMod.toString().latin1() ); + if ( lastSync > remoteMod && lastSync > localMod) + return 0; if ( lastSync > remoteMod ) return 1; if ( lastSync > localMod ) { return 2; } localIsNew = localMod >= remoteMod; //qDebug("conflict! ************************************** "); { KABC::AddresseeChooser acd ( *local,*remote, localIsNew , this ); result = acd.executeD(localIsNew); return result; } break; case SYNC_PREF_FORCE_LOCAL: return 1; break; case SYNC_PREF_FORCE_REMOTE: return 2; break; default: // SYNC_PREF_TAKE_BOTH not implemented break; } diff --git a/korganizer/calendarview.cpp b/korganizer/calendarview.cpp index 76cce26..00ef145 100644 --- a/korganizer/calendarview.cpp +++ b/korganizer/calendarview.cpp @@ -795,74 +795,84 @@ int CalendarView::takeEvent( Incidence* local, Incidence* remote, int mode , b if ( full ) { bool equ = false; if ( local->type() == "Event" ) { equ = (*((Event*) local) == *((Event*) remote)); } else if ( local->type() =="Todo" ) 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->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()); } int result; bool localIsNew; //qDebug("%s -- %s mLastCalendarSync %s lastsync %s --- local %s remote %s ",local->summary().latin1(), remote->summary().latin1(),mLastCalendarSync.toString().latin1() ,lastSync.toString().latin1() , localMod.toString().latin1() , remoteMod.toString().latin1() ); + + // ************************************************ + // ************************************************ + // ************************************************ + // We may have that lastSync > remoteMod AND lastSync > localMod + // BUT remoteMod != localMod + + if ( full && mode < SYNC_PREF_NEWEST ) mode = SYNC_PREF_ASK; switch( mode ) { case SYNC_PREF_LOCAL: if ( lastSync > remoteMod ) return 1; if ( lastSync > localMod ) return 2; return 1; break; case SYNC_PREF_REMOTE: - if ( lastSync > remoteMod ) - return 1; if ( lastSync > localMod ) return 2; + if ( lastSync > remoteMod ) + return 1; return 2; break; case SYNC_PREF_NEWEST: - if ( localMod > remoteMod ) + if ( localMod >= remoteMod ) return 1; else return 2; break; case SYNC_PREF_ASK: //qDebug("lsy %s --- lo %s --- re %s ", lastSync.toString().latin1(), localMod.toString().latin1(), remoteMod.toString().latin1() ); + if ( lastSync > remoteMod && lastSync > localMod) + return 0; if ( lastSync > remoteMod ) return 1; if ( lastSync > localMod ) return 2; //qDebug("lsy %s --- lo %s --- re %s ", lastSync.toString().latin1(), localMod.toString().latin1(), remoteMod.toString().latin1() ); localIsNew = localMod >= remoteMod; if ( localIsNew ) getEventViewerDialog()->setColorMode( 1 ); else getEventViewerDialog()->setColorMode( 2 ); getEventViewerDialog()->setIncidence(local); if ( localIsNew ) getEventViewerDialog()->setColorMode( 2 ); else getEventViewerDialog()->setColorMode( 1 ); getEventViewerDialog()->addIncidence(remote); getEventViewerDialog()->setColorMode( 0 ); //qDebug("local %d remote %d ",local->relatedTo(),remote->relatedTo() ); getEventViewerDialog()->setCaption( mCurrentSyncDevice +i18n(" : Conflict! Please choose entry!")); getEventViewerDialog()->showMe(); result = getEventViewerDialog()->executeS( localIsNew ); return result; break; |