Skip to content

fix: clear shortcut conflict warning state on page leave#3206

Open
MyLeeJiEun wants to merge 1 commit intolinuxdeepin:masterfrom
MyLeeJiEun:fork-0429-fix-shortcuts-issue
Open

fix: clear shortcut conflict warning state on page leave#3206
MyLeeJiEun wants to merge 1 commit intolinuxdeepin:masterfrom
MyLeeJiEun:fork-0429-fix-shortcuts-issue

Conversation

@MyLeeJiEun
Copy link
Copy Markdown

@MyLeeJiEun MyLeeJiEun commented Apr 30, 2026

  1. Add Connections to listen for deactive signal on shortcutSettingsView
  2. Clear conflictAccels and isEditing when leaving the shortcuts page
  3. 监听快捷键页面的 deactive 信号
  4. 离开快捷键页面时清除 conflictAccels 和 isEditing 状态
    Log: 修复快捷键冲突警告图标在返回后重新进入时仍然存在的问题
    PMS: BUG-359155
    Influence: 修复用户录制快捷键触发冲突后直接返回,再次进入时警告图标仍然残留的问题

Summary by Sourcery

Bug Fixes:

  • Clear shortcut conflict and editing state when leaving the shortcuts page so warning icons do not persist after navigating away and back.

    1. Add Connections to listen for deactive signal on shortcutSettingsView
    2. Clear conflictAccels and isEditing when leaving the shortcuts page
    1. 监听快捷键页面的 deactive 信号
    2. 离开快捷键页面时清除 conflictAccels 和 isEditing 状态
    Log: 修复快捷键冲突警告图标在返回后重新进入时仍然存在的问题
    PMS: BUG-359155
    Influence: 修复用户录制快捷键触发冲突后直接返回,再次进入时警告图标仍然残留的问题

Signed-off-by: zhaofangxun <zhaofangxun@uniontech.com>
@deepin-ci-robot
Copy link
Copy Markdown

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: MyLeeJiEun

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

@deepin-ci-robot
Copy link
Copy Markdown

Hi @MyLeeJiEun. Thanks for your PR. 😃

@deepin-ci-robot
Copy link
Copy Markdown

Hi @MyLeeJiEun. Thanks for your PR.

I'm waiting for a linuxdeepin member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

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.

@github-actions
Copy link
Copy Markdown

CLA Assistant Lite bot:
提交邮箱中包含我们的合作伙伴,但您似乎并非合作伙伴的成员或对接人,请联系相关对接人将您添加至组织之中,或由其重新发起 Pull Request。
The commit email domain belongs to one of our partners, but it seems you are not yet a member of the current organization, please contact the contact person to add you to the organization or let them submit the Pull Request.

zhaofangxun seems not to be a GitHub user. You need a GitHub account to be able to sign the CLA. If you have already a GitHub account, please add the email address used for this commit to your account.
You can retrigger this bot by commenting recheck in this Pull Request

@sourcery-ai
Copy link
Copy Markdown

sourcery-ai Bot commented Apr 30, 2026

Reviewer's guide (collapsed on small PRs)

Reviewer's Guide

Listens for the shortcuts view deactivation signal and clears transient shortcut editing state so conflict warnings do not persist when navigating away and back to the page.

Sequence diagram for clearing shortcut conflict state on page leave

sequenceDiagram
    actor User
    participant ShortcutSettingsView
    participant ShortcutsQml
    participant ShortcutSettingsBody

    User->>ShortcutSettingsView: navigateAwayFromShortcutsPage()
    ShortcutSettingsView-->>ShortcutsQml: deactive
    ShortcutsQml->>ShortcutSettingsBody: set conflictAccels = ""
    ShortcutsQml->>ShortcutSettingsBody: set isEditing = false
    User->>ShortcutSettingsView: navigateBackToShortcutsPage()
    ShortcutSettingsView-->>ShortcutSettingsBody: display with cleared conflict state
Loading

Class diagram for updated shortcut settings QML components

classDiagram
    class ShortcutsQml {
        +Connections shortcutSettingsViewDeactive
    }

    class ShortcutSettingsView {
        +deactive()
    }

    class ShortcutSettingsBody {
        +bool isEditing
        +string conflictAccels
    }

    ShortcutsQml --> ShortcutSettingsView : listens_to_deactive
    ShortcutsQml --> ShortcutSettingsBody : clears_state_on_deactive
Loading

File-Level Changes

Change Details Files
Reset transient shortcut editing state when the shortcuts page is deactivated to clear stale conflict warnings.
  • Add a QML Connections block bound to shortcutSettingsView to handle its deactive signal.
  • In the deactive handler, reset shortcutSettingsBody.conflictAccels to an empty string.
  • In the deactive handler, reset shortcutSettingsBody.isEditing to false to exit editing mode on page leave.
src/plugin-keyboard/qml/Shortcuts.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

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 left some high level feedback:

  • Consider guarding the Connections target with a null check or enabled condition in case shortcutSettingsView is not yet initialized when this component is created, to avoid potential runtime warnings.
  • Since resetting conflictAccels and isEditing may be needed from multiple places, consider extracting this logic into a small helper function on shortcutSettingsBody (e.g., resetState()), and call that from onDeactive() to keep the state-reset behavior centralized.
Prompt for AI Agents
Please address the comments from this code review:

## Overall Comments
- Consider guarding the `Connections` target with a null check or `enabled` condition in case `shortcutSettingsView` is not yet initialized when this component is created, to avoid potential runtime warnings.
- Since resetting `conflictAccels` and `isEditing` may be needed from multiple places, consider extracting this logic into a small helper function on `shortcutSettingsBody` (e.g., `resetState()`), and call that from `onDeactive()` to keep the state-reset behavior centralized.

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.

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants