Skip to content

feat: add DConfig toggle to enable/disable launchpad - #788

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

feat: add DConfig toggle to enable/disable launchpad#788
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
  1. Introduce a new enableLaunchpad DConfig key under org.deepin.ds.launchpad
  2. Read config on startup and react to value changes via DConfig notifications
  3. Disabled launchpad hides dock entry, closes open launchpad, and ignores show/toggle requests
  4. Add enabled property and signal to LauncherController for QML binding
  5. Update QML launcheritem to use shouldVisible bound to LauncherController.enabled
  6. Add JSON schema entry for the new config with Chinese translations

Log: Added enableLaunchpad DConfig option to control launchpad availability

Influence:

  1. Test setting enableLaunchpad to false when launchpad is open; verify it closes and dock entry hides
  2. Test toggle and show requests when disabled; verify they are ignored
  3. Test setting enableLaunchpad to true when disabled; verify dock entry reappears and launchpad can be opened
  4. Test DConfig value changes are applied immediately via signal
  5. Test creating DConfig file scenarios (invalid/missing) and verify enabled state defaults properly
  6. Test QML UI reactive update based on shouldVisible property
  7. Verify no regressions in existing launchpad show/toggle/close behavior

feat: 添加控制启动器开关的DConfig配置项

  1. 在 org.deepin.ds.launchpad 下新增 enableLaunchpad DConfig 键
  2. 启动时读取配置,并通过 DConfig 通知响应值变化
  3. 禁用启动器时隐藏任务栏图标、关闭已打开的启动器、忽略显示/切换请求
  4. 为 LauncherController 添加 enabled 属性及其信号,供 QML 绑定
  5. 更新 QML launcheritem,将 shouldVisible 绑定到 LauncherController.enabled
  6. 新增 JSON schema 配置描述,包含中文翻译

Log: 新增 enableLaunchpad DConfig 选项以控制启动器可用性

Influence:

  1. 测试在启动器打开时设置 enableLaunchpad 为 false,验证启动器关闭且任务 栏入口隐藏
  2. 测试在禁用状态下发起显示/切换请求,验证请求被忽略
  3. 测试在禁用后设置 enableLaunchpad 为 true,验证任务栏入口重新出现且可 打开启动器
  4. 测试通过信号实时应用 DConfig 值变化
  5. 测试 DConfig 文件异常场景(无效/缺失),验证 enabled 状态的默认处理
  6. 测试 QML UI 根据 shouldVisible 属性的响应式更新
  7. 验证现有启动器显示/切换/关闭功能无回归

PMS: TASK-393299

Summary by Sourcery

Add a DConfig-backed switch to control launchpad availability and expose it to QML so the dock entry and launcher behavior react dynamically to configuration changes.

New Features:

  • Introduce an enableLaunchpad DConfig option under org.deepin.ds.launchpad to enable or disable the launchpad at runtime.
  • Expose an enabled property and signal on LauncherController for QML to reflect the launchpad availability in the UI.

Enhancements:

  • Update launcher visibility logic to ignore show requests and close the launchpad when it is disabled by configuration.
  • Bind the dock launcher item visibility in QML to the new LauncherController.enabled property so the dock entry hides when launchpad is disabled.
  • Document the new enableLaunchpad DConfig key and example usage in the DConfig documentation.

@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

1. Introduce a new `enableLaunchpad` DConfig key under
org.deepin.ds.launchpad
2. Read config on startup and react to value changes via DConfig
notifications
3. Disabled launchpad hides dock entry, closes open launchpad, and
ignores show/toggle requests
4. Add `enabled` property and signal to LauncherController for QML
binding
5. Update QML launcheritem to use `shouldVisible` bound to
`LauncherController.enabled`
6. Add JSON schema entry for the new config with Chinese translations

Log: Added enableLaunchpad DConfig option to control launchpad
availability

Influence:
1. Test setting enableLaunchpad to false when launchpad is open; verify
it closes and dock entry hides
2. Test toggle and show requests when disabled; verify they are ignored
3. Test setting enableLaunchpad to true when disabled; verify dock entry
reappears and launchpad can be opened
4. Test DConfig value changes are applied immediately via signal
5. Test creating DConfig file scenarios (invalid/missing) and verify
enabled state defaults properly
6. Test QML UI reactive update based on `shouldVisible` property
7. Verify no regressions in existing launchpad show/toggle/close
behavior

feat: 添加控制启动器开关的DConfig配置项

1. 在 org.deepin.ds.launchpad 下新增 enableLaunchpad DConfig 键
2. 启动时读取配置,并通过 DConfig 通知响应值变化
3. 禁用启动器时隐藏任务栏图标、关闭已打开的启动器、忽略显示/切换请求
4. 为 LauncherController 添加 enabled 属性及其信号,供 QML 绑定
5. 更新 QML launcheritem,将 shouldVisible 绑定到
LauncherController.enabled
6. 新增 JSON schema 配置描述,包含中文翻译

Log: 新增 enableLaunchpad DConfig 选项以控制启动器可用性

Influence:
1. 测试在启动器打开时设置 enableLaunchpad 为 false,验证启动器关闭且任务
栏入口隐藏
2. 测试在禁用状态下发起显示/切换请求,验证请求被忽略
3. 测试在禁用后设置 enableLaunchpad 为 true,验证任务栏入口重新出现且可
打开启动器
4. 测试通过信号实时应用 DConfig 值变化
5. 测试 DConfig 文件异常场景(无效/缺失),验证 enabled 状态的默认处理
6. 测试 QML UI 根据 shouldVisible 属性的响应式更新
7. 验证现有启动器显示/切换/关闭功能无回归

PMS: TASK-393299
@deepin-ci-robot

Copy link
Copy Markdown

deepin pr auto review

★ 总体评分:95分

■ 【总体评价】

代码实现了通过DConfig动态控制启动器可见性和可用性的功能,逻辑严谨且具备完善的错误处理机制。
逻辑正确且无明显安全漏洞,仅在QML属性绑定部分存在轻微的未使用变量问题,整体质量优秀。

■ 【详细分析】

  • 1.语法逻辑(基本正确)✓

launchercontroller.cpp 中,构造函数正确初始化了 m_launchpadConfig 并通过传入 this 保证了生命周期的安全管理。updateEnabled() 方法内部调用了 m_launchpadConfig->isValid(),由于构造函数中已对 m_launchpadConfig 为空的情况做了拦截,因此不会引发空指针解引用。setVisible 方法中的拦截逻辑正确。
潜在问题:在 launcheritem.qml 中新增了 property bool shouldVisible: LauncherController.enabled,但在当前 diff 上下文中未看到该属性被用于控制实际组件的显隐(如绑定到 visible 属性),可能产生未使用变量的警告。
建议:确认 shouldVisible 是否在 QML 文件的其他部分被正确引用;若未引用,应将其绑定至实际的可见性属性上或移除。

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

代码遵循了良好的命名规范,常量 EnableLaunchpadKey 使用了 constexpr 修饰。日志记录详尽,覆盖了配置创建失败、配置无效、状态变更等关键路径。头文件中使用了前置声明 namespace Dtk::Core { class DConfig; } 减少了编译依赖。
潜在问题:无明显的代码质量问题。
建议:保持当前的代码风格和注释习惯。

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

采用信号槽机制响应 DConfig 的变化,属于事件驱动型更新,避免了轮询。状态变更时通过比较 enabled == m_enabled 提前返回,减少了不必要的信号发射和 UI 刷新。
潜在问题:无。
建议:无。

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

漏洞对比统计:新增漏洞 0 个,减少漏洞 0 个,持平 0 个
代码通过 DConfig 读取本地配置项,配置值仅用于布尔逻辑判断,不存在外部输入注入、路径遍历或命令执行等风险。权限控制配置为 readwritevisibilityprivate,符合预期安全模型。
建议:无需额外安全修复。

■ 【改进建议代码示例】

--- a/shell-launcher-applet/package/launcheritem.qml
+++ b/shell-launcher-applet/package/launcheritem.qml
@@ -21,7 +21,8 @@ AppletItem {
     id: launcher
     property bool useColumnLayout: Panel.position % 2
     property int dockOrder: 12
-    property bool shouldVisible: LauncherController.enabled
+    // 确保 shouldVisible 被实际应用到组件的 visible 属性上
+    visible: LauncherController.enabled
     // 1:4 the distance between app : dock height; get width/height≈0.8
     implicitWidth: useColumnLayout ? Panel.rootObject.dockSize : Panel.rootObject.dockItemMaxSize * 0.8
     implicitHeight: useColumnLayout ? Panel.rootObject.dockItemMaxSize * 0.8 : Panel.rootObject.dockSize

"permissions": "readwrite",
"visibility": "private"
},
"enableLaunchpad": {

@18202781743 18202781743 Jul 27, 2026

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

这个是要禁用启动器的模块么?需要实时生效么,
是不是可以把这个逻辑移动到dde-shell里,放到applet里去实现,通过subpath的方式获取配置,支持override,

@wjyrich wjyrich closed this Jul 27, 2026
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