fix: resolve custom shortcut conflicts during reset - #120
Conversation
Restore built-in shortcut defaults synchronously during Reset. - Read normalized DConfig defaults before processing delayed change signals. - Remove conflicting hotkeys from runtime custom shortcuts transactionally. - Suppress duplicate reset notifications while preserving removal handling. 在重置过程中同步恢复内置快捷键默认值。 - 在处理延迟变更信号前读取并规范化 DConfig 默认值。 - 以事务方式移除自定义快捷键中冲突的按键绑定。 - 在保留删除处理的同时抑制重复的重置通知。 Log: resolve custom shortcut conflicts during reset Pms: BUG-372049 Change-Id: Id8454152aacee9b7af28ca0edefc4f6425362a68
There was a problem hiding this comment.
Sorry @yixinshark, you have reached your weekly rate limit of 500000 diff characters.
Please try again later or upgrade to continue using Sourcery
Reviewer's GuideReset now restores built-in shortcut defaults synchronously, then clears conflicting runtime custom shortcuts and suppresses duplicate DConfig-driven keyconfig updates during the reset transaction. Sequence diagram for shortcut Reset flow with conflict resolutionsequenceDiagram
actor User
participant KeybindingManager
participant KeyHandler as m_keyHandler
participant ConfigLoader as m_loader
participant CustomShortcutTransaction
User->>KeybindingManager: Reset()
KeybindingManager->>KeyHandler: commitSync()
alt commitSync fails
KeybindingManager-->>User: reset aborted
else commitSync ok
KeybindingManager->>ConfigLoader: resetHotkeys(resetIds)
ConfigLoader-->>KeybindingManager: resetConfigs
KeybindingManager->>KeybindingManager: normalizeHotkeys(resetConfigs.hotkeys)
KeybindingManager->>CustomShortcutTransaction: clearConflictingHotkeys(this, restoredHotkeys)
loop for each config in resetConfigs
KeybindingManager->>KeybindingManager: onKeyConfigChanged(config)
end
end
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
deepin pr auto review★ 总体评分:95分■ 【总体评价】
■ 【详细分析】
■ 【改进建议代码示例】 // 当前代码逻辑已经非常完善,无需额外修复,以下为保持格式完整的原样代码片段展示
void KeybindingManager::Reset()
{
// ... 前置代码 ...
const QSet<QString> resetIdSet(resetIds.begin(), resetIds.end());
m_resetInProgressIds.unite(resetIdSet);
QSet<QString> restoredHotkeys;
QList<KeyConfig> resetConfigs = m_loader->resetHotkeys(resetIds);
for (KeyConfig &config : resetConfigs) {
config.hotkeys = normalizeHotkeys(config.hotkeys);
restoredHotkeys.unite(QSet<QString>(config.hotkeys.begin(), config.hotkeys.end()));
}
CustomShortcutTransaction::clearConflictingHotkeys(this, restoredHotkeys);
for (const KeyConfig &config : std::as_const(resetConfigs)) {
if (!m_resetInProgressIds.remove(config.getId()))
continue;
onKeyConfigChanged(config);
}
m_resetInProgressIds.subtract(resetIdSet);
} |
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: robertkill, yixinshark 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 |
|
/forcemerge |
|
This pr force merged! (status: blocked) |
Summary
Test plan
git diff --checkcmake --build build --target plugin-dde-shortcut -j2Pms: BUG-372049
Summary by Sourcery
Ensure shortcut reset restores built-in defaults synchronously while resolving conflicts with runtime custom shortcuts and suppressing redundant configuration change processing.
Bug Fixes:
Enhancements: