From 399b97442e09119d304d94266eb76d13467ad839 Mon Sep 17 00:00:00 2001 From: Kevin Ottens Date: Tue, 20 Oct 2020 16:48:54 +0200 Subject: [PATCH] Factor out the logic to start a new e2ee status job Signed-off-by: Kevin Ottens --- src/libsync/clientsideencryption.cpp | 18 +++++++++++------- src/libsync/clientsideencryption.h | 1 + 2 files changed, 12 insertions(+), 7 deletions(-) diff --git a/src/libsync/clientsideencryption.cpp b/src/libsync/clientsideencryption.cpp index 13f3b7915..a131206f2 100644 --- a/src/libsync/clientsideencryption.cpp +++ b/src/libsync/clientsideencryption.cpp @@ -1241,21 +1241,25 @@ void ClientSideEncryption::getPublicKeyFromServer() job->start(); } -void ClientSideEncryption::fetchFolderEncryptedStatus() +void ClientSideEncryption::scheduleFolderEncryptedStatusJob(const QString &path) { - _refreshingEncryptionStatus = true; - _folder2encryptedStatus.clear(); - - auto getEncryptedStatus = new GetFolderEncryptStatusJob(_account, QString()); + auto getEncryptedStatus = new GetFolderEncryptStatusJob(_account, path); connect(getEncryptedStatus, &GetFolderEncryptStatusJob::encryptStatusReceived, - this, &ClientSideEncryption::folderEncryptedStatusFetched); + this, &ClientSideEncryption::folderEncryptedStatusFetched); connect(getEncryptedStatus, &GetFolderEncryptStatusJob::encryptStatusError, - this, &ClientSideEncryption::folderEncryptedStatusError); + this, &ClientSideEncryption::folderEncryptedStatusError); getEncryptedStatus->start(); _folderStatusJobs.append(getEncryptedStatus); } +void ClientSideEncryption::fetchFolderEncryptedStatus() +{ + _refreshingEncryptionStatus = true; + _folder2encryptedStatus.clear(); + scheduleFolderEncryptedStatusJob(QString()); +} + void ClientSideEncryption::folderEncryptedStatusFetched(const QHash& result) { auto job = static_cast(sender()); diff --git a/src/libsync/clientsideencryption.h b/src/libsync/clientsideencryption.h index eea0e4a97..355e96535 100644 --- a/src/libsync/clientsideencryption.h +++ b/src/libsync/clientsideencryption.h @@ -111,6 +111,7 @@ signals: void folderEncryptedStatusFetchDone(const QHash &values); private: + void scheduleFolderEncryptedStatusJob(const QString &path); void getPrivateKeyFromServer(); void getPublicKeyFromServer(); void decryptPrivateKey(const QByteArray &key); -- 2.39.5