@@ -486,6 +486,15 @@ void Application::setupAccountsAndFolders()
486486 _folderManager.reset (new FolderMan);
487487
488488 const auto accountsRestoreResult = restoreLegacyAccount ();
489+ const auto accounts = AccountManager::instance ()->accounts ();
490+ if (accountsRestoreResult != AccountManager::AccountsRestoreSuccessFromLegacyVersion
491+ && accounts.empty ()) {
492+ qCWarning (lcApplication) << " Migration result: " << accountsRestoreResult;
493+ qCDebug (lcApplication) << " is migration disabled?" << DISABLE_ACCOUNT_MIGRATION;
494+ qCWarning (lcApplication) << " No accounts were migrated, prompting user to set up accounts and folders from scratch." ;
495+
496+ return ;
497+ }
489498
490499 const auto foldersListSize = FolderMan::instance ()->setupFolders ();
491500 FolderMan::instance ()->setSyncEnabled (true );
@@ -498,39 +507,31 @@ void Application::setupAccountsAndFolders()
498507 return list.join (" \n " );
499508 };
500509
501- if (const auto accounts = AccountManager::instance ()->accounts ();
502- accountsRestoreResult == AccountManager::AccountsRestoreSuccessFromLegacyVersion
503- && !accounts.isEmpty ()) {
504-
505- const auto accountsListSize = accounts.size ();
506- if (Theme::instance ()->displayLegacyImportDialog ()) {
507- const auto accountsRestoreMessage = accountsListSize > 1
508- ? tr (" %1 accounts" , " number of accounts imported" ).arg (QString::number (accountsListSize))
509- : tr (" 1 account" );
510- const auto foldersRestoreMessage = foldersListSize > 1
511- ? tr (" %1 folders" , " number of folders imported" ).arg (QString::number (foldersListSize))
512- : tr (" 1 folder" );
513- const auto messageBox = new QMessageBox (QMessageBox::Information,
514- tr (" Legacy import" ),
515- tr (" Imported %1 and %2 from a legacy desktop client.\n %3" ,
516- " number of accounts and folders imported. list of users." )
517- .arg (accountsRestoreMessage,
518- foldersRestoreMessage,
519- prettyNamesList (accounts))
520- );
521- messageBox->setWindowModality (Qt::NonModal);
522- messageBox->open ();
523- }
524-
525- qCWarning (lcApplication) << " Migration result AccountManager::AccountsRestoreResult:" << accountsRestoreResult;
526- qCWarning (lcApplication) << " Folders migrated: " << foldersListSize;
527- qCWarning (lcApplication) << accountsListSize << " account(s) were migrated:" << prettyNamesList (accounts);
528-
529- } else {
530- qCWarning (lcApplication) << " Migration result AccountManager::AccountsRestoreResult: " << accountsRestoreResult;
531- qCWarning (lcApplication) << " Folders migrated: " << foldersListSize;
532- qCWarning (lcApplication) << " No accounts were migrated, prompting user to set up accounts and folders from scratch." ;
510+ const auto accountsListSize = accounts.size ();
511+ if (accountsRestoreResult == AccountManager::AccountsRestoreSuccessFromLegacyVersion
512+ && Theme::instance ()->displayLegacyImportDialog ()
513+ && !AccountManager::instance ()->forceLegacyImport ()) {
514+ const auto accountsRestoreMessage = accountsListSize > 1
515+ ? tr (" %1 accounts" , " number of accounts imported" ).arg (QString::number (accountsListSize))
516+ : tr (" 1 account" );
517+ const auto foldersRestoreMessage = foldersListSize > 1
518+ ? tr (" %1 folders" , " number of folders imported" ).arg (QString::number (foldersListSize))
519+ : tr (" 1 folder" );
520+ const auto messageBox = new QMessageBox (QMessageBox::Information,
521+ tr (" Legacy import" ),
522+ tr (" Imported %1 and %2 from a legacy desktop client.\n %3" ,
523+ " number of accounts and folders imported. list of users." )
524+ .arg (accountsRestoreMessage,
525+ foldersRestoreMessage,
526+ prettyNamesList (accounts))
527+ );
528+ messageBox->setWindowModality (Qt::NonModal);
529+ messageBox->open ();
533530 }
531+
532+ qCWarning (lcApplication) << " Account(s) setup result:" << accountsRestoreResult;
533+ qCWarning (lcApplication) << foldersListSize << " folder(s) migrated" ;
534+ qCWarning (lcApplication) << accountsListSize << " account(s) migrated:" << prettyNamesList (accounts);
534535}
535536
536537void Application::setupConfigFile ()
0 commit comments