Skip to content

fix: add kApp to desktop organizer categories - #4673

Closed
GongHeng2017 wants to merge 1 commit into
linuxdeepin:masterfrom
GongHeng2017:master
Closed

GongHeng2017 wants to merge 1 commit into
linuxdeepin:masterfrom
GongHeng2017:master

Conversation

@GongHeng2017

@GongHeng2017 GongHeng2017 commented Oct 19, 2026 •

Copy link
Copy Markdown
Contributor

Root Cause Analysis

Desktop organizer's DConfig default value organizeCategories lists kDocument/kPicture/kVideo/kMusic/kFolder but omits kApp. TypeClassifier::classify() correctly identifies .desktop files as kTypeKeyApp, but since no "kApp" collection is configured, classes() never creates an Application collection. The classification result "Type_Apps" finds no matching collection, so .desktop shortcuts are dropped or (in some versions) misfiled under "Other". Key evidence: assets/configs/org.deepin.dde.file-manager.desktop.organizer.json:61 (missing kApp); configpresenter.cpp:281 (enabledTypeCategories iterates the config array); typeclassifier.cpp:112 (classes builds collections from config).

Fix

Prepend "kApp" to organizeCategories.value so the Application collection is created by default and .desktop shortcuts are filed into it. No code logic change — only the config default value changes.

Change Safety Assessment

Code Safety

  • Risk Level: Low
  • Only the DConfig default value changes (one array element added); no function signature, no public member, no code path change. The organizeCategories consumer ConfigPresenter::enabledTypeCategories() iterates the config array and matches strings to ItemCategories flags — "kApp" maps to kCatApplication, behaving identically to the existing 5 entries.
  • Historical blame shows the organizeCategories line was last touched by commit 86a3f699 (custom action argument replacement, unrelated to category semantics); this change does not revert any historical fix.

Business Impact Scope

  • Desktop Organizer — affected module. After enabling desktop organize, newly installed apps (generating .desktop) will be grouped into the "Application" category instead of being dropped or misfiled under "Other". The existing Document/Picture/Video/Music/Folder categories are unchanged.
  • Users with a previously persisted organizeCategories DConfig value are unaffected — the default only applies to new or reset configurations.

Verification Suggestion

  • Install a new app from the app store → right-click desktop "Desktop Organize" → verify the .desktop appears under the "Application" category.
  • Verify the existing 5 categories still organize correctly; verify users with a previously persisted config value are not affected.

根因分析

桌面整理的 DConfig 默认值 organizeCategories 包含 kDocument/kPicture/kVideo/kMusic/kFolder 但缺少 kApp。TypeClassifier::classify() 能正确识别 .desktop 文件为 kTypeKeyApp,但由于配置中无 "kApp",classes() 不会创建"应用程序"集合,分类结果 "Type_Apps" 找不到对应集合,.desktop 快捷方式被丢弃或误归"其他"。关键证据:assets/configs/org.deepin.dde.file-manager.desktop.organizer.json:61(缺少 kApp);configpresenter.cpp:281(enabledTypeCategories 遍历配置数组);typeclassifier.cpp:112(classes 根据配置构建集合)。

修复方案

在 organizeCategories.value 首部新增 "kApp",使桌面整理默认创建"应用程序"集合,.desktop 文件正确归入该集合。无代码逻辑改动,仅变更配置默认值。

改动安全评估

代码安全评估

  • 风险等级: 低风险
  • 仅变更 DConfig 配置默认值(新增一项数组元素),不改动函数签名、公开成员或代码路径。organizeCategories 的消费方 ConfigPresenter::enabledTypeCategories() 遍历配置数组并按字符串匹配置位 ItemCategories 标志——"kApp" 映射到 kCatApplication,行为与已有 5 项完全一致。
  • 历史 blame 显示 organizeCategories 行最近由提交 86a3f699(自定义动作参数替换,与分类语义无关)触碰,本次变更不会撤销任何历史修复。

业务影响范围

  • 桌面整理 — 受影响模块。开启桌面整理后,新安装应用(生成 .desktop)将归入"应用程序"分类,而非被丢弃或误归"其他"。原有 文档/图片/视频/音乐/文件夹 五类归档行为不变。
  • 已持久化 organizeCategories 配置的用户不受影响——默认值仅对新用户或重置配置的用户生效。

验证建议

  • 从应用商店安装新程序 → 右键桌面"桌面整理" → 验证 .desktop 出现在"应用程序"分类。
  • 验证原有五类归档正常;验证已持久化配置的用户不受影响。

Summary by Sourcery

Bug Fixes:

  • Include applications in the desktop organizer’s default categories so .desktop shortcuts are grouped under Application instead of being omitted or misclassified.

1. Root cause: the organizeCategories DConfig default value lists
   kDocument/kPicture/kVideo/kMusic/kFolder but omits kApp, so the
   Application category collection is never created during desktop
   organization
2. Fix: prepend "kApp" to organizeCategories.value so the Application
   collection is created by default and .desktop shortcuts are filed
   into it instead of being dropped or misfiled under Other
3. Impact: only the config default changes, no code logic change;
   existing users with a persisted DConfig value are unaffected, new
   or reset users get the Application category enabled

Log: Desktop organizer now groups applications into the Application
category by default

Influence:
1. Verify newly installed apps (generating .desktop) appear under the
   Application category after desktop organization
2. Verify the existing Document/Picture/Video/Music/Folder categories
   still organize correctly
3. Verify users with a previously persisted organizeCategories value
   are not affected

fix: 桌面整理默认分类补充应用程序类别

1. 根因:organizeCategories 配置默认值包含
   kDocument/kPicture/kVideo/kMusic/kFolder 但缺少 kApp,导致桌面整理
   时不创建"应用程序"集合,.desktop 快捷方式被丢弃或误归"其他"
2. 方案:在 organizeCategories.value 首部新增 "kApp",使桌面整理默认
   创建"应用程序"集合,.desktop 文件正确归入该集合
3. 影响:仅变更配置默认值,无代码逻辑改动;已持久化配置的用户不受
   影响,新用户或重置配置的用户默认启用"应用程序"分类

Log: 桌面整理默认将应用程序归入"应用程序"分类

Influence:
1. 验证新安装应用(生成 .desktop)在桌面整理后归入"应用程序"分类
2. 验证原有 文档/图片/视频/音乐/文件夹 五类归档行为正常
3. 验证已持久化 organizeCategories 配置的用户不受默认值变更影响

PMS: BUG-255421
@sourcery-ai

sourcery-ai Bot commented Oct 19, 2026

Copy link
Copy Markdown
Reviewer's guide (collapsed on small PRs)

Reviewer's Guide

This low-risk configuration-only fix adds kApp to the default desktop organizer categories, allowing already-supported .desktop classification results to create and populate the Application collection; users with persisted custom values are unaffected.

File-Level Changes

Change Details Files
Adds the Application category to the desktop organizer’s default category configuration.
  • Prepends kApp to the default organizeCategories array.
  • Enables the existing classification and collection-building flow to place .desktop shortcuts in the Application category by default.
  • Leaves existing categories and code logic unchanged.
assets/configs/org.deepin.dde.file-manager.desktop.organizer.json

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

@deepin-ci-robot

Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: GongHeng2017

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 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 ✨

@deepin-ci-robot

Copy link
Copy Markdown
Contributor

deepin pr auto review

🤖 AI 代码审查报告

总体评分: 100 分 (通过阈值: 70分)

Pass


📊 总体评价

项目 结果
审查结论 代码审查通过
评分详情 总体评分 100 分,大于 70 分通过阈值。本次变更仅修改 DConfig 配置默认值,在 organizeCategories.value 数组首部新增 "kApp" 元素,使桌面整理默认创建"应用程序"分类集合。变更范围极小、目的明确,无安全漏洞,四个维度均通过。

🔍 详细分析

1. 语法逻辑 ✅

评价: 优秀 ✅ 通过

潜在问题:
✅ 未发现明显问题

建议: JSON 语法正确,新增 "kApp" 字符串元素到数组中符合 JSON 规范。配置项 description 字段明确列出 kApp(应用)为合法选项,逻辑上补充了缺失的默认分类,与文档描述一致。


2. 代码质量 ✅

评价: 优秀 ✅ 通过

潜在问题:
✅ 未发现明显问题

建议: 变更范围极小(仅新增一个数组元素),commit message 详尽包含根因分析、修复方案、影响评估及验证步骤(中英双语)。配置文件本身包含完整的 name/description 中英文字段,结构清晰。


3. 代码性能 ✅

评价: 优秀 ✅ 通过

潜在问题:
✅ 未发现明显问题

建议: 在配置数组中新增一个元素对性能无影响,无需关注算法复杂度或资源使用。


4. 代码安全 🔒

评价: 优秀 ✅ 通过

🔐 发现 0 个安全漏洞

安全漏洞详情:
✅ 未发现安全漏洞

建议: 本次变更为纯配置默认值修改,不涉及用户输入处理、命令执行、文件路径操作或敏感信息,不存在安全风险。


💡 改进建议代码示例

// 本次变更为 DConfig 配置默认值修改,无需代码修复示例
// 变更内容:organizeCategories.value 数组新增 "kApp" 元素
// 文件:assets/configs/org.deepin.dde.file-manager.desktop.organizer.json

本报告由 AI 代码审查工具自动生成

@Johnson-zs Johnson-zs left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

未涉及v25 bug,不符合需求

@deepin-bot

deepin-bot Bot commented Oct 21, 2026

Copy link
Copy Markdown
Contributor

TAG Bot

New tag: 6.6.7
DISTRIBUTION: unstable
Suggest: synchronizing this PR through rebase #4678

@Johnson-zs Johnson-zs closed this Oct 21, 2026
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.

3 participants