summaryrefslogtreecommitdiffabout
path: root/korganizer/calendarview.cpp
Side-by-side diff
Diffstat (limited to 'korganizer/calendarview.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--korganizer/calendarview.cpp47
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
@@ -130,7 +130,5 @@ extern int globalFlagBlockAgenda;
extern int globalFlagBlockStartup;
-#define SYNC_MODE_NORMAL 0
-#define SYNC_MODE_SHARP 1
-#define SYNC_MODE_QTOPIA 2
+
class KOBeamPrefs : public QDialog
@@ -728,8 +726,8 @@ int CalendarView::takeEvent( Incidence* local, Incidence* remote, int mode , b
// 3 cancel
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() );
if ( !remCh && ! locCh ) {
@@ -751,6 +749,6 @@ 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 {
if ( local->lastModified() == remote->lastModified() )
@@ -775,8 +773,8 @@ int CalendarView::takeEvent( Incidence* local, Incidence* remote, int mode , b
if ( equ ) {
//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;
@@ -786,9 +784,9 @@ int CalendarView::takeEvent( Incidence* local, Incidence* remote, int mode , b
int result;
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() )
return 1;
@@ -797,5 +795,5 @@ int CalendarView::takeEvent( Incidence* local, Incidence* remote, int mode , b
return 1;
break;
- case 1:
+ case SYNC_PREF_REMOTE:
if ( lastSync > remote->lastModified() )
return 1;
@@ -804,5 +802,5 @@ int CalendarView::takeEvent( Incidence* local, Incidence* remote, int mode , b
return 2;
break;
- case 2:
+ case SYNC_PREF_NEWEST:
if ( local->lastModified() > remote->lastModified() )
return 1;
@@ -810,5 +808,5 @@ int CalendarView::takeEvent( Incidence* local, Incidence* remote, int mode , b
return 2;
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() );
if ( lastSync > remote->lastModified() )
@@ -836,12 +834,13 @@ 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;
break;
default:
+ // SYNC_PREF_TAKE_BOTH not implemented
break;
}
@@ -997,5 +996,5 @@ 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();
QString pref = "e";
@@ -1003,5 +1002,5 @@ bool CalendarView::synchronizeCalendar( Calendar* local, Calendar* remote, int
pref = "t";
if ( des.find(pref+QString::number( inR->zaurusId() ) +"," ) >= 0 && mode != 5) { // delete it
- inR->setZaurusStat( -3 );
+ inR->setZaurusStat( SYNC_TEMPSTATE_DELETE );
//remote->deleteIncidence( inR );
++deletedEventR;
@@ -1046,10 +1045,10 @@ bool CalendarView::synchronizeCalendar( Calendar* local, Calendar* remote, int
if ( uid.left(21) == QString("last-syncEvent-device") )
skipIncidence = true;
- if ( mGlobalSyncMode == SYNC_MODE_SHARP && inL->type() == "Journal" )
+ if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL && inL->type() == "Journal" )
skipIncidence = true;
if ( !skipIncidence ) {
inR = remote->incidence( uid );
if ( ! inR ) {
- if ( mGlobalSyncMode == SYNC_MODE_SHARP ) {
+ if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) {
if ( inL->zaurusId() >= 0 && mode != 4 ) {
local->deleteIncidence( inL );
@@ -1142,5 +1141,5 @@ void CalendarView::syncSharp()
{
#ifndef DESKTOP_VERSION
- mGlobalSyncMode = SYNC_MODE_SHARP;
+ mGlobalSyncMode = SYNC_MODE_EXTERNAL;
//mCurrentSyncDevice = "sharp-DTM";
if ( KOPrefs::instance()->mAskForPreferences )
@@ -1161,8 +1160,10 @@ void CalendarView::syncSharp()
QPtrList<Incidence> iL = mCalendar->rawIncidences();
Incidence* inc = iL.first();
+ /* obsolete
while ( inc ) {
inc->setZaurusStat( inc->revision () );
inc = iL.next();
}
+ */
// pending: clean last sync event description
sharpFormat.save(calendar);
@@ -1171,5 +1172,5 @@ void CalendarView::syncSharp()
Incidence* loc;
while ( inc ) {
- if ( inc->zaurusStat() == -4 ) {
+ if ( inc->zaurusStat() == SYNC_TEMPSTATE_NEW_ID ) {
loc = mCalendar->incidence(inc->uid() );
if ( loc ) {