-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 0c75632..8e83723 100644 --- a/korganizer/calendarview.cpp +++ b/korganizer/calendarview.cpp @@ -723,50 +723,52 @@ int CalendarView::takeEvent( Incidence* local, Incidence* remote, int mode , b // int zaurusStat() const; // 0 equal // 1 take local // 2 take remote // 3 cancel QDateTime lastSync = mLastCalendarSync; + QDateTime localMod = local->lastModified(); + QDateTime remoteMod = remote->lastModified(); if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) { bool remCh, locCh; remCh = ( remote->getCsum(mCurrentSyncDevice) != local->getCsum(mCurrentSyncDevice) ); //if ( remCh ) //qDebug("loc %s rem %s", local->getCsum(mCurrentSyncDevice).latin1(), remote->getCsum(mCurrentSyncDevice).latin1() ); - locCh = ( local->lastModified() > mLastCalendarSync ); + locCh = ( localMod > mLastCalendarSync ); if ( !remCh && ! locCh ) { //qDebug("both not changed "); - lastSync = local->lastModified().addDays(1); + lastSync = localMod.addDays(1); if ( mode <= SYNC_PREF_ASK ) return 0; } else { if ( locCh ) { - //qDebug("loc changed %d %s %s", local->revision() , local->lastModified().toString().latin1(), mLastCalendarSync.toString().latin1()); - lastSync = local->lastModified().addDays( -1 ); + //qDebug("loc changed %d %s %s", local->revision() , localMod.toString().latin1(), mLastCalendarSync.toString().latin1()); + lastSync = localMod.addDays( -1 ); if ( !remCh ) - remote->setLastModified( lastSync.addDays( -1 ) ); + remoteMod = ( lastSync.addDays( -1 ) ); } else { //qDebug(" not loc changed "); - lastSync = local->lastModified().addDays( 1 ); + lastSync = localMod.addDays( 1 ); if ( remCh ) - remote->setLastModified( lastSync.addDays( 1 ) ); + remoteMod =( lastSync.addDays( 1 ) ); } } full = true; if ( mode < SYNC_PREF_ASK ) mode = SYNC_PREF_ASK; } else { - if ( local->lastModified() == remote->lastModified() ) + if ( localMod == remoteMod ) if ( local->revision() == remote->revision() ) return 0; } // qDebug(" %d %d conflict on %s %s ", mode, full, local->summary().latin1(), remote->summary().latin1() ); - //qDebug("%s %d %s %d", local->lastModified().toString().latin1() , local->revision(), remote->lastModified().toString().latin1(), remote->revision()); - //qDebug("%d %d %d %d ", local->lastModified().time().second(), local->lastModified().time().msec(), remote->lastModified().time().second(), remote->lastModified().time().msec() ); + //qDebug("%s %d %s %d", localMod.toString().latin1() , local->revision(), remoteMod.toString().latin1(), remote->revision()); + //qDebug("%d %d %d %d ", localMod.time().second(), localMod.time().msec(), remoteMod.time().second(), remoteMod.time().msec() ); //full = true; //debug only if ( full ) { bool equ = false; if ( local->type() == "Event" ) { equ = (*((Event*) local) == *((Event*) remote)); } @@ -784,46 +786,46 @@ int CalendarView::takeEvent( Incidence* local, Incidence* remote, int mode , b }//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() ); + //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() ); if ( full && mode < SYNC_PREF_NEWEST ) mode = SYNC_PREF_ASK; switch( mode ) { case SYNC_PREF_LOCAL: - if ( lastSync > remote->lastModified() ) + if ( lastSync > remoteMod ) return 1; - if ( lastSync > local->lastModified() ) + if ( lastSync > localMod ) return 2; return 1; break; case SYNC_PREF_REMOTE: - if ( lastSync > remote->lastModified() ) + if ( lastSync > remoteMod ) return 1; - if ( lastSync > local->lastModified() ) + if ( lastSync > localMod ) return 2; return 2; break; case SYNC_PREF_NEWEST: - if ( local->lastModified() > remote->lastModified() ) + if ( localMod > remoteMod ) return 1; else return 2; break; 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() ) + //qDebug("lsy %s --- lo %s --- re %s ", lastSync.toString().latin1(), localMod.toString().latin1(), remoteMod.toString().latin1() ); + if ( lastSync > remoteMod ) return 1; - if ( lastSync > local->lastModified() ) + if ( lastSync > localMod ) return 2; - //qDebug("lsy %s --- lo %s --- re %s ", lastSync.toString().latin1(), local->lastModified().toString().latin1(), remote->lastModified().toString().latin1() ); - localIsNew = local->lastModified() >= remote->lastModified(); + //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 ) |