summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKevin Smith <git@kismith.co.uk>2012-11-13 10:22:26 (GMT)
committerKevin Smith <git@kismith.co.uk>2012-11-13 10:50:16 (GMT)
commit5fcc96c17e4f97fb8946880fce1fedc6afd8ed21 (patch)
tree7cc354ab0c9dcf2606bbb3e29a2345fe0bfe0913
parent59c1b26ba8f85bfb52f7c8e95bf1eca208d3de7b (diff)
downloadswift-5fcc96c17e4f97fb8946880fce1fedc6afd8ed21.zip
swift-5fcc96c17e4f97fb8946880fce1fedc6afd8ed21.tar.bz2
Don't show -1 as default port in UI.
Change-Id: I6ef93c0ea63fc39daacea832775f0f883d01ee12 Resolves: #1177
-rw-r--r--Swift/QtUI/QtConnectionSettingsWindow.cpp8
1 files changed, 6 insertions, 2 deletions
diff --git a/Swift/QtUI/QtConnectionSettingsWindow.cpp b/Swift/QtUI/QtConnectionSettingsWindow.cpp
index 5bc2754..040b92a 100644
--- a/Swift/QtUI/QtConnectionSettingsWindow.cpp
+++ b/Swift/QtUI/QtConnectionSettingsWindow.cpp
@@ -61,25 +61,27 @@ QtConnectionSettingsWindow::QtConnectionSettingsWindow(const ClientOptions& opti
isDefault &= options.manualProxyPort == defaults.manualProxyPort;
if (isDefault) {
ui.connectionMethod->setCurrentIndex(0);
}
else {
ui.connectionMethod->setCurrentIndex(1);
ui.manual_useTLS->setCurrentIndex(options.useTLS);
ui.manual_allowPLAINWithoutTLS->setChecked(options.allowPLAINWithoutTLS);
ui.manual_allowCompression->setChecked(options.useStreamCompression);
if (!options.manualHostname.empty()) {
ui.manual_manualHost->setChecked(true);
ui.manual_manualHostName->setText(P2QSTRING(options.manualHostname));
- ui.manual_manualHostPort->setText(P2QSTRING(boost::lexical_cast<std::string>(options.manualPort)));
+ if (options.manualPort >=0) {
+ ui.manual_manualHostPort->setText(P2QSTRING(boost::lexical_cast<std::string>(options.manualPort)));
+ }
}
ui.manual_proxyType->setCurrentIndex(options.proxyType);
if (!options.manualProxyHostname.empty()) {
ui.manual_manualProxy->setChecked(true);
ui.manual_manualProxyHost->setText(P2QSTRING(options.manualProxyHostname));
ui.manual_manualHostPort->setText(P2QSTRING(boost::lexical_cast<std::string>(options.manualProxyPort)));
}
}
} else {
ui.connectionMethod->setCurrentIndex(2);
ui.bosh_uri->setText(P2QSTRING(options.boshURL.toString()));
if (!options.boshHTTPConnectProxyURL.isEmpty()) {
@@ -103,25 +105,27 @@ ClientOptions QtConnectionSettingsWindow::getOptions() {
ClientOptions options;
if (ui.connectionMethod->currentIndex() > 0) {
/* Not automatic */
if (ui.connectionMethod->currentIndex() == 1) {
/* Manual */
options.useTLS = static_cast<ClientOptions::UseTLS>(ui.manual_useTLS->currentIndex());
options.useStreamCompression = ui.manual_allowCompression->isChecked();
options.allowPLAINWithoutTLS = ui.manual_allowPLAINWithoutTLS->isChecked();
if (ui.manual_manualHost->isChecked()) {
options.manualHostname = Q2PSTRING(ui.manual_manualHostName->text());
try {
options.manualPort = boost::lexical_cast<int>(Q2PSTRING(ui.manual_manualHostPort->text()));
- } catch (const boost::bad_lexical_cast&) {}
+ } catch (const boost::bad_lexical_cast&) {
+ options.manualPort = -1;
+ }
}
options.proxyType = static_cast<ClientOptions::ProxyType>(ui.manual_proxyType->currentIndex());
if (ui.manual_manualProxy->isChecked()) {
options.manualProxyHostname = Q2PSTRING(ui.manual_manualProxyHost->text());
try {
options.manualProxyPort = boost::lexical_cast<int>(Q2PSTRING(ui.manual_manualProxyPort->text()));
} catch (const boost::bad_lexical_cast&) {}
}
}
else {
/* BOSH */
options.boshURL = URL::fromString(Q2PSTRING(ui.bosh_uri->text()));