diff --git a/src/gui/accountmanager.cpp b/src/gui/accountmanager.cpp index a2cfd8d1b..93b5d5dba 100644 --- a/src/gui/accountmanager.cpp +++ b/src/gui/accountmanager.cpp @@ -249,7 +249,6 @@ void AccountManager::save(bool saveCredentials) for (const auto &acc : qAsConst(_accounts)) { settings->beginGroup(acc->account()->id()); saveAccountHelper(acc->account().data(), *settings, saveCredentials); - acc->writeToSettings(*settings); settings->endGroup(); } @@ -274,7 +273,6 @@ void AccountManager::saveAccountState(AccountState *a) qCDebug(lcAccountManager) << "Saving account state" << a->account()->url().toString(); const auto settings = ConfigFile::settingsWithGroup(QLatin1String(accountsC)); settings->beginGroup(a->account()->id()); - a->writeToSettings(*settings); settings->endGroup(); settings->sync(); diff --git a/src/gui/accountsettings.cpp b/src/gui/accountsettings.cpp index f9c6dc4de..61b6fcb46 100644 --- a/src/gui/accountsettings.cpp +++ b/src/gui/accountsettings.cpp @@ -1521,33 +1521,6 @@ void AccountSettings::refreshSelectiveSyncStatus() } } -void AccountSettings::slotDeleteAccount() -{ - // Deleting the account potentially deletes 'this', so - // the QMessageBox should be destroyed before that happens. - const auto messageBox = new QMessageBox(QMessageBox::Question, - tr("Confirm Account Removal"), - tr("
Do you really want to remove the connection to the account %1?
" - "Note: This will not delete any files.
") - .arg(_accountState->account()->displayName()), - QMessageBox::NoButton, - this); - const auto yesButton = messageBox->addButton(tr("Remove connection"), QMessageBox::YesRole); - messageBox->addButton(tr("Cancel"), QMessageBox::NoRole); - messageBox->setAttribute(Qt::WA_DeleteOnClose); - connect(messageBox, &QMessageBox::finished, this, [this, messageBox, yesButton]{ - if (messageBox->clickedButton() == yesButton) { - // Else it might access during destruction. This should be better handled by it having a QSharedPointer - _model->setAccountState(nullptr); - - const auto manager = AccountManager::instance(); - manager->deleteAccount(_accountState); - manager->save(); - } - }); - messageBox->open(); -} - bool AccountSettings::event(QEvent *e) { if (e->type() == QEvent::Hide || e->type() == QEvent::Show) { diff --git a/src/gui/accountsettings.h b/src/gui/accountsettings.h index be70931d8..83e6ff026 100644 --- a/src/gui/accountsettings.h +++ b/src/gui/accountsettings.h @@ -93,7 +93,6 @@ protected slots: void slotSetSubFolderAvailability(OCC::Folder *folder, const QString &path, OCC::PinState state); void slotFolderWizardAccepted(); void slotFolderWizardRejected(); - void slotDeleteAccount(); void slotToggleSignInState(); void refreshSelectiveSyncStatus(); void slotMarkSubfolderEncrypted(OCC::FolderStatusModel::SubFolderInfo *folderInfo); diff --git a/src/gui/accountstate.cpp b/src/gui/accountstate.cpp index 372fa218f..6bcf4e4ce 100644 --- a/src/gui/accountstate.cpp +++ b/src/gui/accountstate.cpp @@ -83,10 +83,6 @@ AccountState *AccountState::loadFromSettings(AccountPtr account, QSettings & /*s return accountState; } -void AccountState::writeToSettings(QSettings & /*settings*/) -{ -} - AccountPtr AccountState::account() const { return _account; diff --git a/src/gui/accountstate.h b/src/gui/accountstate.h index 67b58c002..d1ee6f44a 100644 --- a/src/gui/accountstate.h +++ b/src/gui/accountstate.h @@ -93,12 +93,6 @@ public: */ static AccountState *loadFromSettings(AccountPtr account, QSettings &settings); - /** Writes account state information to settings. - * - * It does not write the Account data. - */ - void writeToSettings(QSettings &settings); - AccountPtr account() const; ConnectionStatus connectionStatus() const; diff --git a/src/libsync/account.cpp b/src/libsync/account.cpp index 8c5244eed..07ac81a18 100644 --- a/src/libsync/account.cpp +++ b/src/libsync/account.cpp @@ -807,10 +807,14 @@ void Account::deleteAppPassword() job->setKey(kck); connect(job, &DeletePasswordJob::finished, [this](Job *incoming) { auto *deleteJob = dynamic_cast