Skip to content

fix: Fix airplane mode tips display logic#489

Merged
deepin-bot[bot] merged 1 commit intolinuxdeepin:masterfrom
ut003640:master
Feb 4, 2026
Merged

fix: Fix airplane mode tips display logic#489
deepin-bot[bot] merged 1 commit intolinuxdeepin:masterfrom
ut003640:master

Conversation

@ut003640
Copy link
Copy Markdown
Contributor

@ut003640 ut003640 commented Feb 4, 2026

Fix the logic for displaying airplane mode tips by adding wireless support check. Only show the tips when airplane mode is enabled AND wireless is supported.

Log: Fixed airplane mode tips display condition
PMS: BUG-349721

fix: 修复飞行模式提示显示逻辑

修复飞行模式提示的显示逻辑,增加无线支持检查。仅在飞行模式启用且支持无线功能时显示提示。

Log: 修复飞行模式提示显示条件
PMS: BUG-349721

Summary by Sourcery

Adjust airplane mode handling to consider wireless support when determining tips visibility and capability checks.

Bug Fixes:

  • Show airplane mode tips only when airplane mode is enabled and a managed Wi‑Fi device is available.

Enhancements:

  • Extract a reusable wireless support check in NetManagerThreadPrivate and reuse it in airplane mode capability logic.

Fix the logic for displaying airplane mode tips by adding wireless support check. Only show the tips when airplane mode is enabled AND wireless is supported.

Log: Fixed airplane mode tips display condition
PMS: BUG-349721

fix: 修复飞行模式提示显示逻辑

修复飞行模式提示的显示逻辑,增加无线支持检查。仅在飞行模式启用且支持无线功能时显示提示。

Log: 修复飞行模式提示显示条件
PMS: BUG-349721
@sourcery-ai
Copy link
Copy Markdown

sourcery-ai bot commented Feb 4, 2026

Reviewer's guide (collapsed on small PRs)

Reviewer's Guide

Refines airplane mode tip visibility logic to depend on both airplane mode state and actual wireless hardware support, by introducing a reusable wireless-support check and reusing it from existing airplane mode support logic.

Sequence diagram for airplane mode tips visibility update

sequenceDiagram
    actor User
    participant NetManager
    participant NetManagerPrivate
    participant NetManagerThreadPrivate
    participant NetworkManager
    participant UI

    User->>NetManager: toggleAirplaneMode(bool enabled)
    NetManager->>NetManagerPrivate: updateAirplaneMode(bool enabled)

    NetManagerPrivate->>NetManagerPrivate: set m_airplaneMode
    NetManagerPrivate->>NetManager: airplaneModeChanged(m_airplaneMode)

    NetManagerPrivate->>NetManagerThreadPrivate: supportWireless()
    NetManagerThreadPrivate->>NetworkManager: networkInterfaces()
    NetworkManager-->>NetManagerThreadPrivate: NetworkManagerDeviceList
    loop check_wifi_devices
        NetManagerThreadPrivate->>NetManagerThreadPrivate: find managed wifi device
    end
    NetManagerThreadPrivate-->>NetManagerPrivate: bool wirelessSupported

    NetManagerPrivate->>UI: updateItemVisible(NetAirplaneModeTipsItem, enabled && wirelessSupported)
    NetManagerPrivate->>UI: updateItemVisible(NetWirelessDisabledItem, false) [if enabled]
    NetManagerPrivate->>UI: updateItemVisible(NetWiredDisabledItem, false) [if enabled]
Loading

Class diagram for updated airplane mode and wireless support logic

classDiagram
class NetManagerThreadPrivate {
  - bool m_airplaneModeEnabled
  + bool AirplaneModeEnabled() const
  + bool supportWireless() const
  + bool supportAirplaneMode() const
}

class NetManagerPrivate {
  - bool m_airplaneMode
  - NetManagerThreadPrivate* m_managerThread
  + void updateAirplaneMode(bool enabled)
}

NetManagerPrivate --> NetManagerThreadPrivate : uses
NetManagerThreadPrivate ..> NetworkManager : queries
NetManagerThreadPrivate ..> NetworkManagerDevice : iterates_wifi_devices

class NetworkManager {
  + static NetworkManagerDeviceList networkInterfaces()
}

class NetworkManagerDevice {
  + int type()
  + bool managed()
}

class NetworkManagerDeviceList {
}

NetworkManagerDeviceList "*" --> NetworkManagerDevice
Loading

File-Level Changes

Change Details Files
Introduce a reusable helper to detect whether wireless (Wi‑Fi) is supported and managed on the system.
  • Add supportWireless() const method that enumerates NetworkManager devices and returns true when a managed Wi‑Fi device is present
  • Declare supportWireless() in the NetManagerThreadPrivate class interface for reuse by other methods
net-view/operation/private/netmanagerthreadprivate.cpp
net-view/operation/private/netmanagerthreadprivate.h
Refactor airplane mode support detection to rely on the new wireless support helper instead of duplicating Wi‑Fi detection logic.
  • Replace inline Wi‑Fi device enumeration in supportAirplaneMode() with a call to supportWireless() for consistency and reuse
net-view/operation/private/netmanagerthreadprivate.cpp
Tighten the UI visibility condition for airplane mode tips so they show only when airplane mode is enabled and wireless is supported.
  • Change updateAirplaneMode() to call updateItemVisible for NetAirplaneModeTipsItem using the composite condition enabled && m_managerThread->supportWireless()
net-view/operation/netmanager.cpp

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

Copy link
Copy Markdown

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey - I've reviewed your changes and they look great!


Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

@deepin-ci-robot
Copy link
Copy Markdown

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: caixr23, ut003640

The full list of commands accepted by this bot can be found here.

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@ut003640
Copy link
Copy Markdown
Contributor Author

ut003640 commented Feb 4, 2026

/merge

@deepin-bot
Copy link
Copy Markdown
Contributor

deepin-bot bot commented Feb 4, 2026

This pr cannot be merged! (status: unstable)

@ut003640
Copy link
Copy Markdown
Contributor Author

ut003640 commented Feb 4, 2026

/forcemerge

@deepin-bot
Copy link
Copy Markdown
Contributor

deepin-bot bot commented Feb 4, 2026

This pr force merged! (status: unstable)

@deepin-bot deepin-bot bot merged commit 95539e9 into linuxdeepin:master Feb 4, 2026
14 of 15 checks passed
Q_EMIT q->airplaneModeChanged(m_airplaneMode);
}
updateItemVisible("NetAirplaneModeTipsItem", enabled);
updateItemVisible("NetAirplaneModeTipsItem", enabled && m_managerThread->supportWireless());
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

netmanager.cpp在主线程中,m_managerThread在子线程中,不要直接调用。
使用缓存,有变化时信号更新

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants