Skip to content

fix: lock and greeter display correct datetime format in snipe branch #8

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

yixinshark
Copy link
Contributor

get user's region format config by using dConfig system dBus

Log: as title
Pms: BUG-316295

@deepin-ci-robot
Copy link

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: yixinshark

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

deepin-ci-robot added a commit to linuxdeepin/dde-session-shell-snipe that referenced this pull request May 20, 2025
Synchronize source files from linuxdeepin/dde-session-shell.

Source-pull-request: linuxdeepin/dde-session-shell#8
get user's region format config by using dConfig system dBus

Log: as title
Pms: BUG-316295
deepin-ci-robot added a commit to linuxdeepin/dde-session-shell-snipe that referenced this pull request May 20, 2025
Synchronize source files from linuxdeepin/dde-session-shell.

Source-pull-request: linuxdeepin/dde-session-shell#8
@deepin-ci-robot
Copy link

deepin pr auto review

代码审查意见:

  1. 代码重复

    • getRegionFormatConfigPathgetRegionFormatValue 方法中,错误处理部分代码重复,建议提取为一个公共方法。
  2. 资源管理

    • QDBusInterface 对象在 getRegionFormatConfigPathgetRegionFormatValue 方法中创建,但没有看到对应的释放操作,可能会导致资源泄露。建议使用 QScopedPointerQScopedRef 来管理这些对象的生命周期。
  3. 错误处理

    • onUserRegionFormatValueChanged 方法中,当 arguments.count() 不等于 1 时,直接返回,但没有记录错误信息。建议添加日志记录,以便于调试。
  4. 代码可读性

    • updateUserDateTimeFormat 方法中,变量 localeName 的赋值逻辑复杂,建议使用临时变量来提高代码的可读性。
  5. 线程安全

    • updateUserDateTimeFormat 方法中,访问 m_currentUserm_timeWidget 可能会导致竞态条件,建议在访问这些成员变量时加锁。
  6. 宏定义的使用

    • 使用 #ifdef ENABLE_DSS_SNIPE 宏来控制代码的编译,这可能会导致代码的可维护性降低。建议考虑使用更灵活的配置管理方式。
  7. 注释和文档

    • 新增的代码块缺少必要的注释说明,特别是 updateUserDateTimeFormatupdateRegionFormatConnection 方法,应该添加详细的注释说明其功能和实现细节。
  8. 潜在的逻辑错误

    • updateUserDateTimeFormat 方法中,m_timeWidget->updateLocale 调用使用了 m_shortTimeFormatm_longDateFormat,但在 updateLocale 方法中,这两个变量是可选的,可能会导致逻辑错误。建议检查调用 updateLocale 的逻辑,确保传入的格式字符串是有效的。
  9. 性能优化

    • updateUserDateTimeFormat 方法中,每次调用都会重新获取 m_currentUser 的配置路径,如果用户配置没有变化,可以缓存这个路径,避免重复的 D-Bus 调用。
  10. 代码风格

    • 代码缩进和格式不一致,建议统一代码风格,以提高代码的可读性。

以上是针对代码审查的几点主要意见,希望对您有所帮助。

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