-
Notifications
You must be signed in to change notification settings - Fork 55
fix: Fix airplane mode tips display logic #493
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -98,6 +98,7 @@ NetManagerThreadPrivate::NetManagerThreadPrivate() | |
| , m_netCheckAvailable(false) | ||
| , m_isSleeping(false) | ||
| , m_showPageTimer(nullptr) | ||
| , m_supportWireless(false) | ||
| { | ||
| moveToThread(m_thread); | ||
| m_thread->start(); | ||
|
|
@@ -1941,6 +1942,7 @@ void NetManagerThreadPrivate::onDeviceAdded(QList<NetworkDeviceBase *> devices) | |
| } | ||
| } | ||
| updateDSLEnabledable(); | ||
| updateSupportWireless(); | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. issue: Wireless support state is only refreshed on add/remove, so the initial value may be wrong until the first device event. If the system boots with existing wireless devices but no add/remove events occur, |
||
| } | ||
|
|
||
| void NetManagerThreadPrivate::onDeviceRemoved(QList<NetworkDeviceBase *> devices) | ||
|
|
@@ -1953,6 +1955,7 @@ void NetManagerThreadPrivate::onDeviceRemoved(QList<NetworkDeviceBase *> devices | |
| updateDetails(); | ||
| } | ||
| updateDSLEnabledable(); | ||
| updateSupportWireless(); | ||
| } | ||
|
|
||
| void NetManagerThreadPrivate::onConnectivityChanged() | ||
|
|
@@ -2994,6 +2997,24 @@ NetworkManager::WirelessSecuritySetting::KeyMgmt NetManagerThreadPrivate::getKey | |
| return keyMgmt; | ||
| } | ||
|
|
||
| void NetManagerThreadPrivate::updateSupportWireless() | ||
| { | ||
| bool supportWireless = false; | ||
| QList<dde::network::NetworkDeviceBase *> devices = NetworkController::instance()->devices(); | ||
| for (dde::network::NetworkDeviceBase *device : devices) { | ||
| if (device->deviceType() != dde::network::DeviceType::Wireless) | ||
| continue; | ||
|
|
||
| supportWireless = true; | ||
| break; | ||
| } | ||
|
|
||
| if (m_supportWireless != supportWireless) { | ||
| m_supportWireless = supportWireless; | ||
| Q_EMIT supportWirelessChanged(m_supportWireless); | ||
| } | ||
| } | ||
|
|
||
| NetType::NetDeviceStatus NetManagerThreadPrivate::toNetDeviceStatus(ConnectionStatus status) | ||
| { | ||
| switch (status) { | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
issue: Wireless support changes don’t update airplane-mode UI when airplane mode is already enabled.
updateAirplaneModetiesNetAirplaneModeTipsItemvisibility toenabled && m_supportWireless, butonSupportWirelessChangedonly updatesm_supportWireless. If wireless support changes while airplane mode is already enabled, the tips item visibility won’t update until airplane mode is toggled again. Consider havingonSupportWirelessChangedrefresh the relevant item visibility whenm_airplaneModeis true.