Skip to content

fix(batchprint): send DBus notification with correct argument signature - #402

Merged
pengfeixx merged 1 commit into
linuxdeepin:masterfrom
pengfeixx:fix/batchprint-notify
Sep 20, 2026
Merged

pengfeixx merged 1 commit into
linuxdeepin:masterfrom
pengfeixx:fix/batchprint-notify

Conversation

@pengfeixx

Copy link
Copy Markdown
Contributor

问题

批量打印功能在没有打印机的环境下打印文件,桌面无任何错误提示。

根因

NotifyClient 通过 QDBusInterface::call("Notify", args) 发送通知时,QVariantList 被隐式转换为单个 QVariant 参数,实际发出的 DBus 签名为 av,而非规范要求的 susssasa{sv}i。deepin 通知守护进程对签名严格匹配,返回 UnknownMethod,通知全部静默回退到 stderr——而右键菜单以 detached 方式启动进程,stderr 无人可见。

修复

  • 改用 QDBusMessage::createMethodCall + setArguments() 按 8 个独立参数发送 Notify 调用
  • notifyResult/notifyError 统一走 sendNotification(),消除重复代码
  • 新增 buildNotifyMessage() 供回归测试断言消息结构

翻译

  • lupdate 更新全部语言 ts 文件(扫描范围加入 batch-print 目录)
  • 补充 zh_CN / zh_HK / zh_TW 三语共 12 条 batchprint 新增文案,术语与各语言文件既有惯例对齐

测试

  • 新增 3 个回归测试(8 参数结构、参数类型、目标服务),ut_notifyclient 16/16 通过
  • 全部 batch-print 测试套件通过(12+11+16+8)
  • 端到端验证:无打印机时弹出「未找到默认打印机」错误通知;正常打印时弹出中文成功通知「已成功打印全部 1 个文件。」(dbus-monitor 抓包确认签名正确)

QDBusInterface::call() with a QVariantList marshalled all args into one
'av' parameter, which the deepin notification daemon rejects, so every
notification fell back to invisible stderr. Use QDBusMessage::
setArguments() to send the 8 separate parameters. Also update all
language ts files with lupdate and fill zh_CN/zh_HK/zh_TW translations.

QDBusInterface::call() 传入 QVariantList 时会把全部参数编码为单个
'av' 参数,被 deepin 通知服务拒绝,导致所有通知静默回退到不可见
的 stderr。改用 QDBusMessage::setArguments() 发送 8 个独立参数;
同时用 lupdate 更新全部语言 ts 文件并补充 zh_CN/zh_HK/zh_TW 翻译。

Log: 修复批量打印无打印机时无错误提示的问题
Influence: 批量打印的成功/失败/错误通知可正常弹出,通知文案支持简繁中文。

@sourcery-ai sourcery-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Sorry, we are unable to review this pull request

The GitHub API does not allow us to fetch diffs exceeding 20000 lines

@deepin-ci-robot

Copy link
Copy Markdown

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: lzwind, pengfeixx

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

@pengfeixx
pengfeixx merged commit ac1d2d8 into linuxdeepin:master Sep 20, 2026
7 of 8 checks passed
@pengfeixx
pengfeixx deleted the fix/batchprint-notify branch September 20, 2026 05:57
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