X-Git-Url: https://git.quassel-irc.org/?p=quassel.git;a=blobdiff_plain;f=src%2Fqtui%2Fsettingspages%2Fnetworkssettingspage.cpp;h=7976cca4a06b5f45360e49bcf20a053bcc785311;hp=cca20e74ebfc576ec5cb4ed8ab63138d7fb022ed;hb=0d418069762066b4640250efd5ba8d68bf0af178;hpb=5221b0b4d044d214539a1932a7a2eefbe88e4a66 diff --git a/src/qtui/settingspages/networkssettingspage.cpp b/src/qtui/settingspages/networkssettingspage.cpp index cca20e74..7976cca4 100644 --- a/src/qtui/settingspages/networkssettingspage.cpp +++ b/src/qtui/settingspages/networkssettingspage.cpp @@ -786,6 +786,11 @@ NetworkAddDlg::NetworkAddDlg(const QStringList &exist, QWidget *parent) : QDialo ui.setupUi(this); ui.useSSL->setIcon(QIcon::fromTheme("document-encrypt")); + // Whenever useSSL is toggled, update the port number if not changed from the default + connect(ui.useSSL, SIGNAL(toggled(bool)), SLOT(updateSslPort(bool))); + // Do NOT call updateSslPort when loading settings, otherwise port settings may be overriden. + // If useSSL is later changed to be checked by default, change port's default value, too. + if (Client::coreFeatures() & Quassel::VerifyServerSSL) { // Synchronize requiring SSL with the use SSL checkbox ui.sslVerify->setEnabled(ui.useSSL->isChecked()); @@ -849,6 +854,19 @@ void NetworkAddDlg::setButtonStates() } +void NetworkAddDlg::updateSslPort(bool isChecked) +{ + // "Use encrypted connection" was toggled, check the state... + if (isChecked && ui.port->value() == Network::PORT_PLAINTEXT) { + // Had been using the plain-text port, use the SSL default + ui.port->setValue(Network::PORT_SSL); + } else if (!isChecked && ui.port->value() == Network::PORT_SSL) { + // Had been using the SSL port, use the plain-text default + ui.port->setValue(Network::PORT_PLAINTEXT); + } +} + + /************************************************************************** * NetworkEditDlg *************************************************************************/ @@ -915,6 +933,11 @@ ServerEditDlg::ServerEditDlg(const Network::Server &server, QWidget *parent) : Q ui.sslVersion->hide(); } + // Whenever useSSL is toggled, update the port number if not changed from the default + connect(ui.useSSL, SIGNAL(toggled(bool)), SLOT(updateSslPort(bool))); + // Do NOT call updateSslPort when loading settings, otherwise port settings may be overriden. + // If useSSL is later changed to be checked by default, change port's default value, too. + if (Client::coreFeatures() & Quassel::VerifyServerSSL) { // Synchronize requiring SSL with the use SSL checkbox ui.sslVerify->setEnabled(ui.useSSL->isChecked()); @@ -959,6 +982,19 @@ void ServerEditDlg::on_host_textChanged() } +void ServerEditDlg::updateSslPort(bool isChecked) +{ + // "Use encrypted connection" was toggled, check the state... + if (isChecked && ui.port->value() == Network::PORT_PLAINTEXT) { + // Had been using the plain-text port, use the SSL default + ui.port->setValue(Network::PORT_SSL); + } else if (!isChecked && ui.port->value() == Network::PORT_SSL) { + // Had been using the SSL port, use the plain-text default + ui.port->setValue(Network::PORT_PLAINTEXT); + } +} + + /************************************************************************** * SaveNetworksDlg *************************************************************************/