Skip to content

Commit

Permalink
Check for the option to display legacy import dialog.
Browse files Browse the repository at this point in the history
Signed-off-by: Camila Ayres <hello@camilasan.com>
  • Loading branch information
camilasan committed Dec 9, 2024
1 parent aebf9a4 commit e4fd4ca
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions src/gui/accountmanager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,8 @@ bool AccountManager::restoreFromLegacySettings()
// try to open the correctly themed settings
auto settings = ConfigFile::settingsWithGroup(Theme::instance()->appName());

auto displayMessageBoxWarning = false;
auto wasLegacyImportDialogDisplayed = false;
const auto displayLegacyImportDialog = Theme::instance()->displayLegacyImportDialog();

// if the settings file could not be opened, the childKeys list is empty
// then try to load settings from a very old place
Expand Down Expand Up @@ -206,10 +207,11 @@ bool AccountManager::restoreFromLegacySettings()
oCSettings->beginGroup(QLatin1String(accountsC));
const auto accountsListSize = oCSettings->childGroups().size();
oCSettings->endGroup();
if (const QFileInfo configFileInfo(configFile); configFileInfo.exists() && configFileInfo.isReadable()) {
displayMessageBoxWarning = true;
if (const QFileInfo configFileInfo(configFile);
configFileInfo.exists() && configFileInfo.isReadable()) {
qCInfo(lcAccountManager) << "Migrate: checking old config " << configFile;
if (!forceLegacyImport() && accountsListSize > 0) {
if (!forceLegacyImport() && accountsListSize > 0 && displayLegacyImportDialog) {
wasLegacyImportDialogDisplayed = true;
const auto importQuestion = accountsListSize > 1
? tr("%1 accounts were detected from a legacy desktop client.\n"
"Should the accounts be imported?").arg(QString::number(accountsListSize))
Expand Down Expand Up @@ -282,7 +284,7 @@ bool AccountManager::restoreFromLegacySettings()
return true;
}

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

0 comments on commit e4fd4ca

Please sign in to comment.