fix: update license file search logic and UI improvements#3149
fix: update license file search logic and UI improvements#3149deepin-bot[bot] merged 1 commit intolinuxdeepin:masterfrom
Conversation
Updated copyright years from 2023/2027 to 2026 in both utils.h and UserLicensePage.qml files. Modified the license search logic in utils.h to prioritize markdown (.md) files over text (.txt) files when searching for professional end-user agreements. The lambda function now has a default empty type parameter and checks for .md files first, falling back to .txt if not found. Enhanced UserLicensePage.qml by adding markdown text format support with clickable links and a pointing hand cursor on hover for better user interaction. Log: Improved license file detection to support markdown format and enhanced user license page with clickable links fix: 更新许可证文件搜索逻辑和UI改进 将 utils.h 和 UserLicensePage.qml 文件中的版权年份从 2023/2027 更新至 2026。修改了 utils.h 中的许可证搜索逻辑,在搜索专业版最终用户协议时优 先考虑 markdown (.md) 文件而非文本 (.txt) 文件。lambda 函数现在具有默 认的空类型参数,首先检查 .md 文件,如果未找到则回退到 .txt 文件。增强了 UserLicensePage.qml,添加了 markdown 文本格式支持,包含可点击链接和悬停 时的指向手形光标,以改善用户交互体验。 Log: 改进许可证文件检测以支持 markdown 格式,并增强用户许可证页面添加可 点击链接功能 PMS: TASK-388139
Reviewer's guide (collapsed on small PRs)Reviewer's GuideUpdates copyright years, adjusts license file discovery to prefer markdown agreements with a backwards-compatible fallback, and enhances the user license QML page to render markdown content with clickable links and improved cursor feedback. Sequence diagram for updated license file search logicsequenceDiagram
participant SystemInfoModule
participant isEndUserAgreementExist
participant pathIfExists
participant getLicensePath
participant QFile
participant FileSystem
SystemInfoModule->>isEndUserAgreementExist: requestEndUserAgreementPath()
activate isEndUserAgreementExist
isEndUserAgreementExist->>isEndUserAgreementExist: checkEditionType()
alt professionalEdition
isEndUserAgreementExist->>pathIfExists: professionalEnduserAgreement_new
activate pathIfExists
alt noTypeParameter
pathIfExists->>getLicensePath: pattern, md
activate getLicensePath
getLicensePath-->>pathIfExists: mdPath
deactivate getLicensePath
pathIfExists->>QFile: exists(mdPath)
activate QFile
QFile-->>pathIfExists: true or false
deactivate QFile
alt mdExists
pathIfExists-->>isEndUserAgreementExist: mdPath
else mdMissing
pathIfExists->>getLicensePath: pattern, txt
activate getLicensePath
getLicensePath-->>pathIfExists: txtPath
deactivate getLicensePath
pathIfExists->>QFile: exists(txtPath)
activate QFile
QFile-->>pathIfExists: true or false
deactivate QFile
alt txtExists
pathIfExists-->>isEndUserAgreementExist: txtPath
else txtMissing
pathIfExists-->>isEndUserAgreementExist: emptyString
end
end
end
deactivate pathIfExists
alt candidateEmpty
isEndUserAgreementExist->>pathIfExists: professionalEnduserAgreement_old, txt
activate pathIfExists
pathIfExists->>getLicensePath: pattern, txt
activate getLicensePath
getLicensePath-->>pathIfExists: txtPath
deactivate getLicensePath
pathIfExists->>QFile: exists(txtPath)
activate QFile
QFile-->>pathIfExists: true or false
deactivate QFile
alt txtExists
pathIfExists-->>isEndUserAgreementExist: txtPath
else txtMissing
pathIfExists-->>isEndUserAgreementExist: emptyString
end
deactivate pathIfExists
end
else otherEditionTypes
isEndUserAgreementExist->>pathIfExists: pattern, txt
activate pathIfExists
pathIfExists->>getLicensePath: pattern, txt
activate getLicensePath
getLicensePath-->>pathIfExists: txtPath
deactivate getLicensePath
pathIfExists->>QFile: exists(txtPath)
activate QFile
QFile-->>pathIfExists: true or false
deactivate QFile
alt txtExists
pathIfExists-->>isEndUserAgreementExist: txtPath
else txtMissing
pathIfExists-->>isEndUserAgreementExist: emptyString
end
deactivate pathIfExists
end
isEndUserAgreementExist->>FileSystem: returnLicenseSearchInfo(candidatePath)
deactivate isEndUserAgreementExist
FileSystem-->>SystemInfoModule: LicenseSearchInfo
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:
- Using an empty string as a sentinel in
pathIfExiststo trigger the md-then-txt behavior is a bit implicit; consider making this explicit (e.g., via an overload, enum, or dedicated helper) so the call sites clearly communicate when the fallback logic is used. - Switching
UserLicensePage.qmltoText.MarkdownTextassumes the license content is valid markdown; if some existing licenses are plain text, you might want to useText.AutoTextor a simple heuristic to avoid unexpected formatting regressions.
Prompt for AI Agents
Please address the comments from this code review:
## Overall Comments
- Using an empty string as a sentinel in `pathIfExists` to trigger the md-then-txt behavior is a bit implicit; consider making this explicit (e.g., via an overload, enum, or dedicated helper) so the call sites clearly communicate when the fallback logic is used.
- Switching `UserLicensePage.qml` to `Text.MarkdownText` assumes the license content is valid markdown; if some existing licenses are plain text, you might want to use `Text.AutoText` or a simple heuristic to avoid unexpected formatting regressions.Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: 18202781743, mhduiy 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 |
There was a problem hiding this comment.
Pull request overview
This PR updates the System Info plugin to better support markdown-formatted End User License Agreements (EULA) and improves the EULA display so links can be opened externally. It also refreshes SPDX copyright years to 2026.
Changes:
- Prefer
.mdover.txtwhen locating the professional edition EULA (new-path lookup). - Render the EULA as Markdown in the UI and open activated links via the default browser.
- Update SPDX copyright year ranges to end at 2026.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
src/plugin-systeminfo/qml/UserLicensePage.qml |
Switches license rendering to Text.MarkdownText and adds link activation handling. |
src/plugin-systeminfo/operation/utils.h |
Adjusts EULA path selection to prefer markdown for the professional edition (new path) and updates SPDX years. |
Comments suppressed due to low confidence (1)
src/plugin-systeminfo/operation/utils.h:212
- The new markdown-first logic is only applied to
professionalEnduserAgreement_new. The fallback toprofessionalEnduserAgreement_oldis still forced to "txt" (and the lateroldAgreementfallback is also txt-only), which means markdown EULAs under the legacy path will be ignored. If the goal is “prefer .md over .txt for professional agreements”, consider using the same markdown-first lookup for the old professional pattern (and possibly the generic fallback) as well.
candidate = pathIfExists(professionalEnduserAgreement_new);
if (candidate.isEmpty())
candidate = pathIfExists(professionalEnduserAgreement_old, "txt");
}
|
/forcemerge |
|
This pr force merged! (status: blocked) |
Updated copyright years from 2023/2027 to 2026 in both utils.h and UserLicensePage.qml files. Modified the license search logic in utils.h to prioritize markdown (.md) files over text (.txt) files when searching for professional end-user agreements. The lambda function now has a default empty type parameter and checks for .md files first, falling back to .txt if not found. Enhanced UserLicensePage.qml by adding markdown text format support with clickable links and a pointing hand cursor on hover for better user interaction.
Log: Improved license file detection to support markdown format and enhanced user license page with clickable links
fix: 更新许可证文件搜索逻辑和UI改进
将 utils.h 和 UserLicensePage.qml 文件中的版权年份从 2023/2027 更新至 2026。修改了 utils.h 中的许可证搜索逻辑,在搜索专业版最终用户协议时优
先考虑 markdown (.md) 文件而非文本 (.txt) 文件。lambda 函数现在具有默 认的空类型参数,首先检查 .md 文件,如果未找到则回退到 .txt 文件。增强了
UserLicensePage.qml,添加了 markdown 文本格式支持,包含可点击链接和悬停 时的指向手形光标,以改善用户交互体验。
Log: 改进许可证文件检测以支持 markdown 格式,并增强用户许可证页面添加可
点击链接功能
PMS: TASK-388139
Summary by Sourcery
Update license lookup to support markdown agreements and improve the user license page display.
New Features:
Bug Fixes:
Enhancements: