Poll folder watcher: compare to last seen file.

This commit is contained in:
Klaas Freitag 2012-03-28 15:13:08 +02:00
parent 84ffebe26c
commit ffc5895ba1
2 changed files with 16 additions and 8 deletions

View file

@ -39,6 +39,7 @@ ownCloudFolder::ownCloudFolder(const QString &alias,
, _csync(0)
, _pollTimerCnt(0)
, _csyncError(false)
, _lastSeenFiles(0)
{
#ifdef USE_WATCHER
qDebug() << "****** ownCloud folder using watcher *******";
@ -145,15 +146,21 @@ void ownCloudFolder::slotThreadTreeWalkResult( WalkStats *wStats )
qDebug() << "Renamed files: " << wStats->renamed;
#ifndef USE_WATCHER
if( (wStats->newFiles + wStats->eval + wStats->removed + wStats->renamed) > 0 ) {
if( _lastSeenFiles > 0 && _lastSeenFiles != wStats->seenFiles ) {
qDebug() << "*** last seen files different from currently seen number => full Sync needed";
_localCheckOnly = false;
_pollTimerCnt = 0;
}
if( _localCheckOnly && (wStats->newFiles + wStats->eval + wStats->removed + wStats->renamed) > 0 ) {
qDebug() << "*** Local changes, lets do a full sync!" ;
_localCheckOnly = false; // next time it will be a non local check.
_pollTimerCnt = 0;
// QTimer::singleShot( 0, this, SLOT(startSync( QStringList() )));
} else {
}
if( _localCheckOnly ) {
qDebug() << " *** No local changes, finalize, pollTimerCounter is "<< _pollTimerCnt ;
}
#endif
_lastSeenFiles = wStats->seenFiles;
/*
* Attention: This is deleted here, outside of the thread, because the thread can
* faster die than this routine has read out the memory.

View file

@ -59,6 +59,7 @@ private:
int _pollTimerCnt;
QStringList _errors;
bool _csyncError;
ulong _lastSeenFiles;
};
}