fix: clear shortcut conflict warning state on page leave#3206
fix: clear shortcut conflict warning state on page leave#3206MyLeeJiEun wants to merge 1 commit intolinuxdeepin:masterfrom
Conversation
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>
|
[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. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
|
Hi @MyLeeJiEun. Thanks for your PR. 😃 |
|
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 Once the patch is verified, the new status will be reflected by the I understand the commands that are listed here. DetailsInstructions 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. |
|
CLA Assistant Lite bot: |
Reviewer's guide (collapsed on small PRs)Reviewer's GuideListens 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 leavesequenceDiagram
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
Class diagram for updated shortcut settings QML componentsclassDiagram
class ShortcutsQml {
+Connections shortcutSettingsViewDeactive
}
class ShortcutSettingsView {
+deactive()
}
class ShortcutSettingsBody {
+bool isEditing
+string conflictAccels
}
ShortcutsQml --> ShortcutSettingsView : listens_to_deactive
ShortcutsQml --> ShortcutSettingsBody : clears_state_on_deactive
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
There was a problem hiding this comment.
Hey - I've left some high level feedback:
- Consider guarding the
Connectionstarget with a null check orenabledcondition in caseshortcutSettingsViewis not yet initialized when this component is created, to avoid potential runtime warnings. - Since resetting
conflictAccelsandisEditingmay be needed from multiple places, consider extracting this logic into a small helper function onshortcutSettingsBody(e.g.,resetState()), and call that fromonDeactive()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.Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
Log: 修复快捷键冲突警告图标在返回后重新进入时仍然存在的问题
PMS: BUG-359155
Influence: 修复用户录制快捷键触发冲突后直接返回,再次进入时警告图标仍然残留的问题
Summary by Sourcery
Bug Fixes: