Include Nextcloud in the search for legacy config when the client is branded.
authorCamila Ayres <hello@camilasan.com>
Tue, 10 Dec 2024 16:40:08 +0000 (17:40 +0100)
committerbackportbot[bot] <backportbot[bot]@users.noreply.github.com>
Wed, 11 Dec 2024 08:12:07 +0000 (08:12 +0000)
Signed-off-by: Camila Ayres <hello@camilasan.com>
src/gui/accountmanager.cpp

index 6619e70fee7254d6777771657e23a7d711319866..a661f3eb3f253ba1015c05a909a41d9e4442193a 100644 (file)
@@ -73,6 +73,9 @@ constexpr auto networkProxyPasswordKeychainKeySuffixC = "_proxy_password";
 constexpr auto legacyRelativeConfigLocationC = "/ownCloud/owncloud.cfg";
 constexpr auto legacyCfgFileNameC = "owncloud.cfg";
 
+constexpr auto unbrandedRelativeConfigLocationC = "/Nextcloud/nextcloud.cfg";
+constexpr auto unbrandedCfgFileNameC = "nextcloud.cfg";
+
 // The maximum versions that this client can read
 constexpr auto maxAccountsVersion = 2;
 constexpr auto maxAccountVersion = 1;
@@ -192,10 +195,16 @@ bool AccountManager::restoreFromLegacySettings()
         const auto legacyCfgFileNamePath = QString(QStringLiteral("/") + legacyCfgFileNameC);
         const auto legacyCfgFileRelativePath = QString(legacyRelativeConfigLocationC);
 
-        const auto legacyLocations = QVector<QString>{legacy2_4CfgFileParentFolder + legacyCfgFileRelativePath,
-                                                      legacy2_5CfgFileParentFolder + legacyCfgFileRelativePath,
-                                                      legacyCfgFileParentFolder + legacyCfgFileNamePath,
-                                                      legacyCfgFileGrandParentFolder + legacyCfgFileRelativePath};
+        auto legacyLocations = QVector<QString>{legacy2_4CfgFileParentFolder + legacyCfgFileRelativePath,
+                                                legacy2_5CfgFileParentFolder + legacyCfgFileRelativePath,
+                                                legacyCfgFileParentFolder + legacyCfgFileNamePath,
+                                                legacyCfgFileGrandParentFolder + legacyCfgFileRelativePath};
+
+        if (Theme::instance()->isBranded()) {
+            const auto unbrandedCfgFileNamePath = QString(QStringLiteral("/") + unbrandedCfgFileNameC);
+            const auto unbrandedCfgFileRelativePath = QString(unbrandedRelativeConfigLocationC);
+            legacyLocations.append({legacyCfgFileParentFolder + unbrandedCfgFileNamePath, legacyCfgFileGrandParentFolder + unbrandedCfgFileRelativePath});
+        }
 
         for (const auto &configFile : legacyLocations) {
             auto oCSettings = std::make_unique<QSettings>(configFile, QSettings::IniFormat);