mirror of
https://github.com/nextcloud/desktop.git
synced 2024-12-22 05:34:33 +03:00
[CSE] Properly update UI status to encrypted / decrypted
This commit is contained in:
parent
56028759d5
commit
43332d3ac7
4 changed files with 22 additions and 1 deletions
|
@ -258,6 +258,11 @@ void AccountSettings::doExpand()
|
||||||
|
|
||||||
void AccountSettings::slotEncryptionFlagSuccess(const QByteArray& fileId)
|
void AccountSettings::slotEncryptionFlagSuccess(const QByteArray& fileId)
|
||||||
{
|
{
|
||||||
|
if (auto info = _model->infoForFileId(fileId)) {
|
||||||
|
accountsState()->account()->e2e()->setFolderEncryptedStatus(info->_path, true);
|
||||||
|
} else {
|
||||||
|
qCInfo(lcAccountSettings()) << "Could not get information from the current folder.";
|
||||||
|
}
|
||||||
auto lockJob = new LockEncryptFolderApiJob(accountsState()->account(), fileId);
|
auto lockJob = new LockEncryptFolderApiJob(accountsState()->account(), fileId);
|
||||||
connect(lockJob, &LockEncryptFolderApiJob::success,
|
connect(lockJob, &LockEncryptFolderApiJob::success,
|
||||||
this, &AccountSettings::slotLockFolderSuccess);
|
this, &AccountSettings::slotLockFolderSuccess);
|
||||||
|
@ -332,7 +337,16 @@ void AccountSettings::slotMarkSubfolderDecrypted(const QByteArray& fileId)
|
||||||
{
|
{
|
||||||
auto job = new OCC::DeleteApiJob(accountsState()->account(),
|
auto job = new OCC::DeleteApiJob(accountsState()->account(),
|
||||||
"ocs/v2.php/apps/end_to_end_encryption/api/v1/encrypted/" + QString(fileId));
|
"ocs/v2.php/apps/end_to_end_encryption/api/v1/encrypted/" + QString(fileId));
|
||||||
connect(job, &OCC::DeleteApiJob::result, [](int httpResponse) {
|
connect(job, &OCC::DeleteApiJob::result, [this, &fileId](int httpResponse) {
|
||||||
|
if (httpResponse == 200) {
|
||||||
|
if (auto info = _model->infoForFileId(fileId)) {
|
||||||
|
accountsState()->account()->e2e()->setFolderEncryptedStatus(info->_path, false);
|
||||||
|
} else {
|
||||||
|
qCInfo(lcAccountSettings()) << "Could not get information for the current path.";
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
qCInfo(lcAccountSettings()) << "Response different than 200, cannot set folder to false.";
|
||||||
|
}
|
||||||
qCInfo(lcAccountSettings) << "Decrypt Http Response" << httpResponse;
|
qCInfo(lcAccountSettings) << "Decrypt Http Response" << httpResponse;
|
||||||
});
|
});
|
||||||
job->start();
|
job->start();
|
||||||
|
|
|
@ -676,6 +676,11 @@ void ClientSideEncryption::publicKeyFetched(Job *incoming) {
|
||||||
job->start();
|
job->start();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ClientSideEncryption::setFolderEncryptedStatus(const QString& folder, bool status)
|
||||||
|
{
|
||||||
|
_folder2encryptedStatus[folder] = status;
|
||||||
|
}
|
||||||
|
|
||||||
void ClientSideEncryption::privateKeyFetched(Job *incoming) {
|
void ClientSideEncryption::privateKeyFetched(Job *incoming) {
|
||||||
ReadPasswordJob *readJob = static_cast<ReadPasswordJob *>(incoming);
|
ReadPasswordJob *readJob = static_cast<ReadPasswordJob *>(incoming);
|
||||||
|
|
||||||
|
|
|
@ -47,6 +47,7 @@ public:
|
||||||
|
|
||||||
// to be used together with FolderStatusModel::FolderInfo::_path.
|
// to be used together with FolderStatusModel::FolderInfo::_path.
|
||||||
bool isFolderEncrypted(const QString& path);
|
bool isFolderEncrypted(const QString& path);
|
||||||
|
void setFolderEncryptedStatus(const QString& path, bool status);
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void folderEncryptedStatusFetched(const QMap<QString, bool> &values);
|
void folderEncryptedStatusFetched(const QMap<QString, bool> &values);
|
||||||
|
|
|
@ -962,6 +962,7 @@ bool DeleteApiJob::finished()
|
||||||
|
|
||||||
const auto replyData = QString::fromUtf8(reply()->readAll());
|
const auto replyData = QString::fromUtf8(reply()->readAll());
|
||||||
qCInfo(lcJsonApiJob()) << "TMX Delete Job" << replyData;
|
qCInfo(lcJsonApiJob()) << "TMX Delete Job" << replyData;
|
||||||
|
emit result(statusCode);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue