Factor out the logic to start a new e2ee status job

Signed-off-by: Kevin Ottens <kevin.ottens@nextcloud.com>
This commit is contained in:
Kevin Ottens 2020-10-20 16:48:54 +02:00
parent cbc40b5a15
commit 399b97442e
No known key found for this signature in database
GPG key ID: 074BBBCB8DECC9E2
2 changed files with 14 additions and 9 deletions

View file

@ -1241,19 +1241,23 @@ void ClientSideEncryption::getPublicKeyFromServer()
job->start();
}
void ClientSideEncryption::scheduleFolderEncryptedStatusJob(const QString &path)
{
auto getEncryptedStatus = new GetFolderEncryptStatusJob(_account, path);
connect(getEncryptedStatus, &GetFolderEncryptStatusJob::encryptStatusReceived,
this, &ClientSideEncryption::folderEncryptedStatusFetched);
connect(getEncryptedStatus, &GetFolderEncryptStatusJob::encryptStatusError,
this, &ClientSideEncryption::folderEncryptedStatusError);
getEncryptedStatus->start();
_folderStatusJobs.append(getEncryptedStatus);
}
void ClientSideEncryption::fetchFolderEncryptedStatus()
{
_refreshingEncryptionStatus = true;
_folder2encryptedStatus.clear();
auto getEncryptedStatus = new GetFolderEncryptStatusJob(_account, QString());
connect(getEncryptedStatus, &GetFolderEncryptStatusJob::encryptStatusReceived,
this, &ClientSideEncryption::folderEncryptedStatusFetched);
connect(getEncryptedStatus, &GetFolderEncryptStatusJob::encryptStatusError,
this, &ClientSideEncryption::folderEncryptedStatusError);
getEncryptedStatus->start();
_folderStatusJobs.append(getEncryptedStatus);
scheduleFolderEncryptedStatusJob(QString());
}
void ClientSideEncryption::folderEncryptedStatusFetched(const QHash<QString, bool>& result)

View 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);