From b3f83dfb292209652bf56b8e5e0e802cfbac0093 Mon Sep 17 00:00:00 2001 From: Matthieu Gallien Date: Fri, 8 Mar 2024 12:22:56 +0100 Subject: [PATCH] allow wipe feature to delete data of a wiped user account Signed-off-by: Matthieu Gallien --- src/gui/application.cpp | 5 +++-- src/gui/remotewipe.cpp | 18 ++++++++++-------- 2 files changed, 13 insertions(+), 10 deletions(-) diff --git a/src/gui/application.cpp b/src/gui/application.cpp index c318868907887..ab866ba4ff099 100644 --- a/src/gui/application.cpp +++ b/src/gui/application.cpp @@ -438,10 +438,11 @@ Application::~Application() void Application::setupAccountsAndFolders() { - const auto accountsRestoreResult = restoreLegacyAccount(); - _folderManager.reset(new FolderMan); FolderMan::instance()->setSyncEnabled(true); + + const auto accountsRestoreResult = restoreLegacyAccount(); + const auto foldersListSize = FolderMan::instance()->setupFolders(); const auto prettyNamesList = [](const QList &accounts) { diff --git a/src/gui/remotewipe.cpp b/src/gui/remotewipe.cpp index c22d495695b38..3d285637fb497 100644 --- a/src/gui/remotewipe.cpp +++ b/src/gui/remotewipe.cpp @@ -34,10 +34,13 @@ RemoteWipe::RemoteWipe(AccountPtr account, QObject *parent) this, [=](AccountState *) { _accountRemoved = true; }); - QObject::connect(this, &RemoteWipe::authorized, FolderMan::instance(), - &FolderMan::slotWipeFolderForAccount); - QObject::connect(FolderMan::instance(), &FolderMan::wipeDone, this, - &RemoteWipe::notifyServerSuccessJob); + if (FolderMan::instance()) { + QObject::connect(this, &RemoteWipe::authorized, FolderMan::instance(), + &FolderMan::slotWipeFolderForAccount); + QObject::connect(FolderMan::instance(), &FolderMan::wipeDone, this, + &RemoteWipe::notifyServerSuccessJob); + } + QObject::connect(_account.data(), &Account::appPasswordRetrieved, this, &RemoteWipe::startCheckJobWithAppPassword); } @@ -109,13 +112,12 @@ void RemoteWipe::checkJobSlot() _account->setRemoteWipeRequested_HACK(); // <-- FIXME MS@2019-12-07 - // delete account - manager->deleteAccount(accountState); - manager->save(); - // delete data emit authorized(accountState); + // delete account + manager->deleteAccount(accountState); + manager->save(); } else { // ask user for his credentials again accountState->handleInvalidCredentials();