Skip to content

feat: expose localized Keywords in the app model (linuxdeepin/developer-center#3375) - #1776

Merged
BLumia merged 2 commits into
linuxdeepin:masterfrom
foresee-io:master
Oct 22, 2026
Merged

BLumia merged 2 commits into
linuxdeepin:masterfrom
foresee-io:master

Conversation

@foresee-io

@foresee-io foresee-io commented Oct 21, 2026 •

Copy link
Copy Markdown
Contributor

Related to linuxdeepin/developer-center#3375.

Application search consumers need access to the Keywords metadata exposed by dde-application-manager.

This PR adds a Keywords role to the shared application model, selecting the applicable locale with fallback and updating the role when application properties change. It reuses the existing locale fallback helper for string and string-list values.

Depends on the corresponding dde-application-manager change.


应用搜索组件需要通过共享应用模型获取 dde-application-manager 提供的 Keywords 元数据。

本 PR 为共享应用模型新增 Keywords 角色,按照当前 locale 及回退规则选择关键词,并在应用属性变化时同步更新。同时复用既有的 locale 回退函数,支持字符串和字符串列表。

依赖对应的 dde-application-manager 修改。

Summary by Sourcery

Expose localized application keywords through the shared app model for search consumers.

New Features:

  • Expose locale-selected application Keywords through the shared app model as a new model role.

Enhancements:

  • Reuse locale fallback handling for both localized strings and keyword lists, including updates when application properties change.

Chores:

  • Register the D-Bus and Qt metadata type for localized keyword lists.

1. Add the Keywords role and consume the application manager's per-locale
   keyword lists during initialization and property updates.
2. Generalize the existing locale fallback helper for QString and
   QStringList values, preserving its empty-value behavior.
3. Store the selected locale in the existing scalar GenericName role and
   add tests for exact, language and default fallback at both entry points.

Log: Provide locale-selected generic names and keywords to model consumers
Influence: GenericName now uses the selected locale instead of always
          using the default value. Keywords retains all words from that
          locale; default values are only used as fallbacks.

feat: 在共享应用模型中暴露本地化的应用关键词

1. 新增 Keywords 角色,在初始化和属性更新时读取应用管理器提供的
   按 locale 划分的关键词列表。
2. 将既有 locale 回退函数泛化为同时支持 QString 和 QStringList,
   保留遇到已存在的空值键时停止回退的行为。
3. 通过既有单数 GenericName 角色保存选中 locale 的值,并为两个入口
   补充精确 locale、语言及默认值回退测试。

Log: 为模型消费者提供按 locale 选择的通用名称和关键词
Influence: GenericName 改为使用选中 locale 的值,不再固定读取默认值;
          Keywords 保留该 locale 内的所有词,默认值仅用于回退。
Copilot AI balanced review requested due to automatic review settings October 21, 2026 09:33

Copilot AI 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.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

An organization owner can choose the repository organization as the billing source for reviews requested by members with a paid Copilot license. Learn about Copilot code review billing.

@deepin-ci-robot

Copy link
Copy Markdown

Hi @foresee-io. Thanks for your PR. 😃

@github-actions

github-actions Bot commented Oct 21, 2026 •

Copy link
Copy Markdown

CLA Assistant Lite bot All contributors have signed the CLA ✍️ ✅

@deepin-ci-robot

Copy link
Copy Markdown

Hi @foresee-io. Thanks for your PR.

I'm waiting for a linuxdeepin member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

Details

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@sourcery-ai

sourcery-ai Bot commented Oct 21, 2026

Copy link
Copy Markdown

Reviewer's Guide

The PR propagates dde-application-manager Keywords metadata into the shared application model by registering its localized string-list type, applying the existing locale fallback policy, synchronizing changes from D-Bus properties, and exposing the result through a new keywords role.

Sequence diagram for localized Keywords propagation

sequenceDiagram
    participant AM as dde-application-manager
    participant Item as AMAppItem
    participant Model as AppItemModel
    participant Consumer as SearchConsumer

    AM->>Item: appInfo Keywords
    Item->>Item: getLocaleOrDefaultValue
    Item->>Model: setKeywords
    Model-->>Consumer: keywords via KeywordsRole

    AM->>Item: onPropertyChanged Keywords
    Item->>Item: qdbus_cast<QStringListMap>
    Item->>Item: getLocaleOrDefaultValue
    Item->>Model: setKeywords
Loading

File-Level Changes

Change Details Files
Adds locale-selected Keywords metadata to the shared application item and exposes it through the model.
  • Adds a Keywords model role with getter/setter storage on AppItem.
  • Reads Keywords during item construction and updates it on D-Bus property changes.
  • Registers the locale-to-string-list D-Bus type and preserves localized keyword lists.
applets/dde-apps/appitem.h
applets/dde-apps/appitem.cpp
applets/dde-apps/appitemmodel.h
applets/dde-apps/appitemmodel.cpp
applets/dde-apps/api/types/am.h
applets/dde-apps/amappitem.cpp
applets/dde-apps/amappitem.h
Generalizes locale fallback handling so localized strings and keyword lists share the same selection policy.
  • Templatizes the locale fallback helper for QMap values of different types.
  • Retains exact-locale, language-prefix, and default-key fallback ordering, including empty values.
applets/dde-apps/amappitem.h
applets/dde-apps/amappitem.cpp

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 ✨

@foresee-io

Copy link
Copy Markdown
Contributor Author

I have read the CLA Document and I hereby sign the CLA.

@BLumia BLumia left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

此 PR 没引入实际的功能需求,只是暴露数据给其他组件使用,是没问题的。

@deepin-ci-robot

Copy link
Copy Markdown

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: BLumia, foresee-io

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

@BLumia
BLumia merged commit 7836787 into linuxdeepin:master Oct 22, 2026
3 of 6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants