ui/networking: call isTetheringEnabled out of the loop (#29028)

old-commit-hash: 4584e883dcf93079ad958da2042229750a3e260d
This commit is contained in:
Dean Lee
2023-07-19 19:28:44 +08:00
committed by GitHub
parent 05181ed6b1
commit ff94bdb79d
+2 -1
View File
@@ -286,6 +286,7 @@ void WifiUI::refresh() {
scanningLabel->setVisible(is_empty);
if (is_empty) return;
const bool is_tethering_enabled = wifi->isTetheringEnabled();
QList<Network> sortedNetworks = wifi->seenNetworks.values();
std::sort(sortedNetworks.begin(), sortedNetworks.end(), compare_by_strength);
@@ -313,7 +314,7 @@ void WifiUI::refresh() {
}
// Forget button
if (wifi->isKnownConnection(network.ssid) && !wifi->isTetheringEnabled()) {
if (wifi->isKnownConnection(network.ssid) && !is_tethering_enabled) {
QPushButton *forgetBtn = new QPushButton(tr("FORGET"));
forgetBtn->setObjectName("forgetBtn");
QObject::connect(forgetBtn, &QPushButton::clicked, [=]() {