Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Only save accounts added by the wizard #9563

Merged
merged 2 commits into from
Apr 5, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 0 additions & 18 deletions src/gui/accountmanager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -230,18 +230,6 @@ void AccountManager::saveAccount(Account *a)
qCDebug(lcAccountManager) << "Saved account settings, status:" << settings->status();
}

void AccountManager::saveAccountState(AccountStatePtr a) const
{
qCDebug(lcAccountManager) << "Saving account state" << a->account()->url().toString();
auto settings = ConfigFile::settingsWithGroup(QLatin1String(accountsC));
settings->beginGroup(a->account()->id());
a->writeToSettings(*settings);
settings->endGroup();

settings->sync();
qCDebug(lcAccountManager) << "Saved account state settings, status:" << settings->status();
}

QStringList AccountManager::accountNames() const
{
QStringList accounts;
Expand Down Expand Up @@ -378,12 +366,6 @@ AccountStatePtr AccountManager::addAccount(const AccountPtr &newAccount)

AccountStatePtr newAccountState(AccountState::fromNewAccount(newAccount));
addAccountState(newAccountState);

// saving once after adding makes sure the account is stored in the config in a working state
// this is needed to ensure a consistent state in the config file upon unexpected terminations of the client
// (for instance, when running from a debugger and stopping the process from there)
saveAccount(newAccount.get());

return newAccountState;
}

Expand Down
4 changes: 0 additions & 4 deletions src/gui/accountmanager.h
Original file line number Diff line number Diff line change
Expand Up @@ -110,10 +110,6 @@ public slots:
/// Saves account data, not including the credentials
void saveAccount(Account *a);

/// Saves account state data, not including the account
void saveAccountState(AccountStatePtr a) const;


Q_SIGNALS:
void accountAdded(AccountStatePtr account);
void accountRemoved(AccountStatePtr account);
Expand Down
4 changes: 4 additions & 0 deletions src/gui/owncloudgui.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,10 @@ void setUpInitialSyncFolder(AccountStatePtr accountStatePtr)
auto validator = new ConnectionValidator(account, account.data());
QObject::connect(validator, &ConnectionValidator::connectionResult, account.data(), [accountStatePtr](ConnectionValidator::Status status, const QStringList &errors) {
if (OC_ENSURE(status == ConnectionValidator::Connected)) {
// saving once after adding makes sure the account is stored in the config in a working state
// this is needed to ensure a consistent state in the config file upon unexpected terminations of the client
// (for instance, when running from a debugger and stopping the process from there)
AccountManager::instance()->saveAccount(accountStatePtr->account().data());
QString localFolder = initLocalFolder();
auto folderMan = FolderMan::instance();
if (accountStatePtr->account()->capabilities().spacesSupport().enabled) {
Expand Down