author | zautrix <zautrix> | 2004-09-12 17:18:27 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2004-09-12 17:18:27 (UTC) |
commit | bc4153a99e205f43d0144e2e910730dd1a14d402 (patch) (side-by-side diff) | |
tree | 16aeb28cd765539bac6e85e714478f31a7b93bac /korganizer/calendarview.cpp | |
parent | a222c2f7369eeefd19454c973c0cc48300f72bec (diff) | |
download | kdepimpi-bc4153a99e205f43d0144e2e910730dd1a14d402.zip kdepimpi-bc4153a99e205f43d0144e2e910730dd1a14d402.tar.gz kdepimpi-bc4153a99e205f43d0144e2e910730dd1a14d402.tar.bz2 |
added missing sync featute
-rw-r--r-- | korganizer/calendarview.cpp | 53 |
1 files changed, 40 insertions, 13 deletions
diff --git a/korganizer/calendarview.cpp b/korganizer/calendarview.cpp index db07713..cfd9290 100644 --- a/korganizer/calendarview.cpp +++ b/korganizer/calendarview.cpp @@ -731,2 +731,4 @@ int CalendarView::takeEvent( Incidence* local, Incidence* remote, int mode , b 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 ); @@ -734,3 +736,3 @@ int CalendarView::takeEvent( Incidence* local, Incidence* remote, int mode , b if ( !remCh && ! locCh ) { - //qDebug("both not changed "); + qDebug("both not changed "); lastSync = local->lastModified().addDays(1); @@ -738,3 +740,3 @@ int CalendarView::takeEvent( Incidence* local, Incidence* remote, int mode , b if ( locCh ) { - //qDebug("loc changed %d %d", local->zaurusStat(), local->revision() ); + qDebug("loc changed %d", local->revision() ); lastSync = local->lastModified().addDays( -1 ); @@ -743,3 +745,3 @@ int CalendarView::takeEvent( Incidence* local, Incidence* remote, int mode , b } else { - //qDebug(" not loc changed "); + qDebug(" not loc changed "); lastSync = local->lastModified().addDays( 1 ); @@ -786,2 +788,4 @@ int CalendarView::takeEvent( Incidence* local, Incidence* remote, int mode , b bool localIsNew; + qDebug("mLastCalendarSync %s lastsync %s --- local %s remote %s ",mLastCalendarSync.toString().latin1() ,lastSync.toString().latin1() , local->lastModified().toString().latin1() , remote->lastModified().toString().latin1() ); + if ( full && mode < SYNC_PREF_NEWEST ) @@ -817,3 +821,3 @@ int CalendarView::takeEvent( Incidence* local, Incidence* remote, int mode , b //qDebug("lsy %s --- lo %s --- re %s ", lastSync.toString().latin1(), local->lastModified().toString().latin1(), remote->lastModified().toString().latin1() ); - localIsNew = local->lastModified() > remote->lastModified(); + localIsNew = local->lastModified() >= remote->lastModified(); if ( localIsNew ) @@ -944,2 +948,3 @@ bool CalendarView::synchronizeCalendar( Calendar* local, Calendar* remote, int QDateTime modifiedCalendar = mLastCalendarSync;; + eventLSync = getLastSyncEvent(); eventR = remote->event("last-syncEvent-"+mCurrentSyncName ); @@ -950,11 +955,14 @@ bool CalendarView::synchronizeCalendar( Calendar* local, Calendar* remote, int } else { - fullDateRange = true; - eventRSync = new Event(); - eventRSync->setSummary(mCurrentSyncName + i18n(" - sync event")); - eventRSync->setUid("last-syncEvent-"+mCurrentSyncName ); - eventRSync->setDtStart( mLastCalendarSync ); - eventRSync->setDtEnd( mLastCalendarSync.addSecs( 7200 ) ); - eventRSync->setCategories( i18n("SyncEvent") ); + if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) { + eventRSync = (Event*)eventLSync->clone(); + } else { + fullDateRange = true; + eventRSync = new Event(); + eventRSync->setSummary(mCurrentSyncName + i18n(" - sync event")); + eventRSync->setUid("last-syncEvent-"+mCurrentSyncName ); + eventRSync->setDtStart( mLastCalendarSync ); + eventRSync->setDtEnd( mLastCalendarSync.addSecs( 7200 ) ); + eventRSync->setCategories( i18n("SyncEvent") ); + } } - eventLSync = getLastSyncEvent(); if ( eventLSync->dtStart() == mLastCalendarSync ) @@ -1118,3 +1126,22 @@ bool CalendarView::synchronizeCalendar( Calendar* local, Calendar* remote, int } - + if ( KOPrefs::instance()->mWriteBackInFuture ) { + er = remote->rawIncidences(); + inR = er.first(); + QDateTime dt; + QDateTime cur = QDateTime::currentDateTime(); + QDateTime end = cur.addSecs( KOPrefs::instance()->mWriteBackInFuture * 3600 *24 *7 ); + while ( inR ) { + if ( inR->type() == "Todo" ) { + Todo * t = (Todo*)inR; + if ( t->hasDueDate() ) + dt = t->dtDue(); + else + dt = cur.addSecs( 62 ); + } + else dt = inR->dtStart(); + if ( dt < cur || dt > end ) + remote->deleteIncidence( inR ); + inR = er.next(); + } + } bar.hide(); |