From 9e78761961d6148c366dd443ac3528aea1d6844f Mon Sep 17 00:00:00 2001 From: zhaofangxun Date: Tue, 19 May 2026 21:01:59 +0800 Subject: [PATCH] fix: conditionally show hyperlink in acknowledgments MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 1. Add D.LicenseInfoProvider to check license path validity in AboutDialog 2. Only display open-source software text as hyperlink when license path is valid 3. Pass LicenseInfoProvider instance to LicenseDialog instead of license path string Log: Fix open-source software acknowledgement text to only hyperlink when license info is available fix: 根据许可路径有效性条件显示超链接 1. 在关于对话框中添加 D.LicenseInfoProvider 检查许可路径有效性 2. 仅在许可路径有效时将开源软件文本显示为超链接 3. 将 LicenseInfoProvider 实例传递给许可对话框,替代路径字符串 Log: 修复开源软件致谢文本,仅在许可信息可用时显示为超链接 PMS: BUG-361031 --- qt6/src/qml/AboutDialog.qml | 16 ++++++++++++++-- qt6/src/qml/LicenseDialog.qml | 6 +----- 2 files changed, 15 insertions(+), 7 deletions(-) diff --git a/qt6/src/qml/AboutDialog.qml b/qt6/src/qml/AboutDialog.qml index 3cef98ea..006d7d9a 100644 --- a/qt6/src/qml/AboutDialog.qml +++ b/qt6/src/qml/AboutDialog.qml @@ -31,6 +31,12 @@ DialogWindow { id: contentView width: parent.width implicitHeight: contentLayout.implicitHeight + + D.LicenseInfoProvider { + id: licensePathChecker + path: control.licensePath + } + ColumnLayout { id: contentLayout spacing: 0 @@ -138,7 +144,13 @@ DialogWindow { } Label { id: acknowledgmentsLabel - text: qsTr("Sincerely appreciate the %1 used.").arg(control.__websiteLinkTemplate.arg("-").arg(qsTr("open-source software"))) + text: { + var softwareText = qsTr("open-source software"); + if (licensePathChecker.valid) + return qsTr("Sincerely appreciate the %1 used.").arg(control.__websiteLinkTemplate.arg("-").arg(softwareText)); + else + return qsTr("Sincerely appreciate the %1 used.").arg(softwareText); + } textFormat: Text.RichText Layout.fillWidth: true font: D.DTK.fontManager.t8 @@ -173,7 +185,7 @@ DialogWindow { id: licenseDialogLoader active: false sourceComponent: LicenseDialog { - licensePath: control.licensePath + licenseProvider: licensePathChecker onClosing: function (close) { licenseDialogLoader.active = false } diff --git a/qt6/src/qml/LicenseDialog.qml b/qt6/src/qml/LicenseDialog.qml index aff0df0a..5f394453 100644 --- a/qt6/src/qml/LicenseDialog.qml +++ b/qt6/src/qml/LicenseDialog.qml @@ -15,7 +15,7 @@ DialogWindow { height: 900 title: qsTr("open-source software") - property alias licensePath: licenseProvider.path + property D.LicenseInfoProvider licenseProvider header: D.DialogTitleBar { leftContent: Item { @@ -37,10 +37,6 @@ DialogWindow { implicitWidth: control.width - control.leftPadding - control.rightPadding implicitHeight: control.height - DS.Style.dialogWindow.titleBarHeight - DS.Style.dialogWindow.contentHMargin - D.LicenseInfoProvider { - id: licenseProvider - } - StackView { id: stackView anchors.fill: parent