@@ -628,8 +628,7 @@ void NotebookSyncAgent::finalizeSendingLocalChanges()
628628 Report *report = new Report (mNetworkManager , mSettings );
629629 mRequests .insert (report);
630630 connect (report, SIGNAL (finished ()), this , SLOT (additionalReportRequestFinished ()));
631- report->multiGetEtags (mRemoteCalendarPath , mSentUids .keys ());
632- return ;
631+ report->multiGetEvents (mRemoteCalendarPath , mSentUids .keys ());
633632 } else {
634633 emitFinished (Buteo::SyncResults::NO_ERROR );
635634 }
@@ -642,30 +641,22 @@ void NotebookSyncAgent::additionalReportRequestFinished()
642641 // The server did not originally respond with the update ETAG values after
643642 // our initial PUT/UPDATE so we had to do an addition report request.
644643 // This response will contain the new ETAG values for any resource we
645- // upsynced (ie, a local modification/addition).
644+ // upsynced (ie, a local modification/addition) and also the incidence
645+ // as it may have been modified by the server.
646646
647647 Report *report = qobject_cast<Report*>(sender ());
648648 mRequests .remove (report);
649649 report->deleteLater ();
650650
651651 if (report->errorCode () == Buteo::SyncResults::NO_ERROR ) {
652652 LOG_DEBUG (" Additional report request finished: received:"
653- << report->receivedCalendarResources ().length () << " iCal blobs containing a total of"
654653 << report->receivedCalendarResources ().count () << " incidences" );
655- for (QList<Reader::CalendarResource>::ConstIterator
656- it = report->receivedCalendarResources ().constBegin ();
657- it != report->receivedCalendarResources ().constEnd (); ++it) {
658- if (mSentUids .contains (it->href )) {
659- updateHrefETag (mSentUids .take (it->href ), it->href , it->etag );
660- }
661- }
662- LOG_DEBUG (" Remains" << mSentUids .count () << " uris not updated." );
654+ mReceivedCalendarResources += report->receivedCalendarResources ();
663655 emitFinished (Buteo::SyncResults::NO_ERROR );
664- return ;
656+ } else {
657+ LOG_WARNING (" Additional report request finished with error, aborting sync of notebook:" << mRemoteCalendarPath );
658+ emitFinished (report->errorCode (), report->errorString ());
665659 }
666-
667- LOG_WARNING (" Additional report request finished with error, aborting sync of notebook:" << mRemoteCalendarPath );
668- emitFinished (report->errorCode (), report->errorString ());
669660}
670661
671662bool NotebookSyncAgent::applyRemoteChanges ()
@@ -1015,7 +1006,14 @@ void NotebookSyncAgent::updateIncidence(KCalCore::Incidence::Ptr incidence,
10151006 }
10161007
10171008 storedIncidence->endUpdates ();
1018- storedIncidence->setLastModified (incidence->lastModified ());
1009+ // Avoid spurious detections of modified incidences
1010+ // by ensuring that the received last modification date time
1011+ // is previous to the sync date time.
1012+ if (incidence->lastModified () < mNotebookSyncedDateTime ) {
1013+ storedIncidence->setLastModified (incidence->lastModified ());
1014+ } else {
1015+ storedIncidence->setLastModified (mNotebookSyncedDateTime .addSecs (-2 ));
1016+ }
10191017 }
10201018 incidence->setUid (storedIncidence->uid ());
10211019}
0 commit comments