From c797e94b33f7b27ddcf46a1a79308dabdd5dc414 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tomasz=20Mo=C5=84?= Date: Sun, 13 Oct 2019 20:42:07 +0200 Subject: Qt: Fix export dissection dialog MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The export got broken in f67eccedd9836e6ced1f57ae9889f57a5400a3d7 as it didn't account for ExportDissectionDialog::exec() override. Change-Id: Ieaed669cb1b12c7a069f685429bf5a82f89d7391 Reviewed-on: https://code.wireshark.org/review/34771 Petri-Dish: Tomasz Moń Tested-by: Petri Dish Buildbot Reviewed-by: Jim Young Reviewed-by: Anders Broman --- ui/qt/export_dissection_dialog.cpp | 31 +++++++++++++++---------------- 1 file changed, 15 insertions(+), 16 deletions(-) (limited to 'ui/qt/export_dissection_dialog.cpp') diff --git a/ui/qt/export_dissection_dialog.cpp b/ui/qt/export_dissection_dialog.cpp index 267ff7405f..e0afdfbe94 100644 --- a/ui/qt/export_dissection_dialog.cpp +++ b/ui/qt/export_dissection_dialog.cpp @@ -142,6 +142,7 @@ ExportDissectionDialog::ExportDissectionDialog(QWidget *parent, capture_file *ca // Grow the dialog to account for the extra widgets. resize(width(), height() + (packet_range_group_box_.height() * 2 / 3)); + connect(this, SIGNAL(accepted()), this, SLOT(dialogAccepted())); #else // Q_OS_WIN #endif // Q_OS_WIN } @@ -154,16 +155,21 @@ ExportDissectionDialog::~ExportDissectionDialog() #endif } -int ExportDissectionDialog::exec() +void ExportDissectionDialog::show() { #if !defined(Q_OS_WIN) - int retval; - - if (!cap_file_) return QDialog::Rejected; - - retval = QFileDialog::exec(); + if (cap_file_) { + QFileDialog::show(); + } +#else // Q_OS_WIN + win32_export_file((HWND)parentWidget()->effectiveWinId(), cap_file_, export_type_); +#endif // Q_OS_WIN +} - if (retval == QDialog::Accepted && selectedFiles().length() > 0) { +#ifndef Q_OS_WIN +void ExportDissectionDialog::dialogAccepted() +{ + if (selectedFiles().length() > 0) { cf_print_status_t status; QString file_name = selectedFiles()[0]; @@ -196,7 +202,7 @@ int ExportDissectionDialog::exec() print_args_.stream = print_stream_text_new(TRUE, print_args_.file); if (print_args_.stream == NULL) { open_failure_alert_box(print_args_.file, errno, TRUE); - return QDialog::Rejected; + return; } status = cf_print_packets(cap_file_, &print_args_, TRUE); break; @@ -216,7 +222,7 @@ int ExportDissectionDialog::exec() status = cf_write_json_packets(cap_file_, &print_args_); break; default: - return QDialog::Rejected; + return; } switch (status) { @@ -237,15 +243,8 @@ int ExportDissectionDialog::exec() set_last_open_dir(dirname); } } - - return retval; -#else // Q_OS_WIN - win32_export_file((HWND)parentWidget()->effectiveWinId(), cap_file_, export_type_); - return QDialog::Accepted; -#endif // Q_OS_WIN } -#ifndef Q_OS_WIN void ExportDissectionDialog::exportTypeChanged(QString name_filter) { export_type_ = export_type_map_.value(name_filter); -- cgit v1.2.3