Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions TeXmacs/progs/texmacs/texmacs/tm-print.scm
Original file line number Diff line number Diff line change
Expand Up @@ -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"))
Expand Down
19 changes: 19 additions & 0 deletions devel/222_43.md
Original file line number Diff line number Diff line change
@@ -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” 按钮。
11 changes: 8 additions & 3 deletions src/Plugins/Qt/qt_dialogues.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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...
Expand All @@ -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);
Expand All @@ -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);
Expand Down