Skip to content

feat: pass parent window id to license dialog - #3591

Open
wjyrich wants to merge 1 commit into
linuxdeepin:masterfrom
wjyrich:fix-bug-380347
Open

wjyrich wants to merge 1 commit into
linuxdeepin:masterfrom
wjyrich:fix-bug-380347

Conversation

@wjyrich

@wjyrich wjyrich commented Oct 28, 2026 •

Copy link
Copy Markdown
Contributor
  1. Add optional QWindow* parameter to setEnableDeveloperMode to pass the parent window
  2. Build process arguments conditionally, appending --parent-window with the window id only on X11 platforms
  3. Update QML to pass root.Window.window when enabling developer mode in ACL controller and login paths
  4. Set Qt.WindowDoesNotAcceptFocus flag on the modal dialog to prevent focus stealing

Log: The developer mode license dialog now opens as a child of the settings window on X11, keeping it properly parented and centered

Influence:

  1. Enable developer mode on X11 with ACL controller enabled and verify the license dialog appears parented to the main window
  2. Verify the dialog is positioned and centered correctly relative to the parent window
  3. Test the login flow path to confirm the dialog still appears and enables developer mode after confirmation
  4. Verify behavior on non-X11 platforms (Wayland) - no --parent-window argument should be added and dialog should still work
  5. Confirm the modal dialog no longer steals focus and the underlying UI remains responsive as expected
  6. Test edge cases where root.Window.window may be null

feat: 向许可证对话框传递父窗口 ID

  1. 为 setEnableDeveloperMode 添加可选的 QWindow* 参数以传递父窗口
  2. 条件性构造进程参数,仅在 X11 平台追加 --parent-window 及窗口 ID
  3. 更新 QML,在 ACL 控制器和登录路径中启用开发者模式时传入 root.Window.window
  4. 为模态对话框设置 Qt.WindowDoesNotAcceptFocus 标志以防止焦点抢占

Log: 开发者模式许可证对话框现在在 X11 下作为设置窗口的子窗口打开,保持正
确的父子关系并居中显示

Influence:

  1. 在启用 ACL 控制器的 X11 环境下启用开发者模式,验证许可证对话框作为主 窗口子窗口显示
  2. 验证对话框相对于父窗口的定位和居中是否正确
  3. 测试登录流程路径,确认对话框正常显示并在确认后启用开发者模式
  4. 验证非 X11 平台(Wayland)下的行为 - 不应添加 --parent-window 参数且 对话框仍正常工作
  5. 确认模态对话框不再抢占焦点且底层界面保持应有的响应性
  6. 测试 root.Window.window 可能为空的边界情况

PMS: BUG-380347

Summary by Sourcery

Parent the developer-mode license dialog to its invoking window on supported platforms while preventing focus disruption.

New Features:

  • Pass the originating window to the developer-mode license dialog so it is parented and centered correctly on X11.

Bug Fixes:

  • Prevent the modal developer-mode dialog from stealing focus.
  • Preserve developer-mode activation across ACL and login flows while supporting platforms without X11 window IDs.

1. Add optional QWindow* parameter to setEnableDeveloperMode to pass the
parent window
2. Build process arguments conditionally, appending --parent-window with
the window id only on X11 platforms
3. Update QML to pass root.Window.window when enabling developer mode in
ACL controller and login paths
4. Set Qt.WindowDoesNotAcceptFocus flag on the modal dialog to prevent
focus stealing

Log: The developer mode license dialog now opens as a child of the
settings window on X11, keeping it properly parented and centered

Influence:
1. Enable developer mode on X11 with ACL controller enabled and verify
the license dialog appears parented to the main window
2. Verify the dialog is positioned and centered correctly relative to
the parent window
3. Test the login flow path to confirm the dialog still appears and
enables developer mode after confirmation
4. Verify behavior on non-X11 platforms (Wayland) - no --parent-window
argument should be added and dialog should still work
5. Confirm the modal dialog no longer steals focus and the underlying UI
remains responsive as expected
6. Test edge cases where root.Window.window may be null

feat: 向许可证对话框传递父窗口 ID

1. 为 setEnableDeveloperMode 添加可选的 QWindow* 参数以传递父窗口
2. 条件性构造进程参数,仅在 X11 平台追加 --parent-window 及窗口 ID
3. 更新 QML,在 ACL 控制器和登录路径中启用开发者模式时传入
root.Window.window
4. 为模态对话框设置 Qt.WindowDoesNotAcceptFocus 标志以防止焦点抢占

Log: 开发者模式许可证对话框现在在 X11 下作为设置窗口的子窗口打开,保持正
确的父子关系并居中显示

Influence:
1. 在启用 ACL 控制器的 X11 环境下启用开发者模式,验证许可证对话框作为主
窗口子窗口显示
2. 验证对话框相对于父窗口的定位和居中是否正确
3. 测试登录流程路径,确认对话框正常显示并在确认后启用开发者模式
4. 验证非 X11 平台(Wayland)下的行为 - 不应添加 --parent-window 参数且
对话框仍正常工作
5. 确认模态对话框不再抢占焦点且底层界面保持应有的响应性
6. 测试 root.Window.window 可能为空的边界情况

PMS: BUG-380347
@deepin-ci-robot

Copy link
Copy Markdown

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: wjyrich

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

@sourcery-ai

sourcery-ai Bot commented Oct 28, 2026

Copy link
Copy Markdown
Reviewer's guide (collapsed on small PRs)

Reviewer's Guide

The PR optionally parents the developer-mode license dialog to the originating QML window on X11 by forwarding its native window ID, while preserving platform-independent arguments and updating modal focus behavior.

Sequence diagram for parented developer-mode license dialog

sequenceDiagram
    participant User
    participant QML as DevelopModePage.qml
    participant Work as CommonInfoWork
    participant Platform as QtPlatform
    participant License as dde-license-dialog

    User->>QML: setEnableDeveloperMode(true, root.Window.window)
    QML->>Work: setEnableDeveloperMode(true, parentWindow)
    Work->>Platform: testAttribute(IsXWindowPlatform)
    alt X11 and parentWindow available
        Work->>License: start(arguments, --parent-window, parentWindow.winId())
        License-->>User: Show centered child dialog
    else Wayland or parentWindow unavailable
        Work->>License: start(arguments)
        License-->>User: Show license dialog
    end
    License-->>Work: finished(result)
Loading

File-Level Changes

Change Details Files
Propagate an optional parent QWindow into the developer-mode license-dialog process.
  • Extended the slot signature with a nullable QWindow parameter.
  • Builds the existing dialog arguments first, then adds --parent-window and the parent window ID only when a parent exists and the platform is X11.
  • Starts the license dialog with the assembled arguments.
src/plugin-commoninfo/operation/commoninfowork.cpp
src/plugin-commoninfo/operation/commoninfowork.h
Pass the invoking QML window through developer-mode flows and prevent the modal helper window from accepting focus.
  • Passes root.Window.window from the ACL-controller and login confirmation paths.
  • Adds Qt.WindowDoesNotAcceptFocus to the modal dialog flags.
  • Closes the dialog before invoking developer-mode enablement in the login path.
src/plugin-commoninfo/qml/DevelopModePage.qml

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

@wjyrich

wjyrich commented Oct 28, 2026

Copy link
Copy Markdown
Contributor Author

@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 reviewed your changes and they look great!


Sourcery is free for open source - if you like our reviews please consider sharing them ✨

@deepin-ci-robot

Copy link
Copy Markdown

deepin pr auto review

🤖 AI 代码审查报告

总体评分: 100 分 (通过阈值: 70分)

Pass


📊 总体评价

项目 结果
审查结论 代码审查通过
评分详情 本次提交将父窗口ID传递给许可证对话框,实现窗口层级关联。代码变更简洁、逻辑清晰,四维度均无问题,无安全漏洞。

🔍 详细分析

1. 语法逻辑 ✅

评价: 语法正确,逻辑清晰 ✅ 通过

潜在问题:
✅ 未发现明显问题

建议: 无需修改


2. 代码质量 ✅

评价: 代码结构清晰,注释完整 ✅ 通过

潜在问题:
✅ 未发现明显问题

建议: 无需修改


3. 代码性能 ✅

评价: 性能良好,资源使用合理 ✅ 通过

潜在问题:
✅ 未发现明显问题

建议: 无需修改


4. 代码安全 🔒

评价: 存在0个安全漏洞 ✅ 通过

🔐 发现 0 个安全漏洞

安全漏洞详情:
✅ 未发现安全漏洞

建议: 无需修改


💡 改进建议代码示例


本报告由 AI 代码审查工具自动生成

This branch has not been deployed

No deployments
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.

2 participants