aboutsummaryrefslogtreecommitdiffstats
path: root/ui/qt/export_dissection_dialog.cpp
diff options
context:
space:
mode:
authorTomasz Moń <desowin@gmail.com>2019-10-13 20:42:07 +0200
committerAnders Broman <a.broman58@gmail.com>2019-10-14 06:47:10 +0000
commitc797e94b33f7b27ddcf46a1a79308dabdd5dc414 (patch)
treef8f686acd00bf100bd97fe67563d9603918aa063 /ui/qt/export_dissection_dialog.cpp
parent572cd14eccce004f9161447facd5b7556237f736 (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/qt/export_dissection_dialog.cpp')
-rw-r--r--ui/qt/export_dissection_dialog.cpp31
1 files changed, 15 insertions, 16 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);