mirror of
https://github.com/nextcloud/desktop.git
synced 2024-11-22 04:55:48 +03:00
Show or hide multi-server overrides or text field depending on type of override url
Signed-off-by: Claudio Cambra <claudio.cambra@nextcloud.com>
This commit is contained in:
parent
eb843d7c64
commit
237b58d042
1 changed files with 17 additions and 3 deletions
|
@ -25,6 +25,8 @@
|
|||
#include <QPropertyAnimation>
|
||||
#include <QGraphicsPixmapItem>
|
||||
#include <QBuffer>
|
||||
#include <QJsonArray>
|
||||
#include <QJsonDocument>
|
||||
|
||||
#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();
|
||||
|
|
Loading…
Reference in a new issue