diff --git a/TeXmacs/progs/texmacs/texmacs/tm-print.scm b/TeXmacs/progs/texmacs/texmacs/tm-print.scm index 7c5d31b87e..7626dc5ac9 100644 --- a/TeXmacs/progs/texmacs/texmacs/tm-print.scm +++ b/TeXmacs/progs/texmacs/texmacs/tm-print.scm @@ -77,9 +77,10 @@ ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; (define (user-confirm-open-pdf fname) - (user-confirm "Open PDF?" #f - (lambda (open?) - (when open? (preview-file fname))))) + (user-ask (list "Open PDF?" "question-no-cancel" + (translate "no") (translate "yes")) + (lambda (answ) + (when (yes? answ) (preview-file fname))))) (tm-define (wrapped-print-to-file fname) (system-wait "Exporting, " (translate "please wait")) diff --git a/devel/222_43.md b/devel/222_43.md new file mode 100644 index 0000000000..8ef54f1a96 --- /dev/null +++ b/devel/222_43.md @@ -0,0 +1,19 @@ +# 222_43 导出 PDF 后确认对话框选项修复 + +## 如何测试 +1. 打开 Mogan +2. 打开任意文档 +3. 执行:文件 -> 导出 -> Pdf +4. 导出完成后弹出对话框 +5. 预期:只有“是/否”(或等价两项)按钮,不出现“取消”。 + +## 2026/02/10 +### What +- 导出 PDF 后的确认对话框仅保留两项选择。 + +### Why +- 原对话框出现三项选择,不符合预期交互。 + +### How +- Scheme 侧改用 `question-no-cancel` 类型触发对话框。 +- Qt 侧对 `question-no-cancel` 不添加 “Cancel” 按钮。 diff --git a/src/Plugins/Qt/qt_dialogues.cpp b/src/Plugins/Qt/qt_dialogues.cpp index 7ca3bf6a98..19dd6365d2 100644 --- a/src/Plugins/Qt/qt_dialogues.cpp +++ b/src/Plugins/Qt/qt_dialogues.cpp @@ -269,7 +269,8 @@ qt_inputs_list_widget_rep::field (int i) { void qt_inputs_list_widget_rep::perform_dialog () { - if ((N (children) == 1) && (field (0)->type == "question")) { + if ((N (children) == 1) && (field (0)->type == "question" || + field (0)->type == "question-no-cancel")) { // then use Qt messagebox for smoother, more standard UI QWidget* mainwindow= QApplication::activeWindow (); // main texmacs window. There are probably better ways... @@ -279,7 +280,10 @@ qt_inputs_list_widget_rep::perform_dialog () { QMessageBox msgBox (mainwindow); // sets parent widget, so that it appears at the proper location msgBox.setText (to_qstring (field (0)->prompt)); - msgBox.addButton (qt_translate ("Cancel"), QMessageBox::RejectRole); + /// 对于 question-no-cancel,不添加取消按钮,避免出现三选项对话框。 + bool add_cancel= (field (0)->type == "question"); + if (add_cancel) + msgBox.addButton (qt_translate ("Cancel"), QMessageBox::RejectRole); // Allow any number of choices. The first one is the default. int choices= N (field (0)->proposals); @@ -294,7 +298,8 @@ qt_inputs_list_widget_rep::perform_dialog () { msgBox.setDefaultButton (buttonlist[0]); for (int i= 0; i < choices - 1; ++i) QWidget::setTabOrder (buttonlist[i], buttonlist[i + 1]); - QWidget::setTabOrder (buttonlist[choices - 1], msgBox.escapeButton ()); + if (add_cancel) + QWidget::setTabOrder (buttonlist[choices - 1], msgBox.escapeButton ()); } msgBox.setWindowTitle (qt_translate ("Question")); msgBox.setIcon (QMessageBox::Question);