fix: save dialog resets filename and format when changing save path#202
Conversation
Reviewer's guide (collapsed on small PRs)Reviewer's GuideReorders and consolidates file dialog initialization so the directory is set before filters and selected file, preventing GTK from clearing the filename and selected format when the save path changes. Sequence diagram for updated file save dialog initialization ordersequenceDiagram
participant DrawBoard_private
participant FileSelectDialog
DrawBoard_private->>FileSelectDialog: FileSelectDialog(_borad)
alt file not empty
DrawBoard_private->>FileSelectDialog: setDirectory(QFileInfo(file).dir().absolutePath())
DrawBoard_private->>FileSelectDialog: setNameFilters(drawApp->writableFormatNameFilters())
DrawBoard_private->>FileSelectDialog: selectNameFilter(drawApp->defaultFileDialogNameFilter())
DrawBoard_private->>FileSelectDialog: selectFile(file)
else file empty
DrawBoard_private->>FileSelectDialog: setDirectory(drawApp->defaultFileDialogPath())
DrawBoard_private->>FileSelectDialog: setNameFilters(drawApp->writableFormatNameFilters())
DrawBoard_private->>FileSelectDialog: selectNameFilter(drawApp->defaultFileDialogNameFilter())
DrawBoard_private->>FileSelectDialog: selectFile(fullFileName)
end
DrawBoard_private->>FileSelectDialog: exec()
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:
- The directory selection logic is now split between the initial
if (!file.isEmpty())block and later branches; consider computing the target directory once (e.g., into a localQString directory) before constructing/configuring the dialog so that future changes to directory selection are centralized and less error-prone.
Prompt for AI Agents
Please address the comments from this code review:
## Overall Comments
- The directory selection logic is now split between the initial `if (!file.isEmpty())` block and later branches; consider computing the target directory once (e.g., into a local `QString directory`) before constructing/configuring the dialog so that future changes to directory selection are centralized and less error-prone.Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
e50c474 to
ba05af4
Compare
|
/forcemerge |
Log: setDirectory() after selectFile/selectNameFilter caused native GTK dialog to clear selections on directory change; fixed by reordering setDirectory() first and enabling DontUseNativeDialog. Pms: bug-3471613
deepin pr auto review你好!我是CodeGeeX。我已经仔细审查了你提供的Git Diff。本次修改主要解决了文件对话框在特定桌面环境(如GTK)下,由于原生对话框行为导致的文件名和过滤器被重置的Bug,并对版权信息进行了更新。 以下是我对本次代码变更在语法逻辑、代码质量、代码性能和代码安全方面的详细审查意见: 1. 语法与逻辑
2. 代码质量
3. 代码性能
4. 代码安全
总结本次修改核心逻辑正确,有效修复了GTK环境下文件对话框状态重置的问题。主要的改进点在于评估是否必须全局禁用原生对话框以及减少 希望这些审查意见对你有所帮助!如果有任何疑问,欢迎随时讨论。 |
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: JWWTSL, 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 |
Log: setDirectory() was called after selectFile and selectNameFilter, causing the native GTK dialog to clear the previously set filename and format on directory change. Fixed by moving setDirectory() before filter and file selection so selections persist.
Bug: https://pms.uniontech.com/bug-view-347163.html
Summary by Sourcery
Bug Fixes: