Qt: Fix export dissection dialog

The export got broken in f67eccedd9 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>
This commit is contained in:
Tomasz Moń 2019-10-13 20:42:07 +02:00 committed by Anders Broman
parent 572cd14ecc
commit c797e94b33
2 changed files with 17 additions and 17 deletions

View File

@ -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_) {
QFileDialog::show();
}
#else // Q_OS_WIN
win32_export_file((HWND)parentWidget()->effectiveWinId(), cap_file_, export_type_);
#endif // Q_OS_WIN
}
if (!cap_file_) return QDialog::Rejected;
retval = QFileDialog::exec();
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);

View File

@ -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();