Skip to content

Commit

Permalink
Merge pull request #6381 from nextcloud/bugfix/issue/6380
Browse files Browse the repository at this point in the history
Fix: remove failure to import legacy account notification.
  • Loading branch information
mgallien authored Jan 25, 2024
2 parents 81847f9 + 0ae7695 commit 1e7654b
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 1e7654b

Please sign in to comment.