Skip to content

Conversation

@wjyrich
Copy link
Contributor

@wjyrich wjyrich commented Feb 9, 2026

  1. Added Connections component to listen for Panel's leftEdgeClicked signal
  2. When left edge is clicked and this launcher has the minimum dock order, toggle launcher visibility
  3. This ensures launcher responds to edge clicks when it's positioned at the leftmost dock position

Log: Launcher now toggles visibility when clicking the left screen edge

Influence:

  1. Test clicking left screen edge when launcher is at leftmost position
  • should toggle launcher
  1. Test clicking left screen edge when launcher is not at leftmost position - should not affect launcher
  2. Verify launcher visibility toggles correctly between shown and hidden states
  3. Test with multiple launchers/docks to ensure only the leftmost one responds
  4. Verify launcher behavior consistency with other edge interactions

fix: 处理左侧边缘点击以切换启动器可见性

  1. 添加 Connections 组件监听 Panel 的 leftEdgeClicked 信号
  2. 当点击左侧边缘且此启动器具有最小停靠顺序时,切换启动器可见性
  3. 确保启动器在位于最左侧停靠位置时能响应边缘点击

Log: 启动器现在会在点击屏幕左侧边缘时切换可见性

Influence:

  1. 测试当启动器位于最左侧位置时点击屏幕左侧边缘 - 应切换启动器状态
  2. 测试当启动器不位于最左侧位置时点击屏幕左侧边缘 - 不应影响启动器
  3. 验证启动器可见性在显示和隐藏状态之间正确切换
  4. 测试多个启动器/停靠栏,确保只有最左侧的启动器响应
  5. 验证启动器行为与其他边缘交互的一致性

PMS: BUG-345931

Summary by Sourcery

Bug Fixes:

  • Ensure only the leftmost launcher responds to left edge clicks by toggling its visibility.

@sourcery-ai
Copy link

sourcery-ai bot commented Feb 9, 2026

Reviewer's guide (collapsed on small PRs)

Reviewer's Guide

Adds a Panel left-edge click handler in the launcher QML item so the launcher toggles its visibility only when it is the leftmost (minimum dock order) launcher.

Sequence diagram for left edge click toggling launcher visibility

sequenceDiagram
    actor User
    participant LeftEdge as LeftScreenEdge
    participant Panel
    participant LauncherItem
    participant LauncherController

    User->>LeftEdge: click
    LeftEdge->>Panel: notifyLeftEdgeClick()
    Panel-->>LauncherItem: leftEdgeClicked(minOrder)
    alt launcher is leftmost
        LauncherItem->>LauncherItem: check dockOrder == minOrder
        LauncherItem->>LauncherController: toggle visible
    else launcher is not leftmost
        LauncherItem->>LauncherItem: check dockOrder != minOrder
        LauncherItem-->>LauncherController: no action
    end
Loading

Class diagram for launcher edge click handling

classDiagram
    class Panel {
        +leftEdgeClicked(minOrder)
    }

    class LauncherItem {
        +int dockOrder
        +onLeftEdgeClicked(minOrder)
    }

    class LauncherController {
        +bool visible
    }

    LauncherItem ..> Panel : listens to leftEdgeClicked
    LauncherItem ..> LauncherController : toggles visible
Loading

File-Level Changes

Change Details Files
Handle left screen-edge clicks to toggle launcher visibility only for the leftmost launcher.
  • Add a QML Connections block bound to Panel to listen for the leftEdgeClicked signal with minOrder parameter.
  • Compare this launcher's dockOrder to the minOrder from the signal to determine if it is the leftmost launcher.
  • Toggle LauncherController.visible when the left edge is clicked and this launcher is the leftmost docked instance.
shell-launcher-applet/package/launcheritem.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:

  • Consider guarding the Connections target with a null/availability check (e.g. target: Panel || null) so the component doesn’t try to bind to an undefined Panel object in edge cases where the panel isn’t yet initialized.
  • Instead of directly toggling LauncherController.visible, it may be clearer and safer to route this through an existing controller/API method (e.g. a toggleVisibility() handler) if available, to keep visibility state changes centralized.
Prompt for AI Agents
Please address the comments from this code review:

## Overall Comments
- Consider guarding the `Connections` target with a null/availability check (e.g. `target: Panel || null`) so the component doesn’t try to bind to an undefined `Panel` object in edge cases where the panel isn’t yet initialized.
- Instead of directly toggling `LauncherController.visible`, it may be clearer and safer to route this through an existing controller/API method (e.g. a `toggleVisibility()` handler) if available, to keep visibility state changes centralized.

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.

target: Panel
function onLeftEdgeClicked(minOrder) {
if (launcher.dockOrder == minOrder) {
LauncherController.visible = !LauncherController.visible
Copy link
Contributor

Choose a reason for hiding this comment

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

这个响应,封装为一个函数,调用跟Mouse一样的,

1. Added Connections component to listen for Panel's leftEdgeClicked
signal
2. When left edge is clicked and this launcher has the minimum dock
order, toggle launcher visibility
3. This ensures launcher responds to edge clicks when it's positioned at
the leftmost dock position

Log: Launcher now toggles visibility when clicking the left screen edge

Influence:
1. Test clicking left screen edge when launcher is at leftmost position
- should toggle launcher
2. Test clicking left screen edge when launcher is not at leftmost
position - should not affect launcher
3. Verify launcher visibility toggles correctly between shown and hidden
states
4. Test with multiple launchers/docks to ensure only the leftmost one
responds
5. Verify launcher behavior consistency with other edge interactions

fix: 处理左侧边缘点击以切换启动器可见性

1. 添加 Connections 组件监听 Panel 的 leftEdgeClicked 信号
2. 当点击左侧边缘且此启动器具有最小停靠顺序时,切换启动器可见性
3. 确保启动器在位于最左侧停靠位置时能响应边缘点击

Log: 启动器现在会在点击屏幕左侧边缘时切换可见性

Influence:
1. 测试当启动器位于最左侧位置时点击屏幕左侧边缘 - 应切换启动器状态
2. 测试当启动器不位于最左侧位置时点击屏幕左侧边缘 - 不应影响启动器
3. 验证启动器可见性在显示和隐藏状态之间正确切换
4. 测试多个启动器/停靠栏,确保只有最左侧的启动器响应
5. 验证启动器行为与其他边缘交互的一致性

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

deepin pr auto review

代码审查报告

1. 语法逻辑审查

改进点:

  • 缩进不一致:在 toggleLauncher 函数定义处,代码缩进使用了4个空格,而文件其他部分似乎使用的是标准的缩进(通常是4个空格,但这里看起来像是混用了Tab和空格,或者空格数量不对)。建议统一缩进风格。
  • 函数定义位置toggleLauncher 函数被放置在 implicitWidthimplicitHeight 属性定义之后,但在 Connections 对象之前。虽然这在语法上是允许的,但为了代码可读性,建议将函数定义集中放置,通常放在所有属性定义之后,信号处理程序之前。

2. 代码质量审查

改进点:

  • 代码重复消除:原代码在 MouseAreaonClicked 处理程序中重复了切换启动器可见性的逻辑。通过提取 toggleLauncher 函数,代码变得更加简洁和可维护,这是一个很好的改进。
  • 函数命名toggleLauncher 是一个清晰且描述性的函数名,符合命名规范。
  • 注释缺失:建议为 toggleLauncher 函数添加注释,说明其用途和副作用(如关闭工具提示)。

3. 代码性能审查

改进点:

  • 性能影响toggleLauncher 函数非常简单,只是切换一个布尔属性并调用一个方法,性能影响可以忽略不计。
  • Connections 对象:新增的 Connections 对象监听 PanelonLeftEdgeClicked 信号。这本身不会带来显著的性能问题,但应确保 Panel 对象的生命周期管理得当,避免内存泄漏。

4. 代码安全审查

改进点:

  • 空值检查LauncherControllertoolTip 的访问没有进行空值检查。如果这些对象在运行时可能为 nullundefined,应该添加适当的检查。
  • 属性访问launcher.dockOrder 的访问同样没有进行空值检查。如果 launcher 可能为 null,应该添加检查。

5. 改进后的代码示例

AppletItem {
    implicitWidth: useColumnLayout ? Panel.rootObject.dockSize : Panel.rootObject.dockItemMaxSize * 0.8
    implicitHeight: useColumnLayout ? Panel.rootObject.dockItemMaxSize * 0.8 : Panel.rootObject.dockSize

    // 属性定义
    property point itemPos: Qt.point(0, 0)

    // 函数定义
    /*!
        \brief Toggles the visibility of the launcher and closes the tooltip.
    */
    function toggleLauncher() {
        if (LauncherController) {
            LauncherController.visible = !LauncherController.visible
        }
        if (toolTip) {
            toolTip.close()
        }
    }

    function updateItemPos() {
        // ... 现有代码 ...
    }

    Connections {
        target: Panel.rootObject
        function onDockCenterPartPosChanged() {
            // ... 现有代码 ...
        }
    }

    Connections {
        target: Panel
        function onLeftEdgeClicked(minOrder) {
            if (launcher && launcher.dockOrder === minOrder) {
                toggleLauncher()
            }
        }
    }

    // ... 其他代码 ...

    MouseArea {
        anchors.fill: parent
        onClicked: function (mouse) {
            if (mouse.button === Qt.LeftButton) {
                toggleLauncher()
            }
        }
    }
}

6. 总结

  • 优点:通过提取 toggleLauncher 函数,消除了代码重复,提高了可维护性。
  • 改进建议
    • 统一缩进风格。
    • 添加必要的空值检查。
    • 为新函数添加注释。
    • 考虑将函数定义集中放置,以提高代码可读性。

这些改进将使代码更加健壮、可读和易于维护。

@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
Copy link
Contributor Author

wjyrich commented Feb 9, 2026

/forcemerge

@deepin-bot
Copy link

deepin-bot bot commented Feb 9, 2026

This pr force merged! (status: blocked)

@deepin-bot deepin-bot bot merged commit 83f744d into linuxdeepin:master Feb 9, 2026
6 of 7 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