Don't ask user whether to import legacy account configs if forcing legacy import
authorClaudio Cambra <claudio.cambra@nextcloud.com>
Mon, 8 May 2023 12:24:41 +0000 (20:24 +0800)
committerClaudio Cambra <claudio.cambra@nextcloud.com>
Tue, 16 May 2023 13:23:43 +0000 (21:23 +0800)
Signed-off-by: Claudio Cambra <claudio.cambra@nextcloud.com>
src/gui/accountmanager.cpp

index d266bf54d798cc14f3893e932301f403e2195e97..205a8007c98f212b941e57e83492465e21a5f78b 100644 (file)
@@ -178,13 +178,15 @@ bool AccountManager::restoreFromLegacySettings()
             if (const QFileInfo configFileInfo(configFile); configFileInfo.exists() && configFileInfo.isReadable()) {
                 qCInfo(lcAccountManager) << "Migrate: checking old config " << configFile;
 
-                const auto importQuestion = tr("An existing configuration from a legacy desktop client was detected.\n"
-                                               "Should an account import be attempted?");
-                const auto messageBoxSelection = QMessageBox::question(nullptr, tr("Legacy import"), importQuestion);
-
-                if (messageBoxSelection == QMessageBox::No) {
-                    // User said don't import, return immediately
-                    return false;
+                if (!forceLegacyImport()) {
+                    const auto importQuestion = tr("An existing configuration from a legacy desktop client was detected.\n"
+                                                   "Should an account import be attempted?");
+                    const auto messageBoxSelection = QMessageBox::question(nullptr, tr("Legacy import"), importQuestion);
+
+                    if (messageBoxSelection == QMessageBox::No) {
+                        // User said don't import, return immediately
+                        return false;
+                    }
                 }
 
                 auto oCSettings = std::make_unique<QSettings>(configFile, QSettings::IniFormat);