diff options
Diffstat (limited to 'Swift/QtUI/QtConnectionSettingsWindow.cpp')
-rw-r--r-- | Swift/QtUI/QtConnectionSettingsWindow.cpp | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/Swift/QtUI/QtConnectionSettingsWindow.cpp b/Swift/QtUI/QtConnectionSettingsWindow.cpp index ea693cf..2da527a 100644 --- a/Swift/QtUI/QtConnectionSettingsWindow.cpp +++ b/Swift/QtUI/QtConnectionSettingsWindow.cpp @@ -17,7 +17,10 @@ #include <QTextEdit> #include <QFile> #include <QTextStream> +#include <QMessageBox> + #include <Swift/QtUI/QtSwiftUtil.h> +#include <Swift/QtUI/QtURLValidator.h> namespace Swift { @@ -43,6 +46,11 @@ QtConnectionSettingsWindow::QtConnectionSettingsWindow(const ClientOptions& opti connect(ui.manual_proxyType, SIGNAL(currentIndexChanged(int)), SLOT(handleProxyTypeChanged(int))); + connect(ui.buttonBox, SIGNAL(accepted()), this, SLOT(handleAcceptRequested())); + + QtURLValidator* urlValidator = new QtURLValidator(this); + ui.bosh_uri->setValidator(urlValidator); + ui.manual_useTLS->setCurrentIndex(2); ui.manual_proxyType->setCurrentIndex(0); @@ -101,6 +109,15 @@ void QtConnectionSettingsWindow::handleProxyTypeChanged(int index) { ui.manual_manualProxyPort->setVisible(proxySettingsVisible); } +void QtConnectionSettingsWindow::handleAcceptRequested() { + if (ui.connectionMethod->currentIndex() != 2 || ui.bosh_uri->hasAcceptableInput()) { + accept(); + } + else { + QMessageBox::critical(this, tr("Configuration invalid"), tr("The provided BOSH URL is not valid.")); + } +} + ClientOptions QtConnectionSettingsWindow::getOptions() { ClientOptions options; if (ui.connectionMethod->currentIndex() > 0) { |