Skip to content

Conversation

@wjyrich
Copy link
Contributor

@wjyrich wjyrich commented Oct 24, 2025

This reverts commit 83021e8.
文管采用了相关脚本处理,无需dde-shell特殊处理回收站,只需保持原有逻辑。

Summary by Sourcery

Revert the addition of trash file drop support in the TaskManager and restore original file drop behavior.

Enhancements:

  • Remove DTrashManager include and moveFilesToTrash method implementation
  • Eliminate special handling for dropping files onto the "dde-trash" item

This reverts commit 83021e8.
文管采用了相关脚本处理,无需dde-shell特殊处理回收站,只需保持原有逻辑。
@wjyrich wjyrich requested a review from 18202781743 October 24, 2025 08:40
@sourcery-ai
Copy link

sourcery-ai bot commented Oct 24, 2025

Reviewer's guide (collapsed on small PRs)

Reviewer's Guide

Reverts the custom “drop to trash” implementation in TaskManager by removing related includes, method, and conditional branch, restoring the original dropFilesOnItem flow.

Sequence diagram for file drop on dock item after trash support removal

sequenceDiagram
participant User as actor
participant TaskManager
participant ItemModel
User->>TaskManager: dropFilesOnItem(itemId, urls)
TaskManager->>ItemModel: match(index, ItemIdRole, itemId)
alt Item found
    TaskManager->>ItemModel: requestOpenUrls(index, urlList)
else Item not found
    TaskManager-->>User: (no action)
end
Loading

Class diagram for TaskManager after removing trash file drop support

classDiagram
class TaskManager {
    +void handleWindowAdded(QPointer<AbstractWindow> window)
    +void dropFilesOnItem(const QString& itemId, const QStringList& urls)
    +void hideItemPreview()
    +void saveDockElementsOrder(const QStringList &appIds)
    +QString getTrashTipText()
    // Removed: void moveFilesToTrash(const QStringList& urls)
}
Loading

File-Level Changes

Change Details Files
Removed specialized trash drop handling
  • Deleted conditional branch handling itemId == "dde-trash" in dropFilesOnItem
  • Removed moveFilesToTrash() implementation and its private declaration
  • Stripped out QDir and DTrashManager includes no longer used
panels/dock/taskmanager/taskmanager.cpp
panels/dock/taskmanager/taskmanager.h

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

deepin pr auto review

我来对这段代码进行审查和分析:

  1. 代码变更概述:
  • 移除了回收站相关的功能实现
  • 删除了moveFilesToTrash()函数
  • 移除了相关的头文件引用(QDir, DTrashManager)
  • 简化了dropFilesOnItem()函数的实现
  1. 代码质量分析:

优点:

  • 代码更加简洁,移除了不必要的功能
  • 减少了依赖,提高了模块的内聚性
  • 移除了冗余的代码,提高了可维护性

潜在问题:

  • 没有保留任何错误处理机制来处理回收站相关的操作
  • 移除了回收站功能后,可能会影响用户体验
  1. 改进建议:
  1. 如果需要保留回收站功能,建议:
void TaskManager::dropFilesOnItem(const QString& itemId, const QStringList& urls)
{
    if (itemId == "dde-trash") {
        // 添加错误处理和用户反馈
        if (!moveFilesToTrash(urls)) {
            Q_EMIT showError(tr("Failed to move files to trash"));
        }
        return;
    }
    // ... 其他代码保持不变
}
  1. 如果确实要移除回收站功能,建议:
  • 添加相应的注释说明移除原因
  • 确保所有相关的测试用例都已更新
  • 在文档中说明这一变更
  1. 性能优化建议:
  • 使用QStringList::const_iterator替代range-based for循环可能更高效
  • 考虑批量操作文件而不是逐个处理
  1. 安全性建议:
  • 添加文件权限检查
  • 验证URL的有效性
  • 防止路径遍历攻击
  1. 总结:
    这次代码变更简化了实现,但也可能影响了功能性。建议:
  • 明确移除回收站功能的原因
  • 如果是临时移除,建议添加TODO注释
  • 考虑是否需要替代方案
  • 确保相关文档和测试用例都已更新

建议在后续版本中考虑是否需要重新实现回收站功能,如果需要,可以采用更安全和高效的方式实现。

Copy link

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

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

Hey there - 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.

@deepin-ci-robot
Copy link

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: 18202781743, 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 merged commit 46b02a1 into linuxdeepin:master Oct 27, 2025
10 of 11 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