Skip to content

Commit

Permalink
Fix: remove failure to import legacy account notification.
Browse files Browse the repository at this point in the history
- It was being displayed even on a fresh install.
- We are already displaying a notification when there are accounts to be
imported and we ask the user on what to do.

Signed-off-by: Camila Ayres <[email protected]>
  • Loading branch information
camilasan authored and backportbot[bot] committed Jan 25, 2024
1 parent 674e190 commit 27ba118
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 27ba118

Please sign in to comment.