Skip to content

fix: update license file search logic and UI improvements#3149

Merged
deepin-bot[bot] merged 1 commit intolinuxdeepin:masterfrom
mhduiy:doc
Apr 2, 2026
Merged

fix: update license file search logic and UI improvements#3149
deepin-bot[bot] merged 1 commit intolinuxdeepin:masterfrom
mhduiy:doc

Conversation

@mhduiy
Copy link
Copy Markdown
Contributor

@mhduiy mhduiy commented Apr 2, 2026

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:

  • Support markdown-formatted license text in the user license page with clickable links and hover cursor feedback.

Bug Fixes:

  • Correct license search behavior for the professional edition by preferring markdown files when available.

Enhancements:

  • Refresh SPDX copyright years in system info utilities and user license QML to reflect 2026.

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
@sourcery-ai
Copy link
Copy Markdown

sourcery-ai bot commented Apr 2, 2026

Reviewer's guide (collapsed on small PRs)

Reviewer's Guide

Updates 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 logic

sequenceDiagram
    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
Loading

File-Level Changes

Change Details Files
Adjust license file lookup to support and prefer markdown (.md) agreements while retaining txt fallback.
  • Extended the license path helper lambda to accept an optional file type that, when omitted, first checks for an .md file and then falls back to .txt.
  • Updated the professional edition agreement lookup to use the new default behavior (md-first with txt fallback).
src/plugin-systeminfo/operation/utils.h
Improve the user license UI to support markdown rendering and interactive links.
  • Configured the license text label to interpret content as markdown and handle link activation by opening URLs externally.
  • Added a HoverHandler that switches the cursor to a pointing hand when hovering over links, enhancing UX expectations for clickable content.
src/plugin-systeminfo/qml/UserLicensePage.qml
Align SPDX copyright date ranges with 2026.
  • Updated the SPDX-FileCopyrightText header in utils.h from 2018–2023 to 2018–2026.
  • Updated the SPDX-FileCopyrightText header in UserLicensePage.qml from 2024–2027 to 2024–2026.
src/plugin-systeminfo/operation/utils.h
src/plugin-systeminfo/qml/UserLicensePage.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:

  • 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.
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.

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.

@deepin-ci-robot
Copy link
Copy Markdown

[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.

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

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 .md over .txt when 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 to professionalEnduserAgreement_old is still forced to "txt" (and the later oldAgreement fallback 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");
    }

@mhduiy
Copy link
Copy Markdown
Contributor Author

mhduiy commented Apr 2, 2026

/forcemerge

@deepin-bot
Copy link
Copy Markdown

deepin-bot bot commented Apr 2, 2026

This pr force merged! (status: blocked)

@deepin-bot deepin-bot bot merged commit d75e42d into linuxdeepin:master Apr 2, 2026
21 of 23 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants