Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: the power button cannot trigger shutdown #389

Merged
merged 1 commit into from
Dec 27, 2024

Conversation

zsien
Copy link
Contributor

@zsien zsien commented Dec 27, 2024

修复 Super+L 锁屏时,电源键无法出发关机

Log: 修复 Super+L 锁屏时,电源键无法出发关机
PMS: bug-289177

修复 Super+L 锁屏时,电源键无法出发关机

Log: 修复 Super+L 锁屏时,电源键无法出发关机
PMS: bug-289177
@zsien zsien requested a review from a team December 27, 2024 03:04
@deepin-ci-robot
Copy link

deepin pr auto review

代码审查意见:

  1. 代码重复

    • ShutdownWidget 类中的 onRequirePowerAction 函数在 lockcontent.cppshutdownwidget.cpp 中都有定义,建议将这个函数移动到一个公共的类中,以避免代码重复。
  2. 信号槽连接

    • shutdownwidget.cpp 中,onRequirePowerAction 函数被直接调用,而不是通过信号槽机制。这可能会导致信号槽机制失效。建议使用 emit 关键字来发出信号,而不是直接调用函数。
  3. 逻辑判断

    • onRequirePowerAction 函数中,m_model->appType() == Lock 的判断逻辑可能不够清晰。建议使用枚举类型或者常量来代替硬编码的字符串,以提高代码的可读性和可维护性。
  4. 资源管理

    • pushShutdownFrame 函数中,m_shutdownFrame.reset(new ShutdownWidget(this)); 创建了一个新的 ShutdownWidget 对象,但没有检查 new 操作是否成功。建议使用智能指针(如 std::unique_ptr)来管理动态分配的对象,以避免内存泄漏。
  5. 信号定义

    • lockcontent.hshutdownwidget.h 中,onRequirePowerAction 信号被定义了两次。建议在公共头文件中定义一次,并在需要的地方包含该头文件。
  6. 注释

    • onRequirePowerAction 函数中的注释应该更详细地说明每个 PowerAction 的具体行为,以便其他开发者更好地理解代码逻辑。
  7. 代码风格

    • 代码缩进和格式应该保持一致,以提高代码的可读性。例如,onRequirePowerAction 函数中的 switch 语句应该有适当的缩进。

综上所述,建议对上述问题进行修改,以提高代码的质量和可维护性。

@deepin-ci-robot
Copy link

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: yixinshark, zsien

The full list of commands accepted by this bot can be found here.

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

@zsien zsien merged commit 14c84bb into linuxdeepin:master Dec 27, 2024
17 of 18 checks passed
@zsien zsien deleted the zs/fix/shutdownbtn branch December 27, 2024 03:43
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