+void NetworksSettingsPage::clientNetworkCapsUpdated()
+{
+ // Grab the updated network
+ const Network *net = qobject_cast<const Network *>(sender());
+ if (!net) {
+ qWarning() << "Update request for unknown network received!";
+ return;
+ }
+ if (net->networkId() == currentId) {
+ // Network is currently shown. Update the capability-dependent UI in case capabilities have
+ // changed.
+ setNetworkCapStates(currentId);
+ }
+}
+
+
+void NetworksSettingsPage::setSASLStatus(const CapSupportStatus saslStatus)
+{
+ if (_saslStatusSelected != saslStatus) {
+ // Update the cached copy of SASL status used with the Details dialog
+ _saslStatusSelected = saslStatus;
+
+ // Update the user interface
+ switch (saslStatus) {
+ case CapSupportStatus::Unknown:
+ // There's no capability negotiation or network doesn't exist. Don't assume
+ // anything.
+ ui.saslStatusLabel->setText(QString("<i>%1</i>").arg(
+ tr("Could not check if supported by network")));
+ ui.saslStatusIcon->setPixmap(infoIcon.pixmap(16));
+ break;
+ case CapSupportStatus::Disconnected:
+ // Disconnected from network, no way to check.
+ ui.saslStatusLabel->setText(QString("<i>%1</i>").arg(
+ tr("Cannot check if supported when disconnected")));
+ ui.saslStatusIcon->setPixmap(infoIcon.pixmap(16));
+ break;
+ case CapSupportStatus::MaybeUnsupported:
+ // The network doesn't advertise support for SASL PLAIN. Here be dragons.
+ ui.saslStatusLabel->setText(QString("<i>%1</i>").arg(
+ tr("Not currently supported by network")));
+ ui.saslStatusIcon->setPixmap(warningIcon.pixmap(16));
+ break;
+ case CapSupportStatus::MaybeSupported:
+ // The network advertises support for SASL PLAIN. Encourage using it!
+ // Unfortunately we don't know for sure if it's desired or functional.
+ ui.saslStatusLabel->setText(QString("<i>%1</i>").arg(tr("Supported by network")));
+ ui.saslStatusIcon->setPixmap(infoIcon.pixmap(16));
+ break;
+ }
+ }
+}
+
+
+#ifdef HAVE_SSL
+void NetworksSettingsPage::sslUpdated()
+{
+ if (_cid && !_cid->sslKey().isNull()) {
+ ui.saslContents->setDisabled(true);
+ ui.saslExtInfo->setHidden(false);
+ } else {
+ ui.saslContents->setDisabled(false);
+ // Directly re-enabling causes the widgets to ignore the parent "Use SASL Authentication"
+ // state to indicate whether or not it's disabled. To workaround this, keep track of
+ // whether or not "Use SASL Authentication" is enabled, then quickly uncheck/recheck the
+ // group box.
+ if (!ui.sasl->isChecked()) {
+ // SASL is not enabled, uncheck/recheck the group box to re-disable saslContents.
+ // Leaving saslContents disabled doesn't work as that prevents it from re-enabling if
+ // sasl is later checked.
+ ui.sasl->setChecked(true);
+ ui.sasl->setChecked(false);
+ }
+ ui.saslExtInfo->setHidden(true);
+ }
+}
+#endif
+
+