Check for the option to display legacy import dialog.
authorCamila Ayres <hello@camilasan.com>
Mon, 9 Dec 2024 10:24:16 +0000 (11:24 +0100)
committerMatthieu Gallien <matthieu.gallien@nextcloud.com>
Mon, 9 Dec 2024 17:36:27 +0000 (18:36 +0100)
Signed-off-by: Camila Ayres <hello@camilasan.com>
src/gui/accountmanager.cpp

index f27d2742703a77bd28c55d2e92c580855e19f859..6619e70fee7254d6777771657e23a7d711319866 100644 (file)
@@ -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
@@ -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))
@@ -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."));