Repository navigation
fix: change close dialog default to exit and ignore close event only on minimise - #834
Open
pppanghu77 wants to merge 1 commit into
Open
pppanghu77 wants to merge 1 commit into
pppanghu77 wants to merge 1 commit into
Conversation
|
TAG Bot TAG: 0.8.9 |
…on minimise 1. Root cause: closeEvent unconditionally called event->ignore() after showCloseDialog(), preventing Qt from closing the window and exiting the process regardless of user choice; default option was "Minimise" which kept the process alive in background 2. Fix: change showCloseDialog() to return bool (true=minimise path, false=exit/cancel), only call event->ignore() when it returns true; change default checkbox from "Minimise to system tray" to "Exit" 3. Impact: closing window now defaults to exit; cancelling the dialog allows normal window close; minimise-to-tray remains available as user-selected option; existing users with saved "Minimise" unaffected Log: close window now defaults to exit instead of minimise to tray Influence: 1. Test closing window with default "Exit" option - process should exit 2. Test selecting "Minimise to system tray" - process stays in tray 3. Test cancelling dialog - window closes and process exits 4. Test "don't ask again" with both options - saved behaviour persists 5. Verify existing users with saved "Minimise" still get minimise behaviour fix: 关闭对话框默认选项改为退出且仅在最小化时忽略关闭事件 1. 根因:closeEvent 在 showCloseDialog() 后无条件调用 event->ignore(), 阻止 Qt 关闭窗口和退出进程;默认选项为"最小化"导致进程驻留后台 2. 方案:将 showCloseDialog() 改为返回 bool(true=最小化路径, false=退出/取消),仅在返回 true 时调用 event->ignore(); 将默认勾选项从"最小化到系统托盘"改为"退出" 3. 影响:关闭窗口默认退出进程;取消对话框时窗口正常关闭; 最小化到托盘仍作为用户可选选项保留;已保存"最小化"的用户不受影响 Log: 关闭窗口默认改为退出而非最小化到托盘 Influence: 1. 测试默认"退出"选项关闭窗口 - 进程应退出 2. 测试选择"最小化到系统托盘" - 进程保留在托盘 3. 测试取消对话框 - 窗口关闭且进程退出 4. 测试"不再询问"两种选项 - 保存的行为持续生效 5. 验证已保存"最小化"的用户仍保持最小化行为 Bug: #274633
pppanghu77
force-pushed
the
agent/agent/65c75bd30995
branch
from
October 28, 2026 19:08
7bdf73a to
d0840d6
Compare
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: pppanghu77 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 |
deepin pr auto review🤖 AI 代码审查报告📊 总体评价
🔍 详细分析1. 语法逻辑 ✅评价: 语法正确,逻辑清晰 ✅ 通过 潜在问题: 建议: [] 2. 代码质量 ✅评价: 代码结构清晰,注释完整 ✅ 通过 潜在问题: 建议: ['建议将 if (isExit) 的大括号移至同一行,即 if (isExit) {,与 else 块风格保持一致'] 3. 代码性能 ✅评价: 性能良好,资源使用合理 ✅ 通过 潜在问题: 建议: [] 4. 代码安全 🔒评价: 存在0个安全漏洞 ✅ 通过
安全漏洞详情: 建议: [] 💡 改进建议代码示例// 建议统一大括号风格为 K&R 风格 if (isExit) {
QApplication::quit();
return false;
} else {
minimizedAPP();
return true;
}本报告由 AI 代码审查工具自动生成 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Root Cause Analysis
When the user closes the dde-cooperation main window,
MainWindow::closeEventunconditionally callsevent->ignore()aftershowCloseDialog(), preventing Qt from closing the window and exiting the process. The close dialog defaults to "Minimise to system tray", so the process stays alive in the background. Even when the user cancels the dialog,event->ignore()still prevents the window from closing.Key evidence:
mainwindow.cpp:182—showCloseDialog(); event->ignore();runs unconditionally;showCloseDialog()at line 201 hasop1->setChecked(true)defaulting to "Minimise".Fix Approach
Two-part fix (combo A+B as approved by root cause review):
op2->setChecked(true))showCloseDialog()to returnbool(true = minimise path, false = exit/cancel), and only callevent->ignore()when it returns true — allowing Qt to handle the close event normally on exit or cancelChange Safety Assessment
Code Safety
showCloseDialog()signature changed fromvoidtobool, but only 1 caller (closeEventatmainwindow.cpp:182) which is updated accordinglya976c756(PMS 250143) is preserved as a user-selectable option; this change does not revert any historical fixBusiness Impact Scope
Affected module: dde-cooperation main window close behaviour. Users closing the window will now default to exiting the process. The minimise-to-tray option remains available. Existing users with saved "Minimise" preference are unaffected.
Verification Suggestion
Test all three close paths: select "Exit" (process exits), select "Minimise to system tray" (process stays in tray), cancel dialog (window closes, process exits). Also test "don't ask again" with both options.
根因分析
用户关闭 dde-cooperation 主窗口时,
MainWindow::closeEvent在showCloseDialog()后无条件调用event->ignore(),阻止 Qt 关闭窗口和退出进程。关闭对话框默认勾选"最小化到系统托盘",导致进程驻留后台。即使用户取消对话框,event->ignore()仍然阻止窗口关闭。关键证据:
mainwindow.cpp:182—showCloseDialog(); event->ignore();无条件执行;showCloseDialog()第 201 行op1->setChecked(true)默认勾选"最小化"。修复方案
组合方案 A+B(经根因复核结论采纳):
op2->setChecked(true))showCloseDialog()改为返回bool(true=最小化路径,false=退出/取消),仅在返回 true 时调用event->ignore()——退出或取消时允许 Qt 正常处理关闭事件改动安全评估
代码安全评估
showCloseDialog()签名从void改为bool,但仅有 1 处调用者(mainwindow.cpp:182的closeEvent)已同步修改a976c756(PMS 250143)引入的"最小化到托盘"功能保留为用户可选项,本次改动不撤销任何历史修复业务影响范围
受影响模块:dde-cooperation 主窗口关闭行为。用户关闭窗口时默认退出进程。最小化到托盘选项仍可用。已保存"最小化"选项的老用户不受影响。
验证建议
测试关闭窗口的三种路径:选择"退出"(进程退出)、选择"最小化到系统托盘"(进程保留在托盘)、取消对话框(窗口关闭且进程退出)。同时测试"不再询问"两种选项的保存行为。
PMS: BUG-274633
Summary by Sourcery
Ensure closing the cooperation main window exits by default while retaining the option to minimise it to the system tray.
Bug Fixes:
Chores: