From: Kevin Ottens Date: Tue, 20 Oct 2020 14:27:20 +0000 (+0200) Subject: Start managing a list of GetFolderEncryptStatusJob X-Git-Tag: archive/raspbian/3.16.7-1_deb13u1+rpi1~1^2~12^2~22^2~99^2~5 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=9aeb7046d2e17705eb0c6d921b5db251e093e1b1;p=nextcloud-desktop.git Start managing a list of GetFolderEncryptStatusJob Signed-off-by: Kevin Ottens --- 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;