diff --git a/src/gui/wizard/owncloudconnectionmethoddialog.cpp b/src/gui/wizard/owncloudconnectionmethoddialog.cpp index 89a8d1fc26dde..cc10478a26ee4 100644 --- a/src/gui/wizard/owncloudconnectionmethoddialog.cpp +++ b/src/gui/wizard/owncloudconnectionmethoddialog.cpp @@ -24,6 +24,10 @@ void OwncloudConnectionMethodDialog::setUrl(const QUrl &url) ui->label->setText(tr("
Failed to connect to the secure server address %1. How do you wish to proceed?
").arg(url.toDisplayString().toHtmlEscaped())); } +void OwncloudConnectionMethodDialog::setHTTPOnly(const bool retryHTTPonly) +{ + ui->btnNoTLS->setEnabled(retryHTTPonly); +} void OwncloudConnectionMethodDialog::returnNoTLS() { diff --git a/src/gui/wizard/owncloudconnectionmethoddialog.h b/src/gui/wizard/owncloudconnectionmethoddialog.h index 90d4af03cc2c2..c4ec5fe520437 100644 --- a/src/gui/wizard/owncloudconnectionmethoddialog.h +++ b/src/gui/wizard/owncloudconnectionmethoddialog.h @@ -37,6 +37,7 @@ class OwncloudConnectionMethodDialog : public QDialog // The URL that was tried void setUrl(const QUrl &); + void setHTTPOnly(const bool); public slots: void returnNoTLS(); diff --git a/src/gui/wizard/owncloudsetuppage.cpp b/src/gui/wizard/owncloudsetuppage.cpp index 616d6527b2328..cc8dd7b14152d 100644 --- a/src/gui/wizard/owncloudsetuppage.cpp +++ b/src/gui/wizard/owncloudsetuppage.cpp @@ -349,35 +349,34 @@ void OwncloudSetupPage::setErrorString(const QString &err, bool retryHTTPonly) if (err.isEmpty()) { _ui.errorLabel->setVisible(false); } else { - if (retryHTTPonly) { - const auto urlString = url(); - auto url = QUrl::fromUserInput(urlString); - if (url.scheme() == "https") { - // Ask the user how to proceed when connecting to a https:// URL fails. - // It is possible that the server is secured with client-side TLS certificates, - // but that it has no way of informing the owncloud client that this is the case. - - OwncloudConnectionMethodDialog dialog; - dialog.setUrl(url); - // FIXME: Synchronous dialogs are not so nice because of event loop recursion - int retVal = dialog.exec(); - - switch (retVal) { - case OwncloudConnectionMethodDialog::No_TLS: { - url.setScheme("http"); - _ui.leUrl->setFullText(url.toString()); - // skip ahead to next page, since the user would expect us to retry automatically - wizard()->next(); - } break; - case OwncloudConnectionMethodDialog::Client_Side_TLS: - addCertDial->show(); - break; - case OwncloudConnectionMethodDialog::Closed: - case OwncloudConnectionMethodDialog::Back: - default: - // No-op. - break; - } + const auto urlString = url(); + auto url = QUrl::fromUserInput(urlString); + if (url.scheme() == "https") { + // Ask the user how to proceed when connecting to a https:// URL fails. + // It is possible that the server is secured with client-side TLS certificates, + // but that it has no way of informing the owncloud client that this is the case. + + OwncloudConnectionMethodDialog dialog; + dialog.setUrl(url); + dialog.setHTTPOnly(retryHTTPonly); + // FIXME: Synchronous dialogs are not so nice because of event loop recursion + int retVal = dialog.exec(); + + switch (retVal) { + case OwncloudConnectionMethodDialog::No_TLS: { + url.setScheme("http"); + _ui.leUrl->setFullText(url.toString()); + // skip ahead to next page, since the user would expect us to retry automatically + wizard()->next(); + } break; + case OwncloudConnectionMethodDialog::Client_Side_TLS: + addCertDial->show(); + break; + case OwncloudConnectionMethodDialog::Closed: + case OwncloudConnectionMethodDialog::Back: + default: + // No-op. + break; } }