зеркало из https://github.com/nextcloud/desktop.git
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:
Родитель
e3979ea52f
Коммит
1decedd56f
|
@ -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();
|
||||
|
|
Загрузка…
Ссылка в новой задаче