Skip to content
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
6 changes: 4 additions & 2 deletions src/gui/accountmanager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -337,19 +337,21 @@ bool AccountManager::restoreFromLegacySettings()
if (!settings->childKeys().isEmpty()) {
settings->beginGroup(accountsC);
const auto childGroups = selectedAccountIds.isEmpty() ? settings->childGroups() : selectedAccountIds;
auto accountsLoaded = false;
for (const auto &accountId : childGroups) {
settings->beginGroup(accountId);
const auto acc = loadAccountHelper(*settings);
if (!acc) {
continue;
}
addAccount(acc);
accountsLoaded = true;
migrateNetworkSettings(acc, *settings);
settings->endGroup();
}
configFile.cleanupGlobalNetworkConfiguration();
ClientProxy().cleanupGlobalNetworkConfiguration();
return true;
ClientProxy().cleanupGlobalNetworkConfiguration();
return accountsLoaded;
}

if (wasLegacyImportDialogDisplayed) {
Expand Down
9 changes: 5 additions & 4 deletions src/gui/application.cpp
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
/*
* SPDX-FileCopyrightText: 2017 Nextcloud GmbH and Nextcloud contributors
* SPDX-FileCopyrightText: 2014 ownCloud GmbH
Expand Down Expand Up @@ -488,12 +488,11 @@
ConfigFile configFile;
configFile.setMigrationPhase(ConfigFile::MigrationPhase::SetupUsers);
const auto accountsRestoreResult = restoreLegacyAccount();
const auto accounts = AccountManager::instance()->accounts();
if (accountsRestoreResult != AccountManager::AccountsRestoreSuccessFromLegacyVersion
&& accounts.empty()) {
if (accountsRestoreResult == AccountManager::AccountsNotFound || accountsRestoreResult == AccountManager::AccountsRestoreFailure) {
qCWarning(lcApplication) << "Migration result: " << accountsRestoreResult;
qCDebug(lcApplication) << "is migration disabled?" << DISABLE_ACCOUNT_MIGRATION;
qCWarning(lcApplication) << "No accounts were migrated, prompting user to set up accounts and folders from scratch.";
configFile.setMigrationPhase(ConfigFile::MigrationPhase::Done);

return;
}
Expand All @@ -510,10 +509,12 @@
return list.join("\n");
};

const auto accounts = AccountManager::instance()->accounts();
const auto accountsListSize = accounts.size();
if (accountsRestoreResult == AccountManager::AccountsRestoreSuccessFromLegacyVersion
&& Theme::instance()->displayLegacyImportDialog()
&& !AccountManager::instance()->forceLegacyImport()) {
&& !AccountManager::instance()->forceLegacyImport()
&& accountsListSize > 0) {
const auto accountsRestoreMessage = accountsListSize > 1
? tr("%1 accounts", "number of accounts imported").arg(QString::number(accountsListSize))
: tr("1 account");
Expand Down
Loading