AccountManager: take theURL from the Theme rather than from the config if the theme...
authorOlivier Goffart <ogoffart@woboq.com>
Tue, 23 Feb 2016 17:10:11 +0000 (18:10 +0100)
committerOlivier Goffart <ogoffart@woboq.com>
Tue, 23 Feb 2016 17:10:11 +0000 (18:10 +0100)
That way an upgrade of the client can actually change the URL
Issue https://github.com/owncloud/enterprise/issues/1113

src/gui/accountmanager.cpp

index 0b5eed458829eb8e9deb26abbc851cac711bd3e3..590bfb692f7e354bd0454ea8f533ea28c3880953 100644 (file)
@@ -194,7 +194,14 @@ AccountPtr AccountManager::load(QSettings& settings)
 {
     auto acc = createAccount();
 
-    acc->setUrl(settings.value(QLatin1String(urlC)).toUrl());
+    QString overrideUrl = Theme::instance()->overrideServerUrl();
+    if( !overrideUrl.isEmpty() ) {
+        // if there is a overrideUrl, don't even bother reading from the config as all the accounts
+        // must use the overrideUrl
+        acc->setUrl(overrideUrl);
+    } else {
+        acc->setUrl(settings.value(QLatin1String(urlC)).toUrl());
+    }
 
     // We want to only restore settings for that auth type and the user value
     acc->_settingsMap.insert(QLatin1String(userC), settings.value(userC));