diff --git a/src/gui/wizard/owncloudsetuppage.cpp b/src/gui/wizard/owncloudsetuppage.cpp index a5374eb59..75ba4322a 100644 --- a/src/gui/wizard/owncloudsetuppage.cpp +++ b/src/gui/wizard/owncloudsetuppage.cpp @@ -25,6 +25,8 @@ #include #include #include +#include +#include #include "QProgressIndicator.h" @@ -47,15 +49,27 @@ OwncloudSetupPage::OwncloudSetupPage(QWidget *parent) setupServerAddressDescriptionLabel(); - Theme *theme = Theme::instance(); + const auto theme = Theme::instance(); if (theme->overrideServerUrl().isEmpty()) { + _ui.comboBox->hide(); _ui.leUrl->setPostfix(theme->wizardUrlPostfix()); _ui.leUrl->setPlaceholderText(theme->wizardUrlHint()); - } else if (Theme::instance()->forceOverrideServerUrl()) { + } else if (theme->multipleOverrideServers() && theme->forceOverrideServerUrl()) { + _ui.leUrl->hide(); + const auto overrideJsonUtf8 = theme->overrideServerUrl().toUtf8(); + const auto serversJsonArray = QJsonDocument::fromJson(overrideJsonUtf8).array(); + + for (const auto &serverJson : serversJsonArray) { + const auto serverObject = serverJson.toObject(); + const auto serverName = serverObject.value("name").toString(); + const auto serverUrl = serverObject.value("url").toString(); + _ui.comboBox->addItem(serverName, serverUrl); + } + } else if (theme->forceOverrideServerUrl()) { + _ui.comboBox->hide(); _ui.leUrl->setEnabled(false); } - registerField(QLatin1String("OCUrl*"), _ui.leUrl); auto sizePolicy = _progressIndi->sizePolicy();