Skip to content

WM-464: refactor(lockscreen): merge PowerList into ShutdownView with flat button chain - #1398

Closed
deepin-wm wants to merge 1 commit into
linuxdeepin:masterfrom
deepin-wm:wm-464-flat-power-buttons
Closed

deepin-wm wants to merge 1 commit into
linuxdeepin:masterfrom
deepin-wm:wm-464-flat-power-buttons

Conversation

@deepin-wm

@deepin-wm deepin-wm commented Sep 14, 2026

Copy link
Copy Markdown
Contributor

重构锁屏电源/权限按钮:合并 PowerList 至 ShutdownView,用扁平按钮链替代循环式 tab 跳转

WM-464

变更内容

将锁屏 src/plugins/lockscreen/qml/ 下的两套电源/权限按钮实现合并为单一的扁平按钮链:

  • ShutdownView.qml — 重写为单一扁平按钮链,7 个按钮(lock / switch user / logout / shut down / reboot / suspend / hibernate)全部收拢进 RowLayout。移除 PowerList 依赖、loopInside、tabOutForward/tabOutBackward 信号及 ObjectModel 动态注入。tab 按序串联,首尾不回环;powerOffBtn 的 backtab 通过条件表达式处理锁屏态下 logoutBtn 不可见时的跳空。新增 outsideClicked() 信号和 focusFirstButton() 函数。
  • ShutdownButton.qml — 删除 visible: enabled,使 visible 与 enabled 独立判定。
  • ControlAction.qml — PowerList 弹出面板替换为 ShutdownView,powerVisible 改为跟踪 powerShutdownView.visible,点击外部通过 onOutsideClicked 关闭。
  • LoginView.qml — 连接 onOutsideClicked: GreeterProxy.showShutdownView = false
  • CMakeLists.txt — 从 QML_FILES 移除 qml/PowerList.qml
  • PowerList.qml — 已删除。
  • translations/lockscreen.*.ts(18 个文件)— 移除 PowerList 上下文,4 条电源文案迁移至 ShutdownView 上下文并更新行号。

变更统计

24 files changed, 446 insertions(+), 585 deletions(-)

代码审核

代码已通过 AI 审核(97 分),审核建议的两处优化已应用:

  1. 删除 MouseArea 的冗余 enabled: true
  2. powerOffBtnKeyNavigation.backtab 条件表达式上方添加注释

Summary by Sourcery

Replace the lockscreen PowerList implementation with a unified ShutdownView action chain and update its integration and translations.

Enhancements:

  • Consolidate lockscreen power and permission actions into a single flat ShutdownView button chain with direct, non-circular keyboard navigation and lock-state-aware focus handling.
  • Simplify power-menu integration and outside-click dismissal across the lockscreen views.
  • Allow button visibility to be controlled independently from enabled state.

Build:

  • Remove the obsolete PowerList QML file from the lockscreen module.

Chores:

  • Move lockscreen power-action translations from the removed PowerList context into ShutdownView across supported locales.

…ton chain

Consolidate all 7 power/permission buttons (lock, switch user, logout,
shut down, reboot, suspend, hibernate) into ShutdownView.qml as a flat
RowLayout. Remove PowerList.qml and its ObjectModel injection,
loopInside/tabOutForward/tabOutBackward signals. Tab navigation is now
a simple linear chain within ShutdownView. ControlAction uses ShutdownView
directly with outsideClicked signal.

将全部 7 个电源/权限按钮(lock/switch user/logout/shut down/reboot/
suspend/hibernate)收拢进 ShutdownView.qml 的扁平 RowLayout 按钮链。
删除 PowerList.qml 及 ObjectModel 注入、loopInside/tabOut* 信号,tab
导航改为 ShutdownView 内线性链。ControlAction 直接使用 ShutdownView
和 outsideClicked 信号。

Log: 重构锁屏电源按钮为扁平链,删除 PowerList
Influence: 锁屏电源/权限按钮交互简化,键盘导航改为线性链,代码可维护性提升。
@deepin-ci-robot

Copy link
Copy Markdown

Skipping CI for Draft Pull Request.
If you want CI signal for your change, please convert it to an actual PR.
You can still manually trigger a test run with /test all

@deepin-ci-robot

Copy link
Copy Markdown

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: deepin-wm

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 Sep 14, 2026

Copy link
Copy Markdown

Reviewer's Guide

The lock-screen power and permission actions are consolidated into a single statically wired ShutdownView, replacing PowerList’s dynamic focus/tab behavior with explicit keyboard navigation, shared overlay close handling, and unified translation/build integration.

Sequence diagram for opening and closing the lock-screen shutdown view

sequenceDiagram
    participant User
    participant ControlAction
    participant ShutdownView
    participant LoginView
    participant GreeterProxy

    User->>ControlAction: onClicked
    ControlAction->>ControlAction: powerItem.expand = true
    ControlAction->>ShutdownView: focusFirstButton()
    User->>ShutdownView: outside click
    ShutdownView-->>ControlAction: outsideClicked()
    ControlAction->>ControlAction: powerItem.expand = false
    ShutdownView-->>LoginView: outsideClicked()
    LoginView->>GreeterProxy: showShutdownView = false
Loading

Flow diagram for the flat shutdown button focus chain

flowchart LR
    Lock[lockBtn] --> Switch[switchBtn]
    Switch --> Logout[logoutBtn]
    Logout --> PowerOff[powerOffBtn]
    PowerOff --> Reboot[rebootBtn]
    Reboot --> Suspend[suspendBtn]
    Suspend --> Hibernate[hibernateBtn]

    Lock -. backtab .-> Hibernate
    Switch -. backtab .-> Lock
    Logout -. backtab .-> Switch
    PowerOff -. backtab .-> Logout
    Reboot -. backtab .-> PowerOff
    Suspend -. backtab .-> Reboot
    Hibernate -. backtab .-> Suspend

    Locked[GreeterProxy.isLocked] -.-> PowerOff
Loading

File-Level Changes

Change Details Files
Replaced the separate dynamic power list and lock-screen action buttons with one statically declared seven-button shutdown action chain.
  • Added all lock, user, session, and power actions to a single RowLayout.
  • Defined explicit forward and backward keyboard navigation without wraparound, including locked-state handling for the hidden logout button.
  • Added first-focus initialization and an outside-click signal for view lifecycle and focus management.
src/plugins/lockscreen/qml/ShutdownView.qml
src/plugins/lockscreen/qml/ShutdownButton.qml
src/plugins/lockscreen/qml/PowerList.qml
Integrated the unified shutdown view into both power-menu and login-view flows.
  • Replaced PowerList instantiation and loop-control calls with ShutdownView visibility and focus handling.
  • Changed outside-click behavior to close the relevant shutdown overlay through signal connections.
  • Updated power visibility tracking to use the unified view.
src/plugins/lockscreen/qml/ControlAction.qml
src/plugins/lockscreen/qml/LoginView.qml
Removed the obsolete QML component from the build and consolidated translation contexts.
  • Removed PowerList from the QML module manifest and deleted its implementation.
  • Moved the four power-action translation entries into the ShutdownView context across all affected locales and refreshed source locations.
src/plugins/lockscreen/CMakeLists.txt
src/plugins/lockscreen/translations/lockscreen.ar.ts
src/plugins/lockscreen/translations/lockscreen.ca.ts
src/plugins/lockscreen/translations/lockscreen.en_US.ts
src/plugins/lockscreen/translations/lockscreen.es.ts
src/plugins/lockscreen/translations/lockscreen.fi.ts
src/plugins/lockscreen/translations/lockscreen.fr.ts
src/plugins/lockscreen/translations/lockscreen.gl_ES.ts
src/plugins/lockscreen/translations/lockscreen.ja.ts
src/plugins/lockscreen/translations/lockscreen.pl.ts
src/plugins/lockscreen/translations/lockscreen.pt.ts
src/plugins/lockscreen/translations/lockscreen.pt_BR.ts
src/plugins/lockscreen/translations/lockscreen.ru.ts
src/plugins/lockscreen/translations/lockscreen.sq.ts
src/plugins/lockscreen/translations/lockscreen.tr.ts
src/plugins/lockscreen/translations/lockscreen.uk.ts
src/plugins/lockscreen/translations/lockscreen.zh_CN.ts
src/plugins/lockscreen/translations/lockscreen.zh_HK.ts
src/plugins/lockscreen/translations/lockscreen.zh_TW.ts

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

@gugullll gugullll closed this Sep 15, 2026
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