Factor out the logic to start a new e2ee status job
authorKevin Ottens <kevin.ottens@nextcloud.com>
Tue, 20 Oct 2020 14:48:54 +0000 (16:48 +0200)
committerKevin Ottens <kevin.ottens@nextcloud.com>
Wed, 21 Oct 2020 08:00:58 +0000 (10:00 +0200)
Signed-off-by: Kevin Ottens <kevin.ottens@nextcloud.com>
src/libsync/clientsideencryption.cpp
src/libsync/clientsideencryption.h

index 13f3b791503016b26b9cfa5bc54662976689273d..a131206f2736fd9edbf178540437d9b78eda663b 100644 (file)
@@ -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<QString, bool>& result)
 {
     auto job = static_cast<GetFolderEncryptStatusJob *>(sender());
index eea0e4a97b952bee26f06387774209147b077c2d..355e965358d84be2086611108778bf5105ddba47 100644 (file)
@@ -111,6 +111,7 @@ signals:
     void folderEncryptedStatusFetchDone(const QHash<QString, bool> &values);
 
 private:
+    void scheduleFolderEncryptedStatusJob(const QString &path);
     void getPrivateKeyFromServer();
     void getPublicKeyFromServer();
     void decryptPrivateKey(const QByteArray &key);