Skip to content

fix: handle raw app IDs ending in .desktop correctly - #830

Merged
deepin-bot[bot] merged 1 commit into
linuxdeepin:masterfrom
wjyrich:revert/541019c-folder-thumbnails
Oct 23, 2026
Merged

deepin-bot[bot] merged 1 commit into
linuxdeepin:masterfrom
wjyrich:revert/541019c-folder-thumbnails

Conversation

@wjyrich

@wjyrich wjyrich commented Oct 23, 2026 •

Copy link
Copy Markdown
Contributor
  1. Add indexFromAppId() to match raw app IDs directly via DesktopIdRole
  2. Fix indexFromDesktopId() to compare the given ID against the normalized desktop ID instead of normalizing both sides, which double- appended .desktop to IDs already ending in .desktop
  3. Use indexFromAppId() in ItemArrangementProxyModel when handling dnd drop IDs from dde-shell
  4. Document the distinction between raw app IDs and desktop file IDs
  5. Update tests to cover IDs that already include a .desktop suffix

The previous normalization applied to both sides of the comparison caused IDs ending in .desktop to resolve incorrectly. Raw app IDs from dde-shell differ from desktop file IDs, so a dedicated lookup is needed.

Influence:

  1. Test drag-and-drop of apps whose IDs end in .desktop into folders
  2. Verify folder categorization works for such apps
  3. Test indexFromAppId with raw IDs and indexFromDesktopId with desktop file IDs
  4. Verify normalizedDesktopId returns the expected .desktop.desktop result for suffixed IDs
  5. Test lookup for IDs without .desktop suffix still works
  6. Run search filter proxy model tests to confirm no regressions

fix: 正确处理以 .desktop 结尾的原始应用 ID

  1. 新增 indexFromAppId(),通过 DesktopIdRole 直接匹配原始应用 ID
  2. 修复 indexFromDesktopId(),将给定 ID 与归一化后的桌面文件 ID 比较,而 不是对双方都归一化,避免对已带 .desktop 后缀的 ID 重复追加后缀
  3. 在 ItemArrangementProxyModel 处理来自 dde-shell 的拖放 ID 时改 用 indexFromAppId()
  4. 补充原始应用 ID 与桌面文件 ID 区别的注释
  5. 更新测试,覆盖已带 .desktop 后缀的 ID 场景

此前的归一化对比较双方都执行,导致以 .desktop 结尾的 ID 解析错误。来自
dde-shell 的原始应用 ID 与桌面文件 ID 不同,因此需要专门的查找方法。

Influence:

  1. 测试将以 .desktop 结尾 ID 的应用拖放至文件夹
  2. 验证此类应用的文件夹分类功能
  3. 测试 indexFromAppId 处理原始 ID、indexFromDesktopId 处理桌面文件 ID
  4. 验证 normalizedDesktopId 对带后缀 ID 返回预期的 .desktop.desktop 结果
  5. 测试不带 .desktop 后缀的 ID 查找仍正常
  6. 运行搜索过滤代理模型测试,确认无回归

PMS: BUG-396959

Summary by Sourcery

Correct application ID resolution for IDs ending in .desktop by distinguishing raw app ID lookups from desktop file ID lookups.

New Features:

  • Add separate lookup support for raw application IDs from dde-shell.

Bug Fixes:

  • Correct application and desktop-file ID resolution when IDs already end in .desktop, including drag-and-drop folder handling.

Enhancements:

  • Clarify the distinction between raw application IDs and desktop file IDs.

Tests:

  • Expand model tests to cover suffixed and unsuffixed IDs, normalization behavior, and related search proxy behavior.

1. Add indexFromAppId() to match raw app IDs directly via DesktopIdRole
2. Fix indexFromDesktopId() to compare the given ID against the
normalized desktop ID instead of normalizing both sides, which double-
appended .desktop to IDs already ending in .desktop
3. Use indexFromAppId() in ItemArrangementProxyModel when handling dnd
drop IDs from dde-shell
4. Document the distinction between raw app IDs and desktop file IDs
5. Update tests to cover IDs that already include a .desktop suffix

The previous normalization applied to both sides of the comparison
caused IDs ending in .desktop to resolve incorrectly. Raw app IDs from
dde-shell differ from desktop file IDs, so a dedicated lookup is needed.

Influence:
1. Test drag-and-drop of apps whose IDs end in .desktop into folders
2. Verify folder categorization works for such apps
3. Test indexFromAppId with raw IDs and indexFromDesktopId with desktop
file IDs
4. Verify normalizedDesktopId returns the expected .desktop.desktop
result for suffixed IDs
5. Test lookup for IDs without .desktop suffix still works
6. Run search filter proxy model tests to confirm no regressions

fix: 正确处理以 .desktop 结尾的原始应用 ID

1. 新增 indexFromAppId(),通过 DesktopIdRole 直接匹配原始应用 ID
2. 修复 indexFromDesktopId(),将给定 ID 与归一化后的桌面文件 ID 比较,而
不是对双方都归一化,避免对已带 .desktop 后缀的 ID 重复追加后缀
3. 在 ItemArrangementProxyModel 处理来自 dde-shell 的拖放 ID 时改
用 indexFromAppId()
4. 补充原始应用 ID 与桌面文件 ID 区别的注释
5. 更新测试,覆盖已带 .desktop 后缀的 ID 场景

此前的归一化对比较双方都执行,导致以 .desktop 结尾的 ID 解析错误。来自
dde-shell 的原始应用 ID 与桌面文件 ID 不同,因此需要专门的查找方法。

Influence:
1. 测试将以 .desktop 结尾 ID 的应用拖放至文件夹
2. 验证此类应用的文件夹分类功能
3. 测试 indexFromAppId 处理原始 ID、indexFromDesktopId 处理桌面文件 ID
4. 验证 normalizedDesktopId 对带后缀 ID 返回预期的 .desktop.desktop 结果
5. 测试不带 .desktop 后缀的 ID 查找仍正常
6. 运行搜索过滤代理模型测试,确认无回归

PMS: BUG-396959
@sourcery-ai

sourcery-ai Bot commented Oct 23, 2026

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

Reviewer's Guide

The PR fixes application lookup for raw IDs ending in .desktop by introducing a dedicated exact-match API, correcting one-sided desktop-ID normalization, and using the raw-ID path for dde-shell drag-and-drop categorization. Documentation and regression tests now cover suffixed and unsuffixed IDs, normalization behavior, and renamed model items.

Sequence diagram for raw app ID drag-and-drop categorization

sequenceDiagram
    participant DdeShell
    participant ItemArrangementProxyModel
    participant AppsModel
    participant Folder

    DdeShell->>ItemArrangementProxyModel: commitDndOperation(dropId, dragId)
    ItemArrangementProxyModel->>Folder: appendPage(normDropId, normDragId)
    ItemArrangementProxyModel->>AppsModel: indexFromAppId(dropId)
    AppsModel-->>ItemArrangementProxyModel: QModelIndex
    ItemArrangementProxyModel->>AppsModel: data(DDECategoryRole)
    ItemArrangementProxyModel->>Folder: create or categorize folder item
Loading

File-Level Changes

Change Details Files
Separate raw app-ID lookup from desktop-file-ID lookup and correct desktop-ID normalization semantics.
  • Add exact DesktopIdRole matching for raw IDs via indexFromAppId().
  • Change indexFromDesktopId() to compare the requested desktop ID with each model ID after normalizing only the model value.
  • Document the raw-ID versus desktop-file-ID distinction and suffix behavior.
src/models/appsmodel.cpp
src/models/appsmodel.h
Use raw app-ID resolution when categorizing drag-and-drop items from dde-shell.
  • Switch drop-item lookup in folder/category handling from indexFromDesktopId() to indexFromAppId().
src/models/itemarrangementproxymodel.cpp
Expand model tests for IDs that already contain the .desktop suffix.
  • Verify raw-ID lookup, desktop-ID lookup, and the expected .desktop.desktop normalization result.
  • Retain coverage for renamed items and existing unsuffixed-ID behavior.
tests/searchfilterproxymodeltest.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

@Ivy233
Ivy233 requested a review from BLumia October 23, 2026 06:53

@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

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: BLumia, wjyrich

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

@wjyrich

wjyrich commented Oct 23, 2026

Copy link
Copy Markdown
Contributor Author

/forcemerge

@deepin-bot

deepin-bot Bot commented Oct 23, 2026

Copy link
Copy Markdown

This pr force merged! (status: behind)

@deepin-bot
deepin-bot Bot merged commit 457a040 into linuxdeepin:master Oct 23, 2026
5 of 6 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.

3 participants