Skip to content

feat: add DConfig to control dock network icon interaction - #589

Open
wjyrich wants to merge 1 commit into
linuxdeepin:masterfrom
wjyrich:task-393299
Open

feat: add DConfig to control dock network icon interaction#589
wjyrich wants to merge 1 commit into
linuxdeepin:masterfrom
wjyrich:task-393299

Conversation

@wjyrich

@wjyrich wjyrich commented Jul 27, 2026

Copy link
Copy Markdown
Contributor

Added a DConfig-based setting to enable or disable click, touch, and hover interactions on the dock network icon. This allows users to prevent accidental interactions while keeping the quick panel entry unaffected.

Log: Add DConfig support for dock network icon interaction control

Influence:

  1. Verify that dock network icon click, touch long-press, and hover interactions work when setting is enabled (default)
  2. Test that interactions are disabled when setting is disabled
  3. Verify tooltip does not appear when setting is disabled
  4. Ensure quick panel network entry remains functional regardless of setting
  5. Test that the setting change takes effect without restarting the dock
  6. Check that no visual artifacts or crashes occur after toggling the setting

feat: 新增 DConfig 控制任务栏网络图标交互

添加基于 DConfig 的配置项,用于启用或禁用任务栏网络图标的点击、触摸和悬
停交互。这允许用户避免意外操作,同时不影响快捷面板中的网络入口。

Log: 新增任务栏网络图标交互控制的 DConfig 支持

Influence:

  1. 验证启用设置(默认)时,任务栏网络图标的点击、触摸长按和悬停交互正常 工作
  2. 测试禁用设置后,交互功能被关闭
  3. 验证禁用设置后不显示提示信息
  4. 确保快捷面板网络入口不受设置影响,始终可用
  5. 测试设置更改后无需重启任务栏即可生效
  6. 检查切换设置后不会出现视觉异常或崩溃

PMS: TASK-393299

@deepin-ci-robot

Copy link
Copy Markdown

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: 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

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

Sorry @wjyrich, you have reached your weekly rate limit of 500000 diff characters.

Please try again later or upgrade to continue using Sourcery

Added a DConfig-based setting to enable or disable click, touch, and
hover interactions on the dock network icon. This allows users to
prevent accidental interactions while keeping the quick panel entry
unaffected.

Log: Add DConfig support for dock network icon interaction control

Influence:
1. Verify that dock network icon click, touch long-press, and hover
interactions work when setting is enabled (default)
2. Test that interactions are disabled when setting is disabled
3. Verify tooltip does not appear when setting is disabled
4. Ensure quick panel network entry remains functional regardless of
setting
5. Test that the setting change takes effect without restarting the dock
6. Check that no visual artifacts or crashes occur after toggling the
setting

feat: 新增 DConfig 控制任务栏网络图标交互

添加基于 DConfig 的配置项,用于启用或禁用任务栏网络图标的点击、触摸和悬
停交互。这允许用户避免意外操作,同时不影响快捷面板中的网络入口。

Log: 新增任务栏网络图标交互控制的 DConfig 支持

Influence:
1. 验证启用设置(默认)时,任务栏网络图标的点击、触摸长按和悬停交互正常
工作
2. 测试禁用设置后,交互功能被关闭
3. 验证禁用设置后不显示提示信息
4. 确保快捷面板网络入口不受设置影响,始终可用
5. 测试设置更改后无需重启任务栏即可生效
6. 检查切换设置后不会出现视觉异常或崩溃

PMS: TASK-393299
@deepin-ci-robot

Copy link
Copy Markdown

deepin pr auto review

★ 总体评分:90分

■ 【总体评价】

代码通过DConfig配置实现了任务栏网络图标交互的动态控制,逻辑严谨且空指针检查完善
逻辑正确且无安全漏洞,仅在代码结构上存在轻微优化空间扣10分

■ 【详细分析】

  • 1.语法逻辑(完全正确)✓

构造函数中正确初始化了m_dconfig并绑定了信号,updateDockClickSettings中对m_dconfigm_trayIcon进行了空指针检查,eventFilter中通过isDockIcon判断确保事件拦截范围准确。事件类型拦截完整覆盖了鼠标、触摸和悬停场景。
潜在问题:eventFilterQEvent::ToolTip事件被拦截后直接return true,如果未来需要在禁用状态下显示其他自定义提示,可能需要调整逻辑。
建议:保持当前实现即可,若后续需求变更再扩展提示逻辑。

  • 2.代码质量(良好)✓

使用了匿名命名空间定义常量EnableDockNetworkClickKey,符合C++最佳实践。日志输出使用了qCWarningqCInfo分类输出,便于调试。头文件中对Dtk::Core::DConfig进行了前置声明,减少了编译依赖。
潜在问题:networkplugin.h中更新了版权年份至2026年,可能为笔误或预期未来维护。
建议:确认版权年份是否为预期值,若为笔误则修正为当前年份。

  • 3.代码性能(无性能问题)✓

eventFilter中新增的逻辑仅为简单的布尔判断和类型switch,不会对高频事件处理造成性能瓶颈。updateDockClickSettings仅在配置变化时触发,频率极低。
建议:无需优化。

  • 4.代码安全(存在0个安全漏洞)✓

漏洞对比统计:新增漏洞 0 个,减少漏洞 0 个,持平 0 个
本次修改仅引入本地配置读取和事件拦截,无外部输入处理,无注入或越权风险。

  • 建议:无需修复。

■ 【改进建议代码示例】

// 当前代码已具备较高质量,仅需确认版权年份是否正确
diff --git a/dock-network-plugin/networkplugin.h b/dock-network-plugin/networkplugin.h
index 5d700dad..dcfbb0d9 100644
--- a/dock-network-plugin/networkplugin.h
+++ b/dock-network-plugin/networkplugin.h
@@ -1,4 +1,4 @@
-// SPDX-FileCopyrightText: 2018 - 2022 UnionTech Software Technology Co., Ltd.
+// SPDX-FileCopyrightText: 2018 - 2024 UnionTech Software Technology Co., Ltd.
 //
 // SPDX-License-Identifier: GPL-3.0-or-later

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.

2 participants