Use the propagator to trigger the e2e info fetch

This is a much better place than the GUI, this way we ensure the
propagator is always operating of up to date information. Previously if
the propagator kicked in without user interaction from startup (not
showing the settings dialog) it would have no E2E information available
whatsoever... unsurprisingly it would thus take wrong information at
every turn.

Signed-off-by: Kevin Ottens <kevin.ottens@nextcloud.com>
This commit is contained in:
Kevin Ottens 2020-06-17 15:06:48 +02:00
parent 5f611d6e39
commit b3fb730d5a
3 changed files with 18 additions and 7 deletions

View file

@ -581,12 +581,6 @@ void FolderStatusModel::fetchMore(const QModelIndex &parent)
path += info->_path;
}
//TODO: This is the correct place, but this doesn't seems to be the right
// Way to call fetchFolderEncryptedStatus.
if (_accountState->account()->capabilities().clientSideEncryptionAvailable()) {
_accountState->account()->e2e()->fetchFolderEncryptedStatus();
}
auto *job = new LsColJob(_accountState->account(), path, this);
info->_fetchingJob = job;
job->setProperties(QList<QByteArray>() << "resourcetype"

View file

@ -510,7 +510,15 @@ void OwncloudPropagator::start(const SyncFileItemVector &items,
connect(_rootJob.data(), &PropagatorJob::finished, this, &OwncloudPropagator::emitFinished);
scheduleNextJob();
// 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();
}
}
const SyncOptions &OwncloudPropagator::syncOptions() const
@ -608,6 +616,13 @@ 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);

View file

@ -527,6 +527,8 @@ private slots:
_finishedEmited = true;
}
void onFolderEncryptedStatusFetchDone();
void scheduleNextJobImpl();
signals: