X-Git-Url: https://git.quassel-irc.org/?a=blobdiff_plain;f=src%2Fqtui%2Fsettingspages%2Fnetworkssettingspage.cpp;h=f0aeac1646302641e4989a51acb55a5d922d78d0;hb=b627af388d570f48a03fd22ab024c07e82e0d503;hp=db51da3edc30deba7b5fbdb3f3960ef3311c8890;hpb=8265e0f7f750f7ae7a4a8a163b2bd42e8edb4998;p=quassel.git diff --git a/src/qtui/settingspages/networkssettingspage.cpp b/src/qtui/settingspages/networkssettingspage.cpp index db51da3e..f0aeac16 100644 --- a/src/qtui/settingspages/networkssettingspage.cpp +++ b/src/qtui/settingspages/networkssettingspage.cpp @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2005-2016 by the Quassel Project * + * Copyright (C) 2005-2018 by the Quassel Project * * devel@quassel-irc.org * * * * This program is free software; you can redistribute it and/or modify * @@ -46,9 +46,9 @@ NetworksSettingsPage::NetworksSettingsPage(QWidget *parent) ui.setupUi(this); // hide SASL options for older cores - if (!(Client::coreFeatures() & Quassel::SaslAuthentication)) + if (!Client::isCoreFeatureEnabled(Quassel::Feature::SaslAuthentication)) ui.sasl->hide(); - if (!(Client::coreFeatures() & Quassel::SaslExternal)) + if (!Client::isCoreFeatureEnabled(Quassel::Feature::SaslExternal)) ui.saslExtInfo->hide(); #ifndef HAVE_SSL ui.saslExtInfo->hide(); @@ -176,7 +176,7 @@ void NetworksSettingsPage::load() reset(); // Handle UI dependent on core feature flags here - if (Client::coreFeatures() & Quassel::CustomRateLimits) { + if (Client::isCoreFeatureEnabled(Quassel::Feature::CustomRateLimits)) { // Custom rate limiting supported, allow toggling ui.useCustomMessageRate->setEnabled(true); // Reset tooltip to default. @@ -358,7 +358,7 @@ void NetworksSettingsPage::setItemState(NetworkId id, QListWidgetItem *item) void NetworksSettingsPage::setNetworkCapStates(NetworkId id) { const Network *net = Client::network(id); - if ((Client::coreFeatures() & Quassel::CapNegotiation) && net) { + if (Client::isCoreFeatureEnabled(Quassel::Feature::CapNegotiation) && net) { // Capability negotiation is supported, network exists. // Check if the network is connected. Don't use net->isConnected() as that won't be true // during capability negotiation when capabilities are added and removed. @@ -567,6 +567,14 @@ QListWidgetItem *NetworksSettingsPage::insertNetwork(const NetworkInfo &info) } +// Called when selecting 'Configure' from the buffer list +void NetworksSettingsPage::bufferList_Open(NetworkId netId) +{ + QListWidgetItem *item = networkItem(netId); + ui.networkList->setCurrentItem(item, QItemSelectionModel::SelectCurrent); +} + + void NetworksSettingsPage::displayNetwork(NetworkId id) { _ignoreWidgetChanges = true; @@ -575,7 +583,7 @@ void NetworksSettingsPage::displayNetwork(NetworkId id) #ifdef HAVE_SSL // this is only needed when the core supports SASL EXTERNAL - if (Client::coreFeatures() & Quassel::SaslExternal) { + if (Client::isCoreFeatureEnabled(Quassel::Feature::SaslExternal)) { if (_cid) { disconnect(_cid, SIGNAL(sslSettingsUpdated()), this, SLOT(sslUpdated())); delete _cid; @@ -746,16 +754,21 @@ void NetworksSettingsPage::setSASLStatus(const CapSupportStatus saslStatus) void NetworksSettingsPage::sslUpdated() { if (_cid && !_cid->sslKey().isNull()) { - ui.saslAccount->setDisabled(true); - ui.saslAccountLabel->setDisabled(true); - ui.saslPassword->setDisabled(true); - ui.saslPasswordLabel->setDisabled(true); + ui.saslContents->setDisabled(true); ui.saslExtInfo->setHidden(false); } else { - ui.saslAccount->setDisabled(false); - ui.saslAccountLabel->setDisabled(false); - ui.saslPassword->setDisabled(false); - ui.saslPasswordLabel->setDisabled(false); + 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); } } @@ -1016,7 +1029,7 @@ NetworkAddDlg::NetworkAddDlg(const QStringList &exist, QWidget *parent) : QDialo // 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) { + if (Client::isCoreFeatureEnabled(Quassel::Feature::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))); @@ -1163,7 +1176,7 @@ ServerEditDlg::ServerEditDlg(const Network::Server &server, QWidget *parent) : Q // 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) { + if (Client::isCoreFeatureEnabled(Quassel::Feature::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)));