From: Kevin Ottens Date: Thu, 2 Jul 2020 14:22:48 +0000 (+0200) Subject: Move the e2e information fetch even earlier X-Git-Tag: archive/raspbian/3.16.7-1_deb13u1+rpi1~1^2~222^2^2~116^2~4 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=3520360159e3e97e7af04d430cee3e8010506515;p=nextcloud-desktop.git Move the e2e information fetch even earlier We used to do it when the propagation starts, let's do it even before the discovery starts. This way we'll have a chance to exploit the information during the discovery phase. Signed-off-by: Kevin Ottens --- diff --git a/src/libsync/owncloudpropagator.cpp b/src/libsync/owncloudpropagator.cpp index 6ba0086e2..7a1274bd7 100644 --- a/src/libsync/owncloudpropagator.cpp +++ b/src/libsync/owncloudpropagator.cpp @@ -510,15 +510,7 @@ void OwncloudPropagator::start(const SyncFileItemVector &items, connect(_rootJob.data(), &PropagatorJob::finished, this, &OwncloudPropagator::emitFinished); - // If needed, make sure we have up to date E2E information before scheduling the first job - // otherwise we start right away - if (_account->capabilities().clientSideEncryptionAvailable()) { - connect(_account->e2e(), &ClientSideEncryption::folderEncryptedStatusFetchDone, - this, &OwncloudPropagator::onFolderEncryptedStatusFetchDone); - _account->e2e()->fetchFolderEncryptedStatus(); - } else { - scheduleNextJob(); - } + scheduleNextJob(); } const SyncOptions &OwncloudPropagator::syncOptions() const @@ -616,13 +608,6 @@ QString OwncloudPropagator::getFilePath(const QString &tmp_file_name) const return _localDir + tmp_file_name; } -void OwncloudPropagator::onFolderEncryptedStatusFetchDone() -{ - disconnect(_account->e2e(), &ClientSideEncryption::folderEncryptedStatusFetchDone, - this, &OwncloudPropagator::onFolderEncryptedStatusFetchDone); - scheduleNextJob(); -} - void OwncloudPropagator::scheduleNextJob() { QTimer::singleShot(0, this, &OwncloudPropagator::scheduleNextJobImpl); diff --git a/src/libsync/owncloudpropagator.h b/src/libsync/owncloudpropagator.h index d0cd59e53..af944e8e9 100644 --- a/src/libsync/owncloudpropagator.h +++ b/src/libsync/owncloudpropagator.h @@ -527,8 +527,6 @@ private slots: _finishedEmited = true; } - void onFolderEncryptedStatusFetchDone(); - void scheduleNextJobImpl(); signals: diff --git a/src/libsync/syncengine.cpp b/src/libsync/syncengine.cpp index 19d90479b..1875100ef 100644 --- a/src/libsync/syncengine.cpp +++ b/src/libsync/syncengine.cpp @@ -858,6 +858,21 @@ void SyncEngine::startSync() return shouldDiscoverLocally(path); }; + // If needed, make sure we have up to date E2E information before the + // discovery phase, otherwise we start right away + if (_account->capabilities().clientSideEncryptionAvailable()) { + connect(_account->e2e(), &ClientSideEncryption::folderEncryptedStatusFetchDone, + this, &SyncEngine::onFolderEncryptedStatusFetchDone); + _account->e2e()->fetchFolderEncryptedStatus(); + } else { + slotStartDiscovery(); + } +} + +void SyncEngine::onFolderEncryptedStatusFetchDone() +{ + disconnect(_account->e2e(), &ClientSideEncryption::folderEncryptedStatusFetchDone, + this, &SyncEngine::onFolderEncryptedStatusFetchDone); slotStartDiscovery(); } diff --git a/src/libsync/syncengine.h b/src/libsync/syncengine.h index b3adbba2f..7f21eee3e 100644 --- a/src/libsync/syncengine.h +++ b/src/libsync/syncengine.h @@ -168,6 +168,7 @@ signals: void seenLockedFile(const QString &fileName); private slots: + void onFolderEncryptedStatusFetchDone(); void slotStartDiscovery(); void slotFolderDiscovered(bool local, const QString &folder);