Repository navigation
fix: add sidebar entries for /media and /mnt in mount dialog - #237
wangrong1069 wants to merge 1 commit into
Conversation
1. Root cause: DFileChooserEdit in MountDialog::initUi did not set DontUseNativeDialog, so DDE platform theme intercepted QFileDialog via D-Bus to dde-file-dialog; its "Computer" view (computer://) only shows block devices and special locations, hiding /media and /mnt 2. Fix: set QFileDialog::DontUseNativeDialog to use Qt built-in dialog, then call setSidebarUrls with file:///media and file:///mnt entries 3. Impact: mount point dialog switches from DDE native style to Qt built-in style; sidebar now shows /media and /mnt shortcuts Log: Fix mount point dialog missing /media and /mnt access Influence: 1. Test mount point dialog opens and sidebar shows /media and /mnt 2. Test navigating to /media and /mnt subdirectories from sidebar 3. Test dialog open/select/cancel flow has no regression fix: 挂载点对话框添加 /media 和 /mnt 侧边栏入口 1. 根因:MountDialog::initUi 中 DFileChooserEdit 未设置 DontUseNativeDialog,DDE 平台主题插件拦截 QFileDialog 通过 D-Bus 调用 dde-file-dialog;其"计算机"视图(computer://)仅显示块设备和 特殊位置,不显示 /media 和 /mnt 2. 方案:设置 QFileDialog::DontUseNativeDialog 使用 Qt 内置对话框, 调用 setSidebarUrls 添加 file:///media 和 file:///mnt 侧边栏入口 3. 影响:挂载点对话框从 DDE 原生风格切换为 Qt 内置风格,侧边栏新增 /media 和 /mnt 快捷入口 Log: 修复挂载点对话框无法访问 /media 和 /mnt 的问题 Influence: 1. 测试挂载点对话框打开后侧边栏显示 /media 和 /mnt 入口 2. 测试从侧边栏导航到 /media 和 /mnt 子目录并选择挂载点 3. 测试对话框打开/选择/取消流程无回归 PMS: BUG-355887
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: wangrong1069 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 |
Reviewer's guide (collapsed on small PRs)Reviewer's GuideThe mount-point selection dialog now bypasses the DDE native file dialog and exposes Sequence diagram for mount point directory selectionsequenceDiagram
participant User
participant MountDialog
participant DFileChooserEdit
participant QFileDialog
MountDialog->>DFileChooserEdit: fileDialog()
DFileChooserEdit->>QFileDialog: setOption(DontUseNativeDialog)
DFileChooserEdit->>QFileDialog: setSidebarUrls(sidebarUrls)
User->>QFileDialog: Select directory from /media or /mnt
QFileDialog-->>MountDialog: Directory selection
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
deepin pr auto review🤖 AI 代码审查报告📊 总体评价
🔍 详细分析1. 语法逻辑 ✅评价: 语法正确,逻辑清晰 ✅ 通过 潜在问题: 建议: [] 2. 代码质量 ✅评价: 代码结构清晰,注释完整 ✅ 通过 潜在问题: 建议: [] 3. 代码性能 ✅评价: 性能良好,资源使用合理 ✅ 通过 潜在问题: 建议: [] 4. 代码安全 🔒评价: 存在0个安全漏洞 ✅ 通过
安全漏洞详情: 建议: [] 💡 改进建议代码示例本报告由 AI 代码审查工具自动生成 |
|
TAG Bot New tag: 6.0.28 |
|
TAG Bot New tag: 6.0.29 |
|
TAG Bot New tag: 6.0.30 |
Root Cause Analysis
The mount point selection dialog in deepin-diskmanager uses
DFileChooserEditinMountDialog::initUi(). Without settingQFileDialog::DontUseNativeDialog, the DDE platform theme plugin interceptsQFileDialogand routes it through D-Bus to the DDE native file dialog (dde-file-dialog). The native dialog's "Computer" view navigates tocomputer://, which only shows block devices and special locations —/mediaand/mntare not visible. Additionally,setSidebarUrls()was never called, so no custom sidebar shortcuts exist for these directories. Key evidence:application/widgets/mountdialog.cpp:51-58(noDontUseNativeDialog, nosetSidebarUrls).Fix
Set
QFileDialog::DontUseNativeDialogto bypass the DDE native dialog and use the Qt built-in file dialog, then callsetSidebarUrls()withfile:///mediaandfile:///mntto add sidebar shortcuts. This is the minimal change — only 6 lines added, no existing code modified or deleted.Change Safety Assessment
Code Safety
setAcceptMode, does not revert any historical fixreferenceslist is empty, code graph unavailable)Business Impact Scope
Affects the mount point selection dialog in the disk manager's mount functionality. After the change, the dialog uses Qt built-in style (instead of DDE native style) with
/mediaand/mntsidebar shortcuts. Users can directly navigate to these directories from the sidebar to select a valid mount point.Verification Suggestion
Verify the mount point dialog opens correctly with
/mediaand/mntvisible in the sidebar, and that selecting a directory from either path works without regression in the open/select/cancel flow.根因分析
磁盘管理器挂载点选择对话框在
MountDialog::initUi()中使用DFileChooserEdit。由于未设置QFileDialog::DontUseNativeDialog,DDE 平台主题插件拦截QFileDialog并通过 D-Bus 调用 DDE 原生文件对话框(dde-file-dialog)。原生对话框的"计算机"视图导航到computer://,仅显示块设备和特殊位置,/media和/mnt不可见。同时未调用setSidebarUrls(),侧边栏无这两个目录的快捷入口。关键证据:application/widgets/mountdialog.cpp:51-58。修复方案
设置
QFileDialog::DontUseNativeDialog绕过 DDE 原生对话框,使用 Qt 内置文件对话框;调用setSidebarUrls()添加file:///media和file:///mnt侧边栏快捷入口。改动最小——仅新增 6 行,不修改或删除任何已有代码。改动安全评估
代码安全评估
setAcceptMode后追加代码,不撤销任何已有修复references为空,代码图谱不可用)业务影响范围
影响磁盘管理器挂载功能中的挂载点选择对话框。改动后对话框使用 Qt 内置风格(替代 DDE 原生风格),侧边栏新增
/media和/mnt快捷入口。用户可从侧边栏直接导航到这些目录选择有效挂载点。验证建议
验证挂载点对话框正常打开,侧边栏显示
/media和/mnt入口,从侧边栏选择目录后挂载流程无回归。PMS: BUG-355887
Summary by Sourcery
Make /media and /mnt directly accessible when selecting mount points.
New Features:
Bug Fixes:
Enhancements: