Conversation
Add deepin-reader-batchprint standalone process for multi-file batch printing from file manager context menu without any dialog interaction. 新增无界面批量打印能力:文件管理器多选文档后右键"批量打印" 拉起独立进程静默完成打印,支持 pdf/docx/djvu/xps 格式。 Log: 新增deepin-reader批量打印功能 Influence: 用户可在文件管理器中多选文档批量打印,无需逐个操作。
|
Warning
|
Reviewer's GuideThis PR adds a file-manager-invoked, headless batch-print process that normalizes PDF/DOCX/DjVu/XPS documents, submits them to a default CUPS printer without linking CUPS at build time, reports aggregate results over DBus, and integrates the executable, context menu, multiarch packaging, and optional unit tests into the build. Sequence diagram for headless batch document printingsequenceDiagram
actor User
participant FileManager
participant BatchPrintApp
participant FormatConverter
participant CupsClient
participant CUPS
participant NotifyClient
participant DBus
User->>FileManager: Select documents and choose Batch Print
FileManager->>BatchPrintApp: deepin-reader-batchprint %F
BatchPrintApp->>CupsClient: init()
CupsClient->>CUPS: dlopen and resolve symbols
BatchPrintApp->>CupsClient: checkEnvironment()
CupsClient->>CUPS: get default printer
loop Each input file
BatchPrintApp->>FormatConverter: convertToPdf(filePath, tempDir)
FormatConverter-->>BatchPrintApp: outputPdfPath
BatchPrintApp->>CupsClient: submitJob(outputPdfPath, jobTitle, settings)
CupsClient->>CUPS: cupsPrintFile()
CUPS-->>CupsClient: job result
end
BatchPrintApp->>NotifyClient: notifyResult(total, succeeded, failedFiles)
NotifyClient->>DBus: Notify()
DBus-->>User: Aggregate print result
Flow diagram for document normalization before printingflowchart LR
Input["Selected PDF DOCX DjVu or XPS"] --> Detect["detectFileTypeWithFallback"]
Detect --> PDF["PDF: use original file"]
Detect --> DOCX["DOCX: DocumentFactory via pandoc"]
Detect --> DJVU["DjVu: render pages at 300 DPI"]
Detect --> XPS["XPS: doc->saveAs"]
PDF --> Output["PDF input for CUPS"]
DOCX --> Output
DJVU --> Output
XPS --> Output
Output --> Submit["CupsClient.submitJob"]
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 found 1 issue
Prompt for AI Agents
Please address the comments from this code review:
## Individual Comments
### Comment 1
<location path="CMakeLists.txt" line_range="264-271" />
<code_context>
if (USE_PDFIUM_BUNDLE)
add_subdirectory(3rdparty/deepin-pdfium)
+ add_subdirectory(batch-print)
+
+ # Install context-menus (batch print)
+ install(FILES src/context-menus/deepin-reader-batchprint.conf
+ DESTINATION ${CMAKE_INSTALL_DATADIR}/applications/context-menus)
endif()
# 单元测试(可选)
</code_context>
<issue_to_address>
**issue (broader_impact):** The batch-print executable and its context-menu registration are only added when `USE_PDFIUM_BUNDLE` is enabled. Configurations that intentionally use the system PDFium library build the reader but omit the advertised batch-print feature entirely.
**Triggers:** When the project is configured with `-DUSE_PDFIUM_BUNDLE=OFF`.
**Suggested fix:** Move the batch-print subdirectory and context-menu installation outside the `USE_PDFIUM_BUNDLE` conditional; retain only the PDFium target selection inside the conditional.
```suggestion
if (USE_PDFIUM_BUNDLE)
add_subdirectory(3rdparty/deepin-pdfium)
endif()
add_subdirectory(batch-print)
# Install context-menus (batch print)
install(FILES src/context-menus/deepin-reader-batchprint.conf
DESTINATION ${CMAKE_INSTALL_DATADIR}/applications/context-menus)
```
</issue_to_address>| if (USE_PDFIUM_BUNDLE) | ||
| add_subdirectory(3rdparty/deepin-pdfium) | ||
| add_subdirectory(batch-print) | ||
|
|
||
| # Install context-menus (batch print) | ||
| install(FILES src/context-menus/deepin-reader-batchprint.conf | ||
| DESTINATION ${CMAKE_INSTALL_DATADIR}/applications/context-menus) | ||
| endif() |
There was a problem hiding this comment.
issue (broader_impact): The batch-print executable and its context-menu registration are only added when USE_PDFIUM_BUNDLE is enabled. Configurations that intentionally use the system PDFium library build the reader but omit the advertised batch-print feature entirely.
Triggers: When the project is configured with -DUSE_PDFIUM_BUNDLE=OFF.
Suggested fix: Move the batch-print subdirectory and context-menu installation outside the USE_PDFIUM_BUNDLE conditional; retain only the PDFium target selection inside the conditional.
| if (USE_PDFIUM_BUNDLE) | |
| add_subdirectory(3rdparty/deepin-pdfium) | |
| add_subdirectory(batch-print) | |
| # Install context-menus (batch print) | |
| install(FILES src/context-menus/deepin-reader-batchprint.conf | |
| DESTINATION ${CMAKE_INSTALL_DATADIR}/applications/context-menus) | |
| endif() | |
| if (USE_PDFIUM_BUNDLE) | |
| add_subdirectory(3rdparty/deepin-pdfium) | |
| endif() | |
| add_subdirectory(batch-print) | |
| # Install context-menus (batch print) | |
| install(FILES src/context-menus/deepin-reader-batchprint.conf | |
| DESTINATION ${CMAKE_INSTALL_DATADIR}/applications/context-menus) |
|
关闭此 PR,改为从用户 fork 仓库发起 PR(Stage 6 返工:切换为 fork → linuxdeepin PR 模式)。 |
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: pengfeixx 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 |
feat: add headless batch print for pdf/docx/djvu/xps
Summary
新增
deepin-reader-batchprint独立进程,支持在文件管理器中多选 pdf/docx/djvu/xps 文档后通过右键菜单"批量打印"静默完成打印,全程无对话框交互。Key changes
deepin-reader-batchprint.conf注册右键菜单项Test scenarios
ll-builder build成功,batch-print 正确编出并打包Related: V-4012
Summary by Sourcery
Introduce silent batch printing for supported document formats from the file manager while integrating the new executable into the CMake and packaging workflows.
New Features:
Bug Fixes:
Enhancements:
Build:
Tests: