Skip to content

Conversation

@robertkill
Copy link
Contributor

@robertkill robertkill commented Feb 11, 2026

The enabled property was moved from the AppletItemButton to the individual input handlers (HoverHandler and TapHandler). Previously, the entire button was disabled when the tray was collapsing, which could affect visual state. Now only the input interactions are disabled while maintaining the button's visual appearance. This ensures that tray items remain visible but non-interactive during collapse animations.

Log: Fixed tray items becoming visually disabled during collapse animation

Influence:

  1. Test tray collapse animation - items should remain visible but not respond to hover or clicks
  2. Verify that tray items return to normal interactive state after collapse completes
  3. Check that hover effects and click actions work normally when not collapsing
  4. Ensure no visual glitches during the transition between states

fix: 修复托盘项在折叠期间交互问题

将 enabled 属性从 AppletItemButton 移动到单独的输入处理器(HoverHandler 和 TapHandler)。之前当托盘折叠时整个按钮被禁用,这可能会影响视觉状态。
现在仅禁用输入交互,同时保持按钮的视觉外观。这确保托盘项在折叠动画期间保
持可见但不可交互。

Log: 修复托盘项在折叠动画期间变为视觉禁用状态的问题

Influence:

  1. 测试托盘折叠动画 - 托盘项应保持可见但不响应悬停或点击
  2. 验证托盘项在折叠完成后恢复正常交互状态
  3. 检查悬停效果和点击动作在非折叠状态下正常工作
  4. 确保状态转换期间没有视觉故障

PMS: BUG-350883

Summary by Sourcery

Bug Fixes:

  • Ensure tray items remain visible but non-interactive while the tray is collapsing by disabling hover and tap handlers instead of the entire button.

@sourcery-ai
Copy link

sourcery-ai bot commented Feb 11, 2026

Reviewer's guide (collapsed on small PRs)

Reviewer's Guide

Moves the tray item enabled/disabled logic from the AppletItemButton to its HoverHandler and TapHandler so that tray items remain visually enabled while input interactions are blocked during collapse animations.

Sequence diagram for tray item interaction during collapse

sequenceDiagram
    actor User
    participant AppletItemButton
    participant HoverHandler
    participant TapHandler
    participant TraySortOrderModel

    User->>AppletItemButton: movePointer()
    AppletItemButton->>HoverHandler: pointerEvent()
    HoverHandler->>TraySortOrderModel: check isCollapsing
    TraySortOrderModel-->>HoverHandler: isCollapsing = false
    HoverHandler-->>AppletItemButton: hoverAccepted
    AppletItemButton-->>User: showHoverEffect

    User->>TapHandler: click()
    TapHandler->>TraySortOrderModel: check isCollapsing
    TraySortOrderModel-->>TapHandler: isCollapsing = false
    TapHandler-->>AppletItemButton: triggerAction
    AppletItemButton-->>User: performAction

    TraySortOrderModel-->>TraySortOrderModel: startCollapse()

    User->>HoverHandler: pointerEvent()
    HoverHandler->>TraySortOrderModel: check isCollapsing
    TraySortOrderModel-->>HoverHandler: isCollapsing = true
    HoverHandler-->>User: ignoreEvent (no hover effect)

    User->>TapHandler: click()
    TapHandler->>TraySortOrderModel: check isCollapsing
    TraySortOrderModel-->>TapHandler: isCollapsing = true
    TapHandler-->>User: ignoreEvent (no click action)

    TraySortOrderModel-->>TraySortOrderModel: endCollapse()

    User->>HoverHandler: pointerEvent()
    HoverHandler->>TraySortOrderModel: check isCollapsing
    TraySortOrderModel-->>HoverHandler: isCollapsing = false
    HoverHandler-->>AppletItemButton: hoverAccepted
    AppletItemButton-->>User: showHoverEffect
Loading

Class diagram for updated tray item input handling

classDiagram
    class AppletItemButton {
        bool visible
        bool hoverEnabled
        bool inputEventsEnabled
        void updatePluginMargins()
    }

    class HoverHandler {
        bool enabled
        object parent
    }

    class TapHandler {
        bool enabled
        object parent
    }

    class TraySortOrderModel {
        bool isCollapsing
    }

    AppletItemButton o-- HoverHandler : owns
    AppletItemButton o-- TapHandler : owns

    HoverHandler --> TraySortOrderModel : reads isCollapsing
    TapHandler --> TraySortOrderModel : reads isCollapsing

    AppletItemButton : hoverEnabled = inputEventsEnabled
    HoverHandler : enabled = !TraySortOrderModel.isCollapsing
    TapHandler : enabled = !TraySortOrderModel.isCollapsing
Loading

File-Level Changes

Change Details Files
Restrict disabling behavior to input handlers so tray items stay visually active during collapse while ignoring hover and tap events.
  • Removed the use of the enabled property on the tray AppletItemButton that was tied to the collapsing state.
  • Added enabled bindings on HoverHandler and TapHandler to disable pointer interactions when the tray is collapsing.
  • Kept hoverEnabled controlled by inputEventsEnabled so visual hover affordances are only active when input events are globally allowed.
panels/dock/tray/package/ActionLegacyTrayPluginDelegate.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

@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 - I've left some high level feedback:

  • You now duplicate the !DDT.TraySortOrderModel.isCollapsing condition in both HoverHandler and TapHandler; consider binding a single local property (e.g. interactionsEnabled) and using that in all handlers to keep the logic consistent and easier to change.
  • With hoverEnabled still bound to inputEventsEnabled but the HoverHandler disabled during collapse, it may be worth double-checking whether the desired behavior is to suppress hover visual feedback entirely during collapse; if so, aligning hoverEnabled with the same collapse condition would make the intent clearer in the QML.
Prompt for AI Agents
Please address the comments from this code review:

## Overall Comments
- You now duplicate the `!DDT.TraySortOrderModel.isCollapsing` condition in both `HoverHandler` and `TapHandler`; consider binding a single local property (e.g. `interactionsEnabled`) and using that in all handlers to keep the logic consistent and easier to change.
- With `hoverEnabled` still bound to `inputEventsEnabled` but the `HoverHandler` disabled during collapse, it may be worth double-checking whether the desired behavior is to suppress hover visual feedback entirely during collapse; if so, aligning `hoverEnabled` with the same collapse condition would make the intent clearer in the QML.

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.

18202781743
18202781743 previously approved these changes Feb 11, 2026
The enabled property was moved from the AppletItemButton to the
individual input handlers (HoverHandler and TapHandler). Previously,
the entire button was disabled when the tray was collapsing, which could
affect visual state. Now only the input interactions are disabled while
maintaining the button's visual appearance. This ensures that tray items
remain visible but non-interactive during collapse animations.

Log: Fixed tray items becoming visually disabled during collapse
animation

Influence:
1. Test tray collapse animation - items should remain visible but not
respond to hover or clicks
2. Verify that tray items return to normal interactive state after
collapse completes
3. Check that hover effects and click actions work normally when not
collapsing
4. Ensure no visual glitches during the transition between states

fix: 修复托盘项在折叠期间交互问题

将 enabled 属性从 AppletItemButton 移动到单独的输入处理器(HoverHandler
和 TapHandler)。之前当托盘折叠时整个按钮被禁用,这可能会影响视觉状态。
现在仅禁用输入交互,同时保持按钮的视觉外观。这确保托盘项在折叠动画期间保
持可见但不可交互。

Log: 修复托盘项在折叠动画期间变为视觉禁用状态的问题

Influence:
1. 测试托盘折叠动画 - 托盘项应保持可见但不响应悬停或点击
2. 验证托盘项在折叠完成后恢复正常交互状态
3. 检查悬停效果和点击动作在非折叠状态下正常工作
4. 确保状态转换期间没有视觉故障

PMS: BUG-350883
@deepin-ci-robot
Copy link

deepin pr auto review

这段代码变更主要涉及许可证合规性文件的修改和QML文件中逻辑的变更。以下是从语法逻辑、代码质量、代码性能和代码安全四个方面的详细审查与改进建议:

1. 语法逻辑

REUSE.toml 变更:

  • 变更内容: 删除了 panels/dock/tray/** 路径下的 [[annotations]] 配置块。
  • 审查意见: 逻辑上,删除特定路径的显式许可证声明意味着该路径下的文件将不再遵循此处的 GPL-3.0-or-later 许可证,而是回退到文件头部的声明或全局默认配置。
  • 风险提示: 必须确保 panels/dock/tray/** 目录下的所有文件头部都包含了完整的 SPDX 标识(如 SPDX-FileCopyrightTextSPDX-License-Identifier)。如果删除此配置块后某些文件缺少头部声明,将导致许可证合规性问题(即代码变为未授权状态)。

ActionLegacyTrayPluginDelegate.qml 变更:

  • 变更内容:
    1. 更新了版权年份范围:2024 -> 2024-2026
    2. 删除了属性绑定:enabled: !DDT.TraySortOrderModel.isCollapsing
  • 审查意见:
    1. 版权年份: 预先设置结束年份为 2026 是一种常见做法,表示预计维护时间,逻辑上无问题。
    2. 属性删除: 删除 enabled 的绑定意味着该组件的 enabled 属性将恢复默认值(通常为 true)。
    • 逻辑隐患: 原代码在 DDT.TraySortOrderModel.isCollapsingtrue 时禁用该组件。删除此行后,即使在排序/折叠动画过程中,用户依然可以点击该组件。如果折叠过程中点击会导致逻辑错误(如索引错乱、崩溃),则这是一个严重的逻辑缺陷。

2. 代码质量

  • 版权年份: 将年份设为 2024-2026 略显奇怪,通常建议使用当前年份(如 2024),或者在年底时更新为 2024-2025。提前写死未来的年份可能会给人一种代码过时或未及时维护的错觉。
  • 代码注释: 删除 enabled 绑定行时,没有添加任何注释说明删除原因。这降低了代码的可维护性。建议在代码审查中明确为何不再需要在折叠时禁用该组件。

3. 代码性能

  • 属性绑定移除:
    • 正面影响: 移除 enabled: !DDT.TraySortOrderModel.isCollapsing 减少了一个属性绑定。如果 isCollapsing 频繁变化,移除这个绑定可以减少 QML 引擎的评估开销,理论上能微弱提升性能。
    • 负面风险: 如前所述,如果移除后导致逻辑错误,修复 Bug 的成本远大于微小的性能提升。

4. 代码安全

  • 许可证合规: 删除 REUSE.toml 中的特定路径声明是最大的安全隐患。如果该路径下的文件头部声明不完整,可能会导致法律风险。必须确保所有受影响的文件(如 ActionLegacyTrayPluginDelegate.qml)头部都有正确的 SPDX-License-Identifier: GPL-3.0-or-later 声明。从 diff 看,该文件头部确实保留了 GPL 声明,但需确保该目录下其他所有文件也是如此。
  • 交互安全: 移除 enabled 绑定后,如果在折叠动画期间用户触发点击事件,可能会导致竞态条件或状态不一致。需确认底层逻辑是否能处理这种并发操作。

改进建议

  1. 关于 QML 逻辑的改进:
    如果确实不需要在折叠时禁用组件,建议显式设置 enabled: true 以增加代码可读性,表明这是有意为之,而非遗漏。

    // 显式声明启用状态,表明已考虑过折叠场景
    enabled: true
  2. 关于 REUSE.toml 的改进:
    在删除全局配置前,建议使用工具(如 reuse lint)扫描 panels/dock/tray/** 目录,确保所有文件的许可证信息完整。

  3. 关于版权年份:
    建议修改为当前年份,除非有特殊版本规划需求:

    // SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd.

总结:
这次变更最大的风险在于删除了折叠状态下的交互禁用逻辑以及许可证配置的清理。如果确定底层逻辑已经能够安全处理折叠时的点击事件,且许可证文件头部声明完整,那么变更是可接受的;否则,建议恢复 enabled 属性绑定或补充详细的交互逻辑测试。

@deepin-ci-robot
Copy link

[APPROVALNOTIFIER] This PR is NOT APPROVED

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

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

@robertkill robertkill merged commit a5ce38c into linuxdeepin:master Feb 11, 2026
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.

4 participants