Skip to content

feat: add battery check before system updates#142

Merged
xionglinlin merged 1 commit into
linuxdeepin:masterfrom
xionglinlin:master
Jul 4, 2025
Merged

feat: add battery check before system updates#142
xionglinlin merged 1 commit into
linuxdeepin:masterfrom
xionglinlin:master

Conversation

@xionglinlin

Copy link
Copy Markdown
Contributor
  1. Added battery status check in UpdateWorker before starting upgrades
  2. Show notification if battery is not plugged in
  3. Added new signal startDoUpgrade to properly handle dialog closing
  4. Updated translations for new battery check message
  5. Modified update dialog to close only after upgrade starts

This change prevents system updates when running on battery to avoid potential issues from power loss during update process. The dialog now closes at the right time after the upgrade begins rather than immediately when clicking the button.

feat: 在系统更新前添加电池检查

  1. 在UpdateWorker中添加升级前的电池状态检查
  2. 如果未插入电源则显示通知
  3. 添加新的startDoUpgrade信号以正确处理对话框关闭
  4. 更新电池检查消息的翻译
  5. 修改更新对话框只在升级开始后关闭

此更改可防止在电池供电时进行系统更新,以避免更新过程中断电可能导致的问
题。对话框现在会在升级开始后而不是点击按钮时立即关闭。

pms: Bug-320697

1. Added battery status check in UpdateWorker before starting upgrades
2. Show notification if battery is not plugged in
3. Added new signal startDoUpgrade to properly handle dialog closing
4. Updated translations for new battery check message
5. Modified update dialog to close only after upgrade starts

This change prevents system updates when running on battery to avoid
potential issues from power loss during update process. The dialog
now closes at the right time after the upgrade begins rather than
immediately when clicking the button.

feat: 在系统更新前添加电池检查

1. 在UpdateWorker中添加升级前的电池状态检查
2. 如果未插入电源则显示通知
3. 添加新的startDoUpgrade信号以正确处理对话框关闭
4. 更新电池检查消息的翻译
5. 修改更新对话框只在升级开始后关闭

此更改可防止在电池供电时进行系统更新,以避免更新过程中断电可能导致的问
题。对话框现在会在升级开始后而不是点击按钮时立即关闭。

pms: Bug-320697
@deepin-ci-robot

Copy link
Copy Markdown

deepin pr auto review

代码审查意见:

  1. 重复代码:在updatework.cpp文件中,doUpgrademodalUpgrade方法中都包含了相同的电池检查逻辑。建议将电池检查逻辑提取到一个单独的函数中,以避免代码重复。

  2. 信号发射:在updatework.cpp文件中,doUpgrademodalUpgrade方法中都发射了startDoUpgrade信号。如果这两个方法在逻辑上总是同时执行,那么可以考虑合并这两个方法,以减少代码的复杂度。

  3. 翻译:在update_ar.tsupdate_az.tsupdate_bo.tsupdate_ca.tsupdate_de_DE.tsupdate_es.tsupdate_et.tsupdate_fi.tsupdate_fr.tsupdate_gl_ES.tsupdate_hu.tsupdate_it.tsupdate_ja.tsupdate_kk.tsupdate_ko.tsupdate_lt.tsupdate_nb_NO.tsupdate_ne.tsupdate_nl.tsupdate_pl.tsupdate_pt_BR.tsupdate_ru.tsupdate_sq.tsupdate_tr.tsupdate_uk.tsupdate_vi.tsupdate_zh_CN.tsupdate_zh_HK.tsupdate_zh_TW.ts文件中,<translation>标签的type="unfinished"属性表示翻译尚未完成。建议尽快完成所有翻译工作,以确保软件的用户体验。

  4. 注释:在updatework.cpp文件中,doUpgrademodalUpgrade方法缺少注释说明。建议添加注释,以便其他开发者理解这些方法的用途和逻辑。

  5. 错误处理:在updatework.cpp文件中,doUpgrademodalUpgrade方法中缺少对可能出现的错误的处理。建议添加错误处理逻辑,以便在出现问题时能够及时反馈给用户。

  6. 性能优化:在updatework.cpp文件中,cleanLaStoreJob方法被调用了两次,一次在doUpgrade方法中,一次在modalUpgrade方法中。如果这两个方法总是同时执行,那么可以考虑将cleanLaStoreJob方法的调用移到这两个方法之外,以减少不必要的重复操作。

以上是本次代码审查的主要意见,希望能够对您的开发工作有所帮助。

@deepin-ci-robot

Copy link
Copy Markdown

@xionglinlin: The following test failed, say /retest to rerun all failed tests or /retest-required to rerun all mandatory failed tests:

Test name Commit Details Required Rerun command
deepin-auto-translation b6e1474 link true /test deepin-auto-translation

Full PR test history. Your PR dashboard.

Details

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. I understand the commands that are listed here.

@deepin-ci-robot

Copy link
Copy Markdown

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: 18202781743, xionglinlin

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

@xionglinlin xionglinlin merged commit f8771f0 into linuxdeepin:master Jul 4, 2025
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