Skip to content

feat(DApplication): allow customizing website name/link in the about dialog - #778

Open
18202781743 wants to merge 1 commit into
linuxdeepin:masterfrom
18202781743:feat/dde-211-custom-website-about-dialog
Open

feat(DApplication): allow customizing website name/link in the about dialog#778
18202781743 wants to merge 1 commit into
linuxdeepin:masterfrom
18202781743:feat/dde-211-custom-website-about-dialog

Conversation

@18202781743

@18202781743 18202781743 commented Sep 1, 2026

Copy link
Copy Markdown
Contributor

背景

DApplication::handleAboutAction() 在自动创建关于对话框时,只设置了 productName / productIcon / version / description / license / acknowledgement,未调用 DAboutDialog::setWebsiteName / setWebsiteLink,导致应用无法自定义网站行,始终回退到发行版默认值。

根因

  • DAboutDialog 本身已具备 setWebsiteName() / setWebsiteLink() 能力,但 DApplication 的自动创建路径没有接线。
  • DApplication 已有 applicationHomePage / setApplicationHomePage 属性,文档明确写着「主要用于在关于对话框中进行展示」,但该属性从未被 handleAboutAction() 读取,属于遗留死 API。

方案(采用 DDE Architect 推荐方案)

复用遗留的 applicationHomePage(作为 link 源),并新增 applicationWebsiteName(作为展示名称):

改动文件

  1. include/widgets/dapplication.h

    • 新增 Q_PROPERTY(QString applicationHomePage ...)(补齐元对象一致性)
    • 新增 Q_PROPERTY(QString applicationWebsiteName ...)
    • 新增 applicationWebsiteName() / setApplicationWebsiteName() 声明
  2. src/widgets/dapplication.cpp

    • 实现 applicationWebsiteName() / setApplicationWebsiteName()(读写 d->websiteName
    • handleAboutAction() 自动建对话框段落,设置完 acknowledgement 后、setAttribute(WA_DeleteOnClose) 前,按「非空才覆盖」插入:
      if (!applicationHomePage().isEmpty())
          aboutDialog->setWebsiteLink(applicationHomePage());
      if (!applicationWebsiteName().isEmpty())
          aboutDialog->setWebsiteName(applicationWebsiteName());
  3. src/widgets/private/dapplication_p.h

    • 新增成员 QString websiteName;
  4. CHANGELOG.md

    • Added: applicationWebsiteName 属性
    • Changed: applicationHomePage 现生效于关于对话框

向后兼容

  • 纯增量 API:新增 applicationWebsiteName getter/setter 与 Q_PROPERTY,以及为 applicationHomePageQ_PROPERTY,均为源码/二进制兼容的加法(DTK6 SONAME 线内)。
  • 默认行为不变:当开发者未设 applicationHomePageapplicationWebsiteName 时,两个 if (!...isEmpty()) 均不触发,对话框仍显示发行版默认网站。
  • applicationHomePage 从死代码变为生效:变更方向符合其文档一直承诺的用途;唯一受影响的是「调用了 setApplicationHomePage 却期望它什么都不做」的极端组合,实际中几乎不存在。
  • 自定义对话框路径不受影响:经 setAboutDialog() 传入的对话框不走新逻辑。
  • 无需 DTK 版本守卫:DTK6 线的新增特性。

测试建议

新增用例覆盖 4 个组合:

  • (name, link) 均空 → 显示发行版默认
  • 仅 link → link 自定义、名称为发行版默认
  • 仅 name → 名称自定义、link 为发行版默认
  • 均设 → 均为自定义值

并回归:

  • 不设任何值时仍显示发行版默认
  • setAboutDialog 自定义对话框不受影响

关联

  • Issue: DDE-211
  • 技术方案:DDE Architect

Summary by Sourcery

Enable applications to customize the website name and link displayed in automatically generated about dialogs while preserving default fallbacks.

New Features:

  • Add configurable website display name and link properties for automatically generated about dialogs.

Bug Fixes:

  • Make the existing applicationHomePage setting apply to the about dialog website link instead of being ignored.

Documentation:

  • Document the new website name property and the applicationHomePage behavior in the changelog.

…dialog

DApplication::handleAboutAction() previously did not call
DAboutDialog::setWebsiteName/setWebsiteLink when auto-creating the
about dialog, so applications could not customize the website row and
always fell back to the distribution default.

This change:
- Wires the existing (previously dead) applicationHomePage property to
  DAboutDialog::setWebsiteLink, fulfilling its documented purpose.
- Adds a new applicationWebsiteName property mapped to
  DAboutDialog::setWebsiteName for the display name.
- Adds Q_PROPERTY declarations for both properties.
- Both are applied only when non-empty, preserving the default
  distribution-fallback behavior.

Closes: DDE-211
@deepin-ci-robot

Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: 18202781743

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

@sourcery-ai

sourcery-ai Bot commented Sep 1, 2026

Copy link
Copy Markdown

Reviewer's Guide

The PR turns DApplication’s previously unused homepage setting into an effective about-dialog website link and adds an optional website display name, with non-empty overrides preserving distribution defaults and custom about-dialog instances unaffected.

Sequence diagram for customized about dialog website settings

sequenceDiagram
    participant App as DApplication
    participant Dialog as DAboutDialog

    App->>App: handleAboutAction()
    App->>Dialog: setWebsiteLink(applicationHomePage())
    App->>Dialog: setWebsiteName(applicationWebsiteName())
    Dialog-->>App: Display custom values or distribution defaults
Loading

File-Level Changes

Change Details Files
Expose configurable website display metadata on DApplication and wire it into automatically generated about dialogs.
  • Add Q_PROPERTY declarations and getter/setter API for the existing homepage link and new website name.
  • Store the website name in DApplicationPrivate.
  • Apply non-empty homepage and website name values when populating the automatic about dialog, preserving dialog defaults when unset.
  • Document the new property and newly effective homepage behavior.
include/widgets/dapplication.h
src/widgets/dapplication.cpp
src/widgets/private/dapplication_p.h
CHANGELOG.md

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

@sourcery-ai sourcery-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Hey - I've reviewed your changes and they look great!


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.

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.

2 participants