Skip to content

Commit

Permalink
Merge pull request #6383 from nextcloud/backport/6381/stable-3.11
Browse files Browse the repository at this point in the history
[stable-3.11] Fix: remove failure to import legacy account notification.
  • Loading branch information
mgallien authored Jan 25, 2024
2 parents 674e190 + 27ba118 commit 0b1988e
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions src/gui/accountmanager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,8 @@ bool AccountManager::restoreFromLegacySettings()
// try to open the correctly themed settings
auto settings = ConfigFile::settingsWithGroup(Theme::instance()->appName());

auto displayMessageBoxWarning = false;

// if the settings file could not be opened, the childKeys list is empty
// then try to load settings from a very old place
if (settings->childKeys().isEmpty()) {
Expand Down Expand Up @@ -189,6 +191,7 @@ bool AccountManager::restoreFromLegacySettings()
const auto accountsListSize = oCSettings->childGroups().size();
oCSettings->endGroup();
if (const QFileInfo configFileInfo(configFile); configFileInfo.exists() && configFileInfo.isReadable()) {
displayMessageBoxWarning = true;
qCInfo(lcAccountManager) << "Migrate: checking old config " << configFile;
if (!forceLegacyImport() && accountsListSize > 0) {
const auto importQuestion = accountsListSize > 1
Expand Down Expand Up @@ -256,16 +259,19 @@ bool AccountManager::restoreFromLegacySettings()
for (const auto &accountId : childGroups) {
settings->beginGroup(accountId);
if (const auto acc = loadAccountHelper(*settings)) {
addAccount(acc);
addAccount(acc);
}
settings->endGroup();
}
return true;
}

QMessageBox::information(nullptr,
tr("Legacy import"),
tr("Could not import accounts from legacy client configuration."));
if (displayMessageBoxWarning) {
QMessageBox::information(nullptr,
tr("Legacy import"),
tr("Could not import accounts from legacy client configuration."));
}

return false;
}

Expand Down

0 comments on commit 0b1988e

Please sign in to comment.