From 9aeb7046d2e17705eb0c6d921b5db251e093e1b1 Mon Sep 17 00:00:00 2001 From: Kevin Ottens Date: Tue, 20 Oct 2020 16:27:20 +0200 Subject: [PATCH] Start managing a list of GetFolderEncryptStatusJob Signed-off-by: Kevin Ottens --- src/libsync/clientsideencryption.cpp | 15 ++++++++++++++- src/libsync/clientsideencryption.h | 3 +++ 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/src/libsync/clientsideencryption.cpp b/src/libsync/clientsideencryption.cpp index 7d6c0ef45..f59051830 100644 --- a/src/libsync/clientsideencryption.cpp +++ b/src/libsync/clientsideencryption.cpp @@ -1241,7 +1241,8 @@ void ClientSideEncryption::getPublicKeyFromServer() job->start(); } -void ClientSideEncryption::fetchFolderEncryptedStatus() { +void ClientSideEncryption::fetchFolderEncryptedStatus() +{ _refreshingEncryptionStatus = true; auto getEncryptedStatus = new GetFolderEncryptStatusJob(_account, QString()); connect(getEncryptedStatus, &GetFolderEncryptStatusJob::encryptStatusReceived, @@ -1249,10 +1250,17 @@ void ClientSideEncryption::fetchFolderEncryptedStatus() { connect(getEncryptedStatus, &GetFolderEncryptStatusJob::encryptStatusError, this, &ClientSideEncryption::folderEncryptedStatusError); getEncryptedStatus->start(); + + _folderStatusJobs.append(getEncryptedStatus); } void ClientSideEncryption::folderEncryptedStatusFetched(const QHash& result) { + auto job = static_cast(sender()); + Q_ASSERT(job); + + _folderStatusJobs.removeAll(job); + _refreshingEncryptionStatus = false; _folder2encryptedStatus = result; qCDebug(lcCse) << "Retrieved correctly the encrypted status of the folders." << result; @@ -1261,6 +1269,11 @@ void ClientSideEncryption::folderEncryptedStatusFetched(const QHash(sender()); + Q_ASSERT(job); + + _folderStatusJobs.removeAll(job); + _refreshingEncryptionStatus = false; qCDebug(lcCse) << "Failed to retrieve the status of the folders." << error; emit folderEncryptedStatusFetchDone({}); diff --git a/src/libsync/clientsideencryption.h b/src/libsync/clientsideencryption.h index 13ec98043..eea0e4a97 100644 --- a/src/libsync/clientsideencryption.h +++ b/src/libsync/clientsideencryption.h @@ -23,6 +23,8 @@ class ReadPasswordJob; namespace OCC { +class GetFolderEncryptStatusJob; + QString baseUrl(); namespace EncryptionHelper { @@ -125,6 +127,7 @@ private: //TODO: Save this on disk. QHash _folder2token; QHash _folder2encryptedStatus; + QVector _folderStatusJobs; public: //QSslKey _privateKey; -- 2.30.2