Skip to content

feat: add Apps winthin folder are dragged across pages.#546

Merged
BLumia merged 1 commit into
linuxdeepin:masterfrom
wjyrich:fix-bug-288691
May 6, 2025
Merged

feat: add Apps winthin folder are dragged across pages.#546
BLumia merged 1 commit into
linuxdeepin:masterfrom
wjyrich:fix-bug-288691

Conversation

@wjyrich
Copy link
Copy Markdown
Contributor

@wjyrich wjyrich commented Apr 30, 2025

Open the launcher app folder, drag the app icon on the first page to the right, leave the folder boundary (hide boundary), and drag across pages in the folder

pms-bug-288691

Summary by Sourcery

Implement drag and drop functionality for moving apps within a folder across multiple pages

New Features:

  • Add ability to drag app icons across pages within a folder launcher

Enhancements:

  • Implement page navigation during drag and drop with boundary detection

Open the launcher app folder, drag the app icon on the first page to the right, leave the folder boundary (hide boundary), and drag across pages in the folder

pms-bug-288691
@deepin-ci-robot
Copy link
Copy Markdown

deepin pr auto review

代码审查意见:

  1. 代码结构

    • 新增的DropArea组件和相关的逻辑代码应该被封装在一个单独的组件中,以保持FolderGridViewPopup.qml的清晰和可维护性。
  2. 变量命名

    • pageIntent变量名不够直观,建议使用更具描述性的名称,如pageNavigationIntent
  3. 逻辑判断

    • checkDragMove函数中,isLastPage变量可以提前计算并存储,避免在每次调用时重复计算。
  4. 性能优化

    • onPositionChangedonDropped事件处理函数中,如果pageIntent没有变化,可以避免不必要的逻辑执行。
  5. 代码重复

    • onTriggered函数中,parent.pageIntent = 0的赋值操作在多个地方出现,可以考虑提取为一个单独的函数。
  6. 注释和文档

    • 新增的代码块缺少必要的注释,特别是DropArea组件和Timer组件的用途和功能。
  7. 安全性

    • drop.getDataAsString方法可能存在安全风险,如果drop对象不可信,应该进行输入验证。
  8. 事件处理

    • onExitedonPageIntentChanged事件处理函数中,pageIntent的赋值操作可以简化,直接使用pageIntent = 0
  9. 逻辑一致性

    • onTriggered函数中,如果folderPagesView.currentIndex !== 0,应该检查pageIntent的值,而不是直接调用checkDragMove
  10. 代码风格

    • 代码缩进和格式不一致,建议统一使用4个空格进行缩进。

综合以上意见,建议对代码进行重构和优化,以提高代码的可读性、可维护性和性能。

@sourcery-ai
Copy link
Copy Markdown

sourcery-ai Bot commented Apr 30, 2025

Reviewer's Guide

This pull request enables dragging applications across different pages within an open folder by adding a DropArea that monitors the drag position. When an item is dragged near the horizontal edges, a timer initiates a page change.

File-Level Changes

Change Details Files
Implement cross-page drag-and-drop within folders.
  • Added a DropArea covering the folder page area.
  • Implemented logic to detect when a drag operation nears the left or right edge.
  • Added a Timer to automatically navigate to the previous/next page when an item is held near an edge.
  • Modified the drop handler to finalize the drop only when the item is released in the central area of the page.
qml/FolderGridViewPopup.qml

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

Copy link
Copy Markdown

@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 @wjyrich - I've reviewed your changes - here's some feedback:

  • Consider defining the padding ratio (0.3) and timer interval (1000) as named constants for improved clarity.
  • The logic within folderDndMovePageTimer.onTriggered, particularly the conditional checkDragMove call, could potentially be simplified.
  • Ensure the interaction between onDropped and folderDndMovePageTimer correctly handles drops occurring near the page boundaries, perhaps by explicitly stopping the timer.
Here's what I looked at during the review
  • 🟢 General issues: all looks good
  • 🟢 Security: all looks good
  • 🟢 Testing: all looks good
  • 🟢 Complexity: all looks good
  • 🟢 Documentation: all looks good

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

@BLumia BLumia merged commit 190355c into linuxdeepin:master May 6, 2025
6 checks passed
@wjyrich wjyrich deleted the fix-bug-288691 branch June 6, 2025 00:36
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