fix: resolve DDE help topics with fallback candidates - #634
Conversation
There was a problem hiding this comment.
Sorry @robertkill, you have reached your weekly rate limit of 500000 diff characters.
Please try again later or upgrade to continue using Sourcery
788b533 to
7966f40
Compare
1. Add DDE control center page keys to the manual title mapping table 2. Resolve DDE-only OpenTitle candidate chains with raw and translated title matching 3. Keep non-DDE applications on the original single-title help resolution path Influence: 1. Test DDE input method add-ons, shortcuts, VPN and full runtime help topic sweep 2. Verify deepin-terminal help does not use the DDE candidate chain 3. Verify the final package contains no BUG368805 trace logging fix: 支持 DDE 帮助主题候选链解析 1. 在手册标题映射表中补充 DDE 控制中心页面 key 2. 仅对 DDE 的 OpenTitle 候选链执行原始标题和翻译标题匹配 3. 保持非 DDE 应用原有的单标题帮助解析路径 Influence: 1. 测试 DDE 输入法附加组件、快捷键、VPN 以及全量运行时帮助主题扫描 2. 验证 deepin-terminal 帮助不会使用 DDE 候选链 3. 验证最终包不包含 BUG368805 临时日志 PMS: BUG-368805
7966f40 to
4799325
Compare
deepin pr auto review★ 总体评分:85分■ 【总体评价】
■ 【详细分析】
■ 【改进建议代码示例】 // src/base/utils.cpp 匹配逻辑修复
QString strRet = titleUS;
QString strlocal(QLocale::system().name());
int nCount = sizeof(languageArr) / sizeof(languageArr[0]);
for (int i = 0; i < nCount; i++) {
if (languageArr[i][0] == titleUS) {
if (0 == strlocal.compare("ug_CN") || 0 == strlocal.compare("bo_CN") || 0 == strlocal.compare("zh_CN")) {
strRet = languageArr[i][1];
} else if (0 == strlocal.compare("zh_HK")) {
strRet = languageArr[i][3];
} else if (0 == strlocal.compare("zh_TW")) {
strRet = languageArr[i][4];
} else {
strRet = languageArr[i][2];
}
break; // 增加break语句,找到匹配项后立即跳出循环,避免无效遍历
}
}// src/web/toManual/js/App.js 将递归改为迭代循环
const titleNodes = d.querySelectorAll('[text]');
const findHashByTitle = (targetTitle) => {
for (let i = 0; i < titleNodes.length; i++) {
if (titleNodes[i].getAttribute('text') === targetTitle) {
return titleNodes[i].id;
}
}
return null;
};
// 使用异步自执行函数替代递归,避免调用栈过深且逻辑更直观
(async () => {
for (let i = 0; i < candidates.length; i++) {
const candidate = candidates[i];
let hashID = findHashByTitle(candidate);
if (hashID === null) {
// 包装为Promise等待异步翻译结果
hashID = await new Promise(resolve => {
global.qtObjects.manual.translateTitle(candidate, titleTr => {
resolve(findHashByTitle(titleTr));
});
});
}
if (hashID !== null) {
global.open(file, hashID);
return;
}
}
// 所有候选均未命中,回退到顶部
global.open(file, 'h0');
})(); |
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: caixr23, lzwind, robertkill 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 |
fix: resolve DDE help topics with fallback candidates
Influence:
fix: 支持 DDE 帮助主题候选链解析
Influence:
PMS: BUG-368805