/***************************************************************************
- * Copyright (C) 2005-2015 by the Quassel Project *
+ * Copyright (C) 2005-2016 by the Quassel Project *
* devel@quassel-irc.org *
* *
* This program is free software; you can redistribute it and/or modify *
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());
+ connect(ui.useSSL, SIGNAL(toggled(bool)), ui.sslVerify, SLOT(setEnabled(bool)));
+ } else {
+ // Core isn't new enough to allow requiring SSL; disable checkbox and uncheck
+ ui.sslVerify->setEnabled(false);
+ ui.sslVerify->setChecked(false);
+ // Split up the message to allow re-using translations:
+ // [Original tool-tip]
+ // [Bold 'does not support feature' message]
+ // [Specific version needed and feature details]
+ ui.sslVerify->setToolTip(QString("%1<br/><b>%2</b><br/>%3").arg(
+ ui.sslVerify->toolTip(),
+ tr("Your Quassel core does not support this feature"),
+ tr("You need a Quassel core v0.13.0 or newer in order to "
+ "verify connection security.")));
+ }
+
// read preset networks
QStringList networks = PresetNetworks::names();
foreach(QString s, existing)
if (ui.useManual->isChecked()) {
NetworkInfo info;
info.networkName = ui.networkName->text().trimmed();
- info.serverList << Network::Server(ui.serverAddress->text().trimmed(), ui.port->value(), ui.serverPassword->text(), ui.useSSL->isChecked());
+ info.serverList << Network::Server(ui.serverAddress->text().trimmed(), ui.port->value(),
+ ui.serverPassword->text(), ui.useSSL->isChecked(),
+ ui.sslVerify->isChecked());
return info;
}
else
}
+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
*************************************************************************/
ui.port->setValue(server.port);
ui.password->setText(server.password);
ui.useSSL->setChecked(server.useSsl);
+ ui.sslVerify->setChecked(server.sslVerify);
ui.sslVersion->setCurrentIndex(server.sslVersion);
ui.useProxy->setChecked(server.useProxy);
ui.proxyType->setCurrentIndex(server.proxyType == QNetworkProxy::Socks5Proxy ? 0 : 1);
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());
+ connect(ui.useSSL, SIGNAL(toggled(bool)), ui.sslVerify, SLOT(setEnabled(bool)));
+ } else {
+ // Core isn't new enough to allow requiring SSL; disable checkbox and uncheck
+ ui.sslVerify->setEnabled(false);
+ ui.sslVerify->setChecked(false);
+ // Split up the message to allow re-using translations:
+ // [Original tool-tip]
+ // [Bold 'does not support feature' message]
+ // [Specific version needed and feature details]
+ ui.sslVerify->setToolTip(QString("%1<br/><b>%2</b><br/>%3").arg(
+ ui.sslVerify->toolTip(),
+ tr("Your Quassel core does not support this feature"),
+ tr("You need a Quassel core v0.13.0 or newer in order to "
+ "verify connection security.")));
+ }
+
on_host_textChanged();
}
Network::Server ServerEditDlg::serverData() const
{
- Network::Server server(ui.host->text().trimmed(), ui.port->value(), ui.password->text(), ui.useSSL->isChecked());
+ Network::Server server(ui.host->text().trimmed(), ui.port->value(), ui.password->text(),
+ ui.useSSL->isChecked(), ui.sslVerify->isChecked());
server.sslVersion = ui.sslVersion->currentIndex();
server.useProxy = ui.useProxy->isChecked();
server.proxyType = ui.proxyType->currentIndex() == 0 ? QNetworkProxy::Socks5Proxy : QNetworkProxy::HttpProxy;
}
+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
*************************************************************************/