job->start();
}
-/* FIXME (used to be called every time we were doing a propfind)
-void DiscoveryJob::update_job_update_callback(bool local,
- const char *dirUrl,
- void *userdata)
-{
- auto *updateJob = static_cast<DiscoveryJob *>(userdata);
- if (updateJob) {
- // Don't wanna overload the UI
- if (!updateJob->_lastUpdateProgressCallbackCall.isValid()
- || updateJob->_lastUpdateProgressCallbackCall.elapsed() >= 200) {
- updateJob->_lastUpdateProgressCallbackCall.start();
- } else {
- return;
- }
-
- QByteArray pPath(dirUrl);
- int indx = pPath.lastIndexOf('/');
- if (indx > -1) {
- const QString path = QUrl::fromPercentEncoding(pPath.mid(indx + 1));
- emit updateJob->folderDiscovered(local, path);
- }
- }
-}*/
-
DiscoverySingleDirectoryJob::DiscoverySingleDirectoryJob(const AccountPtr &account, const QString &path, QObject *parent)
: QObject(parent)
, _subPath(path)
_needsUpdate = true;
_syncItems.append(item);
slotNewItem(item);
+
+ if (item->isDirectory()) {
+ slotFolderDiscovered(item->_etag.isEmpty(), item->_file);
+ }
}
void SyncEngine::startSync()
void SyncEngine::slotFolderDiscovered(bool local, const QString &folder)
{
- // Currently remote and local discovery never run in parallel
- // Note: Currently this slot is only called occasionally! See the throttling
- // in DiscoveryJob::update_job_update_callback.
+ // Don't wanna overload the UI
+ if (!_lastUpdateProgressCallbackCall.isValid()) {
+ _lastUpdateProgressCallbackCall.start(); // first call
+ } else if (_lastUpdateProgressCallbackCall.elapsed() < 200) {
+ return;
+ } else {
+ _lastUpdateProgressCallbackCall.start();
+ }
+
if (local) {
_progressInfo->_currentDiscoveredLocalFolder = folder;
_progressInfo->_currentDiscoveredRemoteFolder.clear();
/** Stores the time since a job touched a file. */
QMultiMap<QElapsedTimer, QString> _touchedFiles;
+ QElapsedTimer _lastUpdateProgressCallbackCall;
+
/** For clearing the _touchedFiles variable after sync finished */
QTimer _clearTouchedFilesTimer;