-rw-r--r-- | korganizer/calendarview.cpp | 47 |
1 files changed, 24 insertions, 23 deletions
diff --git a/korganizer/calendarview.cpp b/korganizer/calendarview.cpp index 58b3d70..fd68dc4 100644 --- a/korganizer/calendarview.cpp +++ b/korganizer/calendarview.cpp @@ -131,5 +131,3 @@ extern int globalFlagBlockStartup; -#define SYNC_MODE_NORMAL 0 -#define SYNC_MODE_SHARP 1 -#define SYNC_MODE_QTOPIA 2 + @@ -729,6 +727,6 @@ int CalendarView::takeEvent( Incidence* local, Incidence* remote, int mode , b QDateTime lastSync = mLastCalendarSync; - if ( mGlobalSyncMode == SYNC_MODE_SHARP ) { + if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) { bool remCh, locCh; remCh = ( remote->zaurusUid() != local->zaurusUid() ); - locCh = ( local->zaurusStat() != local->revision() ); + locCh = ( local->lastModified() > mLastCalendarSync ); //qDebug("locCh %d remCh %d locuid %d remuid %d", locCh, remCh,local->zaurusUid(), remote->zaurusUid() ); @@ -752,4 +750,4 @@ int CalendarView::takeEvent( Incidence* local, Incidence* remote, int mode , b full = true; - if ( mode < 3 ) - mode = 3; + if ( mode < SYNC_PREF_ASK ) + mode = SYNC_PREF_ASK; } else { @@ -776,6 +774,6 @@ int CalendarView::takeEvent( Incidence* local, Incidence* remote, int mode , b //qDebug("equal "); - if ( mGlobalSyncMode == SYNC_MODE_SHARP ) { + if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) { local->setZaurusUid( remote->zaurusUid() ); } - if ( mode < 4 ) + if ( mode < SYNC_PREF_FORCE_LOCAL ) return 0; @@ -787,7 +785,7 @@ int CalendarView::takeEvent( Incidence* local, Incidence* remote, int mode , b bool localIsNew; - if ( full && mode < 2 ) - mode = 3; + if ( full && mode < SYNC_PREF_NEWEST ) + mode = SYNC_PREF_ASK; switch( mode ) { - case 0: + case SYNC_PREF_LOCAL: if ( lastSync > remote->lastModified() ) @@ -798,3 +796,3 @@ int CalendarView::takeEvent( Incidence* local, Incidence* remote, int mode , b break; - case 1: + case SYNC_PREF_REMOTE: if ( lastSync > remote->lastModified() ) @@ -805,3 +803,3 @@ int CalendarView::takeEvent( Incidence* local, Incidence* remote, int mode , b break; - case 2: + case SYNC_PREF_NEWEST: if ( local->lastModified() > remote->lastModified() ) @@ -811,3 +809,3 @@ int CalendarView::takeEvent( Incidence* local, Incidence* remote, int mode , b break; - case 3: + case SYNC_PREF_ASK: //qDebug("lsy %s --- lo %s --- re %s ", lastSync.toString().latin1(), local->lastModified().toString().latin1(), remote->lastModified().toString().latin1() ); @@ -837,6 +835,6 @@ int CalendarView::takeEvent( Incidence* local, Incidence* remote, int mode , b break; - case 4: + case SYNC_PREF_FORCE_LOCAL: return 1; break; - case 5: + case SYNC_PREF_FORCE_REMOTE: return 2; @@ -845,2 +843,3 @@ int CalendarView::takeEvent( Incidence* local, Incidence* remote, int mode , b default: + // SYNC_PREF_TAKE_BOTH not implemented break; @@ -998,3 +997,3 @@ bool CalendarView::synchronizeCalendar( Calendar* local, Calendar* remote, int } else { // no conflict - if ( mGlobalSyncMode == SYNC_MODE_SHARP ) { + if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) { QString des = eventLSync->description(); @@ -1004,3 +1003,3 @@ bool CalendarView::synchronizeCalendar( Calendar* local, Calendar* remote, int if ( des.find(pref+QString::number( inR->zaurusId() ) +"," ) >= 0 && mode != 5) { // delete it - inR->setZaurusStat( -3 ); + inR->setZaurusStat( SYNC_TEMPSTATE_DELETE ); //remote->deleteIncidence( inR ); @@ -1047,3 +1046,3 @@ bool CalendarView::synchronizeCalendar( Calendar* local, Calendar* remote, int skipIncidence = true; - if ( mGlobalSyncMode == SYNC_MODE_SHARP && inL->type() == "Journal" ) + if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL && inL->type() == "Journal" ) skipIncidence = true; @@ -1052,3 +1051,3 @@ bool CalendarView::synchronizeCalendar( Calendar* local, Calendar* remote, int if ( ! inR ) { - if ( mGlobalSyncMode == SYNC_MODE_SHARP ) { + if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) { if ( inL->zaurusId() >= 0 && mode != 4 ) { @@ -1143,3 +1142,3 @@ void CalendarView::syncSharp() #ifndef DESKTOP_VERSION - mGlobalSyncMode = SYNC_MODE_SHARP; + mGlobalSyncMode = SYNC_MODE_EXTERNAL; //mCurrentSyncDevice = "sharp-DTM"; @@ -1162,2 +1161,3 @@ void CalendarView::syncSharp() Incidence* inc = iL.first(); + /* obsolete while ( inc ) { @@ -1166,2 +1166,3 @@ void CalendarView::syncSharp() } + */ // pending: clean last sync event description @@ -1172,3 +1173,3 @@ void CalendarView::syncSharp() while ( inc ) { - if ( inc->zaurusStat() == -4 ) { + if ( inc->zaurusStat() == SYNC_TEMPSTATE_NEW_ID ) { loc = mCalendar->incidence(inc->uid() ); |