diff --git a/src/mirall/csyncthread.cpp b/src/mirall/csyncthread.cpp index d5b944ba8..a70e6ed23 100644 --- a/src/mirall/csyncthread.cpp +++ b/src/mirall/csyncthread.cpp @@ -63,9 +63,7 @@ void CSyncThread::run() return; qDebug() << "## CSync Thread local only: " << _localCheckOnly; -#if LIBCSYNC_VERSION_INT >= CSYNC_VERSION_INT(0, 45, 0) csync_enable_conflictcopys(csync); -#endif QTime t; t.start(); diff --git a/src/mirall/folder.cpp b/src/mirall/folder.cpp index 6dc447128..9396bdb89 100644 --- a/src/mirall/folder.cpp +++ b/src/mirall/folder.cpp @@ -35,8 +35,11 @@ Folder::Folder(const QString &alias, const QString &path, QObject *parent) _online(false), _enabled(true) { + qsrand(time(0)); + _pollTimer->setSingleShot(true); - _pollTimer->setInterval( DEFAULT_POLL_INTERVAL_SEC ); + int polltime = DEFAULT_POLL_INTERVAL_SEC - 2000+ (int)( 4000.0*qrand()/(RAND_MAX+1.0)); + _pollTimer->setInterval( polltime ); QObject::connect(_pollTimer, SIGNAL(timeout()), this, SLOT(slotPollTimerTimeout())); _pollTimer->start(); @@ -83,6 +86,9 @@ void Folder::setSyncEnabled( bool doit ) #ifdef USE_WATCHER _watcher->setEventsEnabled( doit ); #endif + if( doit && ! _pollTimer->isActive() ) { + _pollTimer->start(); + } } bool Folder::onlyOnlineEnabled() const @@ -205,7 +211,7 @@ void Folder::slotSyncFinished(const SyncResult &result) // reenable the poll timer if folder is sync enabled if( syncEnabled() ) { - qDebug() << "* " << alias() << "Poll timer enabled with " << _pollTimer->interval() << "seconds"; + qDebug() << "* " << alias() << "Poll timer enabled with " << _pollTimer->interval() << "milliseconds"; _pollTimer->start(); } else { qDebug() << "* Not enabling poll timer for " << alias(); diff --git a/src/mirall/folderman.cpp b/src/mirall/folderman.cpp index 5ba907be1..9038e5f88 100644 --- a/src/mirall/folderman.cpp +++ b/src/mirall/folderman.cpp @@ -197,7 +197,7 @@ void FolderMan::restoreEnabledFolders() { foreach( Folder *f, _folderMap ) { if (_folderEnabledMap.contains( f->alias() )) { - f->setSyncEnabled( _folderEnabledMap.value( f->alias() )); + f->setSyncEnabled( _folderEnabledMap.value( f->alias() ) ); } } } diff --git a/src/mirall/owncloudfolder.cpp b/src/mirall/owncloudfolder.cpp index 45f556337..b27477c98 100644 --- a/src/mirall/owncloudfolder.cpp +++ b/src/mirall/owncloudfolder.cpp @@ -41,8 +41,8 @@ ownCloudFolder::ownCloudFolder(const QString &alias, { #ifdef USE_WATCHER - setPollInterval( 15000 ); qDebug() << "****** ownCloud folder using watcher *******"; + // The folder interval is set in the folder parent class. #else /* If local polling is used, the polltimer of class Folder has to fire more * often @@ -50,8 +50,10 @@ ownCloudFolder::ownCloudFolder(const QString &alias, * remote poll interval, defined in slotPollTimerRemoteCheck */ + _pollTimer->stop(); connect( _pollTimer, SIGNAL(timeout()), this, SLOT(slotPollTimerRemoteCheck())); setPollInterval( 2000 ); + _pollTimer->start(); qDebug() << "****** ownCloud folder using local poll *******"; #endif }