Repository navigation
fix(thumbnail): pass file URL when opening snapshot via DBus - #530
Conversation
Pass file:// URL to imageViewer/movie DBus interface instead of a bare path, because image viewer matches the file against a URL list. Fall back to command-line launch when imageViewer returns false. 通过DBus打开缩略图文件时传file://形式的URL而非裸路径, 看图内部按URL列表匹配文件;看图返回false时回退命令行启动。 Log: 修复相机缩略图打开图片时看图不显示图片的问题 PMS: BUG-381089 Influence: 相机右下角缩略图打开图片可正常显示,视频打开不受影响
Reviewer's guide (collapsed on small PRs)Reviewer's GuideUpdates thumbnail media opening to pass file:// URLs required for image-viewer path matching, and uses the DBus boolean result to fall back to command-line opening when the request is unsuccessful. Sequence diagram for thumbnail media opening with DBus fallbacksequenceDiagram
participant User
participant ImageItem
participant ImageViewer as deepin-image-viewer
participant Movie as deepin-movie
participant Fallback as CommandLineFallback
User->>ImageItem: openFile()
alt Image
ImageItem->>ImageItem: QUrl::fromLocalFile(filePath).toString()
ImageItem->>ImageViewer: openImageFile(fileUrl)
ImageViewer-->>ImageItem: bool
else Video
ImageItem->>ImageItem: QUrl::fromLocalFile(filePath).toString()
ImageItem->>Movie: openFile(fileUrl)
Movie-->>ImageItem: DBus reply
end
alt DBus request succeeds
ImageItem-->>User: Media opens in application
else DBus error or false result
ImageItem->>Fallback: openWithBackup()
Fallback-->>User: Media opens via fallback
end
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
deepin pr auto review🤖 AI 代码审查报告📊 总体评价
🔍 详细分析1. 语法逻辑 ✅评价: 语法正确,逻辑清晰 ✅ 通过 潜在问题: 建议: ['视频分支应与图片分支保持一致,同样解析 DBus 返回的布尔值来判断是否真正成功,确保失败时能触发 openWithBackup() 回退'] 2. 代码质量 ✅评价: 代码结构清晰,注释完整 ✅ 通过 潜在问题: 建议: ['若视频分支也同步改进返回值检查,则注释与实现将完全一致;或在注释中注明仅 URL 传递保持一致'] 3. 代码性能 ✅评价: 性能良好,资源使用合理 ✅ 通过 潜在问题: 建议: [] 4. 代码安全 🔒评价: 存在0个安全漏洞 ✅ 通过
安全漏洞详情: 建议: [] 💡 改进建议代码示例// 视频分支应同步图片分支的返回值检查逻辑:
// src/src/imageitem.cpp, ImageItem::openFile() 视频分支
connect(watcher, &QDBusPendingCallWatcher::finished, this, [watcher, openWithBackup]() {
const QDBusMessage retMessage = watcher->reply();
bool ok = false;
if (retMessage.type() != QDBusMessage::ErrorMessage) {
ok = retMessage.arguments().value(0).toBool();
}
if (ok) {
qDebug() << "Successfully opened video with deepin-movie via DBus";
} else {
qWarning() << "Failed to open video with deepin-movie via DBus:" << retMessage.errorMessage();
if (openWithBackup) {
openWithBackup();
}
}
watcher->deleteLater();
});本报告由 AI 代码审查工具自动生成 |
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: add-uos, lzwind 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 |
|
/forcemerge |
问题 / Issue
PMS: BUG-381089
相机右下角预览缩略图点击后,打开图片时看图应用被拉起但不显示该照片;打开视频正常。
根因
相机在 v23+ 通过 DBus 调用
com.deepin.imageViewer.openImageFile时传递的是裸路径(如/home/xx/Pictures/Camera/UOS_xxx.jpg):file://转换(QUrl(裸路径).isLocalFile() == false),原样透传;setSourcePath拿裸路径去和FileControl.getDirImagePath返回的 URL 列表(file:///...)做匹配,setImageFiles中indexOf失败直接 return,导致看图窗口空白;openImageFile返回false属于正常 DBus 回复(非 ErrorMessage),相机端此前只判断 ErrorMessage,不会触发回退,形成“假成功”。影院的适配器内部自行把裸路径转成
file://URL,所以视频一直正常。修复
QUrl::fromLocalFile(filePath).toString()(file://URL),影院\w+://分支本就兼容;openImageFile的 bool 返回值,返回 false 时回退到命令行启动看图 / 文管打开方式,消除假成功。验证
Summary by Sourcery
Fix snapshot opening by using file URLs for DBus launches and honoring unsuccessful responses with a fallback opener.
Bug Fixes:
Enhancements: