aboutsummaryrefslogtreecommitdiffstats
path: root/ui
diff options
context:
space:
mode:
authorPeter Wu <peter@lekensteyn.nl>2018-03-16 21:04:34 +0100
committerAlexis La Goutte <alexis.lagoutte@gmail.com>2018-03-18 14:10:41 +0000
commit56425fce7c16abb4138daf2e82ca5158d187fb4c (patch)
treebe8cbeb66cc1050847b5e8f384014f951ce132a2 /ui
parentdd8789036f46bdc5eab25bf04d4bc3f7e69a17a4 (diff)
Qt: allow keyboard navigation in Unsaved packets dialog
Currently the "Continue without Saving" button is visually highlighted in the "Unsaved packets..." dialog, but pressing Enter triggers "Save" instead. Even after changing button focus with arrow or tab keys, pressing Enter will not confirm the action (but Spacebar does). Restore the expected behavior for Linux and Windows, but preserve the fix for macOS since (for which this was originally added). Bug: 14531 Change-Id: Ic20fc5809b55949f6fd960bcb32618a4fa7fd1e9 Fixes: v2.3.0rc0-2672-gb0335359e5 ("Qt: Give discard button focus (but not as default)") Reviewed-on: https://code.wireshark.org/review/26511 Petri-Dish: Peter Wu <peter@lekensteyn.nl> Tested-by: Petri Dish Buildbot Reviewed-by: Stig Bjørlykke <stig@bjorlykke.org> Reviewed-by: Alexis La Goutte <alexis.lagoutte@gmail.com>
Diffstat (limited to 'ui')
-rw-r--r--ui/qt/capture_file_dialog.cpp2
-rw-r--r--ui/qt/main_window.cpp2
2 files changed, 4 insertions, 0 deletions
diff --git a/ui/qt/capture_file_dialog.cpp b/ui/qt/capture_file_dialog.cpp
index 99d9bf23fb..56e157a3e7 100644
--- a/ui/qt/capture_file_dialog.cpp
+++ b/ui/qt/capture_file_dialog.cpp
@@ -154,8 +154,10 @@ check_savability_t CaptureFileDialog::checkSaveAsWithComments(QWidget *
msg_dialog.setDefaultButton(QMessageBox::Cancel);
}
+#if defined(Q_OS_MAC)
discard_button->setAutoDefault(false);
discard_button->setFocus();
+#endif
msg_dialog.exec();
/* According to the Qt doc:
diff --git a/ui/qt/main_window.cpp b/ui/qt/main_window.cpp
index 2756ab4bf4..875d768595 100644
--- a/ui/qt/main_window.cpp
+++ b/ui/qt/main_window.cpp
@@ -1803,8 +1803,10 @@ bool MainWindow::testCaptureFileClose(QString before_what, FileCloseContext cont
}
discard_button = msg_dialog.addButton(discard_button_text, QMessageBox::DestructiveRole);
+#if defined(Q_OS_MAC)
discard_button->setAutoDefault(false);
discard_button->setFocus();
+#endif
msg_dialog.exec();
/* According to the Qt doc: