diff options
author | Tomasz Moń <desowin@gmail.com> | 2019-10-13 20:42:07 +0200 |
---|---|---|
committer | Anders Broman <a.broman58@gmail.com> | 2019-10-14 06:47:10 +0000 |
commit | c797e94b33f7b27ddcf46a1a79308dabdd5dc414 (patch) | |
tree | f8f686acd00bf100bd97fe67563d9603918aa063 /ui | |
parent | 572cd14eccce004f9161447facd5b7556237f736 (diff) |
Qt: Fix export dissection dialog
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ń <desowin@gmail.com>
Tested-by: Petri Dish Buildbot
Reviewed-by: Jim Young <jim.young.ws@gmail.com>
Reviewed-by: Anders Broman <a.broman58@gmail.com>
Diffstat (limited to 'ui')
-rw-r--r-- | ui/qt/export_dissection_dialog.cpp | 31 | ||||
-rw-r--r-- | ui/qt/export_dissection_dialog.h | 3 |
2 files changed, 17 insertions, 17 deletions
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); diff --git a/ui/qt/export_dissection_dialog.h b/ui/qt/export_dissection_dialog.h index b5468db4f7..652d32952a 100644 --- a/ui/qt/export_dissection_dialog.h +++ b/ui/qt/export_dissection_dialog.h @@ -36,10 +36,11 @@ public: ~ExportDissectionDialog(); public slots: - int exec(); + void show(); private slots: #ifndef Q_OS_WIN + void dialogAccepted(); void exportTypeChanged(QString name_filter); void checkValidity(); void on_buttonBox_helpRequested(); |