sync: from linuxdeepin/dde-session-shell#501
Conversation
Synchronize source files from linuxdeepin/dde-session-shell. Source-pull-request: linuxdeepin/dde-session-shell#66
Reviewer's guide (collapsed on small PRs)Reviewer's GuideUpdates the notification appName argument in the lock screen D-Bus notification call, making it conditional on the ENABLE_DSS_SNIP macro so that it uses a translatable "Lock Screen" string by default and falls back to the previous "dde-lock" identifier when the macro is defined. Sequence diagram for lock screen notification appName changesequenceDiagram
actor User
participant LockContent
participant NotificationsService as org_freedesktop_Notifications
User ->> LockContent: triggerLockScreen()
activate LockContent
LockContent ->> LockContent: tryGrabKeyboard(exitIfFailed)
alt ENABLE_DSS_SNIP not defined
LockContent ->> NotificationsService: Notify(appName=Lock_Screen, replacesId=0, appIcon="", summary="")
else ENABLE_DSS_SNIP defined
LockContent ->> NotificationsService: Notify(appName=dde-lock, replacesId=0, appIcon="", summary="")
end
deactivate LockContent
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
There was a problem hiding this comment.
Hey - I've left some high level feedback:
- Using
tr("Lock Screen")for theNotifyappName makes the identifier locale-dependent; consider keeping a stable, non-translated app name and moving the localized string into the summary/body to avoid issues with notification server matching and filtering. - It may be helpful to add a brief comment explaining the purpose of the
#ifndef ENABLE_DSS_SNIPconditional here, so future readers understand why the app name differs between builds.
Prompt for AI Agents
Please address the comments from this code review:
## Overall Comments
- Using `tr("Lock Screen")` for the `Notify` appName makes the identifier locale-dependent; consider keeping a stable, non-translated app name and moving the localized string into the summary/body to avoid issues with notification server matching and filtering.
- It may be helpful to add a brief comment explaining the purpose of the `#ifndef ENABLE_DSS_SNIP` conditional here, so future readers understand why the app name differs between builds.Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
deepin pr auto review这段代码是一个使用 D-Bus 接口发送桌面通知的修改。主要修改点是根据编译宏 以下是对这段代码的审查意见,包括语法逻辑、代码质量、性能和安全方面: 1. 语法逻辑
2. 代码质量
3. 代码性能
4. 代码安全
总结与改进建议代码总体来说,这段代码逻辑清晰,没有严重问题。为了提高可维护性,建议增加注释并提取常量。 改进后的代码示例: // ... 前面的代码 ...
.interface("org.freedesktop.Notifications")
.method(QString("Notify"))
// 根据编译宏决定通知的应用名称。
// 普通模式下使用翻译后的名称,特定模式下使用内部标识符以便后端识别。
#ifndef ENABLE_DSS_SNIP
.arg(tr("Lock Screen"))
#else
.arg(QString("dde-lock")) // appName: 用于特定构建下的内部识别
#endif
.arg(static_cast<uint>(0))
.arg(QString(""))
.arg(QString(""))
// ... 后面的代码 ...额外建议: |
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: deepin-ci-robot, yixinshark The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
Synchronize source files from linuxdeepin/dde-session-shell.
Source-pull-request: linuxdeepin/dde-session-shell#66
Summary by Sourcery
Update lock screen notification app name to be translatable while preserving existing name when DSS-specific snippet is enabled.
New Features:
Enhancements: