Skip to content

feat: adopt xdg-activation protocol for Treeland dock plugin#566

Open
18202781743 wants to merge 1 commit into
linuxdeepin:masterfrom
18202781743:master
Open

feat: adopt xdg-activation protocol for Treeland dock plugin#566
18202781743 wants to merge 1 commit into
linuxdeepin:masterfrom
18202781743:master

Conversation

@18202781743

@18202781743 18202781743 commented Jun 12, 2026

Copy link
Copy Markdown
Contributor
  1. Add xdg-activation-v1 protocol support in dock-network-plugin
  2. Implement XdgActivation class to request activation tokens via
    Wayland
  3. Replace all direct D-Bus calls to ControlCenter with dde-am +
    activation token
  4. Replace DDBusSender in JumpSettingButton with token-based activation
  5. Update NetManager to pass activation token when opening ControlCenter
  6. Add necessary dependencies: extra-cmake-modules, wayland-protocols,
    qt6-wayland-dev
  7. Update CMake build system to generate xdg-activation client protocol
    code

Log: 适配Treeland窗口管理器的XDG激活协议,确保从任务栏网络插件打开控制中
心时正确传递激活令牌并获得焦点

Influence:

  1. Test clicking network settings button in dock - verify ControlCenter
    opens with proper focus
  2. Test clicking network icon quick panel - verify ControlCenter opens
    correctly
  3. Test clicking network status indicator - verify ControlCenter
    launches properly
  4. Test JumpSettingButton with auto-show-page - verify page navigation
    works with token
  5. Test on X11 environment - verify fallback behavior without activation
    token
  6. Test on Treeland/Wayland - verify XDG activation token is properly
    generated and passed
  7. Test opening ControlCenter from network detail pages - verify correct
    sub-page navigation
  8. Verify dde-am is available and properly invoked for launching
    ControlCenter

feat: 适配Treeland的XDG激活协议

  1. 在dock-network-plugin中添加xdg-activation-v1协议支持
  2. 实现XdgActivation类,通过Wayland请求激活令牌
  3. 将所有直接调用控制中心的D-Bus调用替换为使用dde-am + 激活令牌
  4. 替换JumpSettingButton中的DDBusSender为基于令牌的激活方式
  5. 更新NetManager以在打开控制中心时传递激活令牌
  6. 添加必要依赖:extra-cmake-modules, wayland-protocols, qt6-wayland-dev
  7. 更新CMake构建系统以生成xdg-activation客户端协议代码

Log: 适配Treeland窗口管理器的XDG激活协议,确保从任务栏网络插件打开控制中
心时正确传递激活令牌并获得焦点

Influence:

  1. 测试点击任务栏网络设置按钮 - 验证控制中心能正确打开并获取焦点
  2. 测试点击网络图标快速面板 - 验证控制中心正确打开
  3. 测试点击网络状态指示器 - 验证控制中心正常启动
  4. 测试JumpSettingButton的自动跳转页面功能 - 验证带令牌的页面导航正常
  5. 在X11环境测试 - 验证无激活令牌时的降级处理
  6. 在Treeland/Wayland环境测试 - 验证XDG激活令牌正确生成和传递
  7. 测试从网络详情页面打开控制中心 - 验证正确的子页面导航
  8. 验证dde-am可用并能正确调用以启动控制中心

Summary by Sourcery

Adopt the Wayland xdg-activation-v1 protocol in the dock network plugin and related network components to launch ControlCenter via dde-am with activation tokens, updating build and dependencies accordingly.

Enhancements:

  • Introduce an XdgActivation helper for requesting XDG activation tokens on Wayland and wire it into dock network UI actions and NetManager flows.
  • Replace direct D-Bus invocations to ControlCenter with dde-am launches that optionally carry XDG activation tokens for proper window focus and page navigation.
  • Extend NetManager threading and IPC parameters to propagate activation tokens when opening ControlCenter from various network entry points.

Build:

  • Update CMake and project configuration to depend on ECM and wayland-protocols, enable Qt Wayland client, and generate xdg-activation client protocol sources.

1. Add xdg-activation-v1 protocol support in dock-network-plugin
2. Implement XdgActivation class to request activation tokens via
Wayland
3. Replace all direct D-Bus calls to ControlCenter with dde-am +
activation token
4. Replace DDBusSender in JumpSettingButton with token-based activation
5. Update NetManager to pass activation token when opening ControlCenter
6. Add necessary dependencies: extra-cmake-modules, wayland-protocols,
qt6-wayland-dev
7. Update CMake build system to generate xdg-activation client protocol
code

Log: 适配Treeland窗口管理器的XDG激活协议,确保从任务栏网络插件打开控制中
心时正确传递激活令牌并获得焦点

Influence:
1. Test clicking network settings button in dock - verify ControlCenter
opens with proper focus
2. Test clicking network icon quick panel - verify ControlCenter opens
correctly
3. Test clicking network status indicator - verify ControlCenter
launches properly
4. Test JumpSettingButton with auto-show-page - verify page navigation
works with token
5. Test on X11 environment - verify fallback behavior without activation
token
6. Test on Treeland/Wayland - verify XDG activation token is properly
generated and passed
7. Test opening ControlCenter from network detail pages - verify correct
sub-page navigation
8. Verify dde-am is available and properly invoked for launching
ControlCenter

feat: 适配Treeland的XDG激活协议

1. 在dock-network-plugin中添加xdg-activation-v1协议支持
2. 实现XdgActivation类,通过Wayland请求激活令牌
3. 将所有直接调用控制中心的D-Bus调用替换为使用dde-am + 激活令牌
4. 替换JumpSettingButton中的DDBusSender为基于令牌的激活方式
5. 更新NetManager以在打开控制中心时传递激活令牌
6. 添加必要依赖:extra-cmake-modules, wayland-protocols, qt6-wayland-dev
7. 更新CMake构建系统以生成xdg-activation客户端协议代码

Log: 适配Treeland窗口管理器的XDG激活协议,确保从任务栏网络插件打开控制中
心时正确传递激活令牌并获得焦点

Influence:
1. 测试点击任务栏网络设置按钮 - 验证控制中心能正确打开并获取焦点
2. 测试点击网络图标快速面板 - 验证控制中心正确打开
3. 测试点击网络状态指示器 - 验证控制中心正常启动
4. 测试JumpSettingButton的自动跳转页面功能 - 验证带令牌的页面导航正常
5. 在X11环境测试 - 验证无激活令牌时的降级处理
6. 在Treeland/Wayland环境测试 - 验证XDG激活令牌正确生成和传递
7. 测试从网络详情页面打开控制中心 - 验证正确的子页面导航
8. 验证dde-am可用并能正确调用以启动控制中心
@sourcery-ai

sourcery-ai Bot commented Jun 12, 2026

Copy link
Copy Markdown

Reviewer's Guide

Adopts the Wayland xdg-activation-v1 protocol in the Treeland dock network plugin, introducing an XdgActivation helper, routing all ControlCenter launches through dde-am with optional activation tokens, and updating the build system and dependencies to generate and link the Wayland client protocol code.

Sequence diagram for ControlCenter launch with XDG activation token

sequenceDiagram
    actor User
    participant DockNetworkUI as DockContentWidget
    participant XdgActivation as XdgActivation
    participant NetManager as NetManager
    participant NetMgrThread as NetManagerThreadPrivate
    participant dde_am
    participant ControlCenter

    User->>DockNetworkUI: click network settings
    DockNetworkUI->>XdgActivation: requestToken(window, appId)
    XdgActivation-->>DockNetworkUI: tokenReady(token)
    DockNetworkUI->>NetManager: gotoControlCenter(token)
    NetManager->>NetMgrThread: gotoControlCenter(page, token)
    NetMgrThread->>NetMgrThread: doGotoControlCenter(page, token)
    NetMgrThread->>dde_am: QProcess::startDetached("dde-am", args{XDG_ACTIVATION_TOKEN})
    dde_am-->>ControlCenter: launch with -p network[/page]
    ControlCenter-->>User: focused ControlCenter window opened
Loading

File-Level Changes

Change Details Files
Introduce an XdgActivation helper around the Wayland xdg-activation-v1 protocol and wire it into network-related UI entry points to request activation tokens before launching ControlCenter via dde-am.
  • Add dde::network::XdgActivation QObject wrapper and internal XdgActivationV1 client extension using QtWayland xdg-activation-v1, requesting tokens based on the focused QWindow and DSGApplication app id
  • Emit a tokenReady signal from XdgActivation once the protocol responds, or an empty token when the extension is inactive, logging detailed diagnostics via QLoggingCategory
  • Use XdgActivation in JumpSettingButton to request a token, build the combined first/second page path, and launch dde-am with --by-user org.deepin.dde.control-center, optional XDG_ACTIVATION_TOKEN, and -p page arguments
dock-network-plugin/xdgactivation.h
dock-network-plugin/xdgactivation.cpp
dock-network-plugin/widget/jumpsettingbutton.cpp
Replace direct D-Bus invocations to ControlCenter with dde-am-based launches that optionally include XDG activation tokens and pass explicit network page paths.
  • Change NetworkPlugin::itemCommand to return a dde-am command line targeting org.deepin.dde.control-center with -p network instead of dbus-send ShowModule
  • Update NetworkDBusProxy::ShowPage to spawn dde-am with --by-user org.deepin.dde.control-center and -p url instead of sending org.deepin.dde.ControlCenter1.ShowPage over QDBus
  • Refactor NetManager/NetManagerThreadPrivate to accept an optional activation token, marshal it through exec parameters, and in doGotoControlCenter construct a network[/subpage] path and launch dde-am with optional XDG_ACTIVATION_TOKEN
dock-network-plugin/networkplugin.cpp
common-plugin/networkdialog/networkdbusproxy.cpp
net-view/operation/netmanager.h
net-view/operation/netmanager.cpp
net-view/operation/private/netmanagerthreadprivate.h
net-view/operation/private/netmanagerthreadprivate.cpp
Ensure all UI paths that navigate to ControlCenter from the dock/network UI obtain and pass activation tokens on Wayland, preserving focus and page navigation.
  • Wrap DockContentWidget network settings button click handler with an XdgActivation request that calls NetManager::gotoControlCenter(token) when ready
  • Update NetworkPlugin quick icon and quick panel click handlers to request an activation token via XdgActivation and forward it to NetManager::gotoControlCenter(token)
  • Preserve existing behavior for toggling/toggling network state or showing dialogs when ControlCenter is not needed, while integrating token-based launches where applicable
dock-network-plugin/dockcontentwidget.h
dock-network-plugin/networkplugin.cpp
Extend the CMake build and dependencies to support Wayland xdg-activation client code generation and Qt Wayland usage in the dock network plugin.
  • Add ECM and WaylandProtocols discovery in the top-level CMakeLists.txt and append ECM_MODULE_PATH to CMAKE_MODULE_PATH
  • Update dock-network-plugin CMakeLists to include xdgactivation sources, require Qt WaylandClient, link against Qt WaylandClientPrivate, and include the current binary dir for generated headers
  • Use qt_generate_wayland_protocol_client_sources with the staging xdg-activation-v1.xml to generate the client-side protocol classes at build time
CMakeLists.txt
dock-network-plugin/CMakeLists.txt
Minor maintenance and copyright updates accompanying the feature.
  • Update SPDX copyright year ranges in several source files to extend through 2026
  • Include additional Qt and STL headers (QProcess) where needed to support dde-am process launching
dock-network-plugin/widget/jumpsettingbutton.cpp
dock-network-plugin/networkplugin.cpp
common-plugin/networkdialog/networkdbusproxy.cpp
net-view/operation/private/netmanagerthreadprivate.cpp
src/impl/serviceinter/deviceinterrealize.cpp
dock-network-plugin/CMakeLists.txt
common-plugin/networkdialog/networkdbusproxy.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

@sourcery-ai sourcery-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Hey - I've found 1 issue

Prompt for AI Agents
Please address the comments from this code review:

## Individual Comments

### Comment 1
<location path="dock-network-plugin/dockcontentwidget.h" line_range="49-50" />
<code_context>
         m_netSetBtn->setIcon(QIcon::fromTheme("network-setting"));
         m_netSetBtn->setDescription(tr("Network settings"));
-        connect(m_netSetBtn, &JumpSettingButton::clicked, netManager, &NetManager::gotoControlCenter);
+        connect(m_netSetBtn, &JumpSettingButton::clicked, this, [this, netManager]() {
+            auto *activation = new XdgActivation(this);
+            connect(activation, &XdgActivation::tokenReady, this,
+                [netManager, activation](const QString &token) {
</code_context>
<issue_to_address>
**issue (bug_risk):** Qualify XdgActivation with its namespace to avoid unresolved symbol / ambiguity

`XdgActivation` is defined in the `dde::network` namespace in `xdgactivation.h`, but here it’s used without qualification or a `using` directive. This can cause a compile error or resolve to the wrong symbol. Use `dde::network::XdgActivation` here (or add an explicit `using` in the relevant scope).
</issue_to_address>

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.

Comment thread dock-network-plugin/dockcontentwidget.h
@deepin-ci-robot

Copy link
Copy Markdown

@18202781743: The following test failed, say /retest to rerun all failed tests or /retest-required to rerun all mandatory failed tests:

Test name Commit Details Required Rerun command
github-pr-review-ci d87431c link true /test github-pr-review-ci

Full PR test history. Your PR dashboard.

Details

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. I understand the commands that are listed here.

@deepin-ci-robot

Copy link
Copy Markdown

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: 18202781743, mhduiy

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

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