diff --git a/src/gui/accountmanager.cpp b/src/gui/accountmanager.cpp index b631328cf3745..d9dbd5b4698cd 100644 --- a/src/gui/accountmanager.cpp +++ b/src/gui/accountmanager.cpp @@ -255,18 +255,6 @@ bool AccountManager::restoreFromLegacySettings() } settings->endGroup(); } -// const auto importedAccounts = legacyAccounts.size(); -// const auto messageBox = new QMessageBox(QMessageBox::Information, -// tr("Legacy import"), -// tr("Imported %1 account from legacy client%2.") -// .arg(QString::number(importedAccounts), -// importedAccounts > 0 -// ? legacyAccounts.join(", ").prepend(": ") -// : ""), -// QMessageBox::Ok); -// messageBox->setAttribute(Qt::WA_DeleteOnClose); -// //messageBox->setWindowModality(Qt::NonModal); -// messageBox->open(); return true; } diff --git a/src/gui/application.cpp b/src/gui/application.cpp index a207d130c02f4..4b71e5d2ff6cd 100644 --- a/src/gui/application.cpp +++ b/src/gui/application.cpp @@ -309,7 +309,7 @@ Application::Application(int &argc, char **argv) qCInfo(lcApplication) << "VFS suffix plugin is available"; } - _theme->setSystrayUseMonoIcons(cfg.monoIcons()); + _theme->setSystrayUseMonoIcons(ConfigFile().monoIcons()); connect(_theme, &Theme::systrayUseMonoIconsChanged, this, &Application::slotUseMonoIconsChanged); #if defined(Q_OS_WIN) @@ -430,15 +430,26 @@ bool Application::shouldExit() void Application::setupOrRestoreSettings() { // try to restore legacy accounts - if (restoreLegacyAccount()) { - // to do: notify users - } + const auto accountsRestored = restoreLegacyAccount(); _folderManager.reset(new FolderMan); FolderMan::instance()->setSyncEnabled(true); // try to restore legacy folders or set up folders - FolderMan::instance()->setupFolders(); + const auto foldersRestored = FolderMan::instance()->setupFolders(); + + if (accountsRestored == AccountManager::AccountsRestoreSuccessFromLegacyVersion) { + const auto importedAccounts = AccountManager::instance()->accounts(); + const auto messageBox = new QMessageBox(QMessageBox::Information, + tr("Legacy import"), + tr("Imported %1 account and %2 folders from legacy client.") + .arg(QString::number(importedAccounts.size()), + QString::number(foldersRestored)), + QMessageBox::Ok); + messageBox->setAttribute(Qt::WA_DeleteOnClose); + messageBox->setWindowModality(Qt::NonModal); + messageBox->open(); + } } void Application::createConfigFile() @@ -496,7 +507,7 @@ void Application::createConfigFile() } } -bool Application::restoreLegacyAccount() +AccountManager::AccountsRestoreResult Application::restoreLegacyAccount() { ConfigFile cfg; const auto tryMigrate = cfg.overrideServerUrl().isEmpty(); @@ -518,10 +529,9 @@ bool Application::restoreLegacyAccount() .arg(ConfigFile().configFile()), tr("Quit %1").arg(Theme::instance()->appNameGUI())); QTimer::singleShot(0, qApp, &QCoreApplication::quit); - return false; } } - return true; + return accountsRestoreResult; } void Application::slotAccountStateRemoved(AccountState *accountState) diff --git a/src/gui/application.h b/src/gui/application.h index 9970961854177..5f153c8381e4f 100644 --- a/src/gui/application.h +++ b/src/gui/application.h @@ -118,7 +118,7 @@ protected slots: void handleEditLocallyFromOptions(); - bool restoreLegacyAccount(); + AccountManager::AccountsRestoreResult restoreLegacyAccount(); void createConfigFile(); // Attempt to setup new settings or restore legacy settings // The settings include the accounts and folders saved in the config file