Do not en- or disable the watcher in setSyncEnabled.

The watcher is handled through the start and stop sync hooks in the
folder class. Even if the the folder is disabled and the watcher
fires, the folder does not schedule because it checks first if the
folder is enabled.
This commit is contained in:
Klaas Freitag 2013-09-11 12:30:29 +02:00
parent 287ec2f3df
commit 80332fb6ab

View file

@ -196,15 +196,14 @@ bool Folder::syncEnabled() const
void Folder::setSyncEnabled( bool doit )
{
_enabled = doit;
_watcher->setEventsEnabled( doit );
qDebug() << "setSyncEnabled - ############################ " << doit;
if( doit ) {
// undefined until next sync
_syncResult.setStatus( SyncResult::NotYetStarted);
_syncResult.clearErrors();
evaluateSync( QStringList() );
} else {
// do not stop or start the watcher here, that is done internally by
// folder class. Even if the watcher fires, the folder does not
// schedule itself because it checks the var. _enabled before.
_pollTimer.stop();
}
}
@ -227,6 +226,7 @@ void Folder::evaluateSync(const QStringList &/*pathList*/)
}
_syncResult.setStatus( SyncResult::NotYetStarted );
_syncResult.clearErrors();
emit scheduleToSync( alias() );
}