aboutsummaryrefslogtreecommitdiffstats
path: root/ui
diff options
context:
space:
mode:
authorRoland Knall <rknall@gmail.com>2020-04-27 17:24:05 +0200
committerGerald Combs <gerald@wireshark.org>2020-04-27 16:00:03 +0000
commit7fcac9c955af94f0d046e985278ea41936a3b1a2 (patch)
tree3b9cd1b2154f52370854a733e35e891ba41c51e4 /ui
parentca4cc6a34fe23b9b7c01573c2e87bf2d5ff15d44 (diff)
Qt: Fix export of dissection
Exporting dissected bytes did not consider the selection of packets on Windows, if multiple packets had been selected Bug: 16516 Change-Id: I9d914fe1fed22f842d73caea397a3f37ffc0d523 Reviewed-on: https://code.wireshark.org/review/36958 Reviewed-by: Roland Knall <rknall@gmail.com> Petri-Dish: Roland Knall <rknall@gmail.com> Tested-by: Petri Dish Buildbot Reviewed-by: Gerald Combs <gerald@wireshark.org>
Diffstat (limited to 'ui')
-rw-r--r--ui/qt/export_dissection_dialog.cpp4
-rw-r--r--ui/qt/export_dissection_dialog.h2
-rw-r--r--ui/win32/file_dlg_win32.c13
-rw-r--r--ui/win32/file_dlg_win32.h3
4 files changed, 14 insertions, 8 deletions
diff --git a/ui/qt/export_dissection_dialog.cpp b/ui/qt/export_dissection_dialog.cpp
index 04a8e0e9b8..58c42ec0b6 100644
--- a/ui/qt/export_dissection_dialog.cpp
+++ b/ui/qt/export_dissection_dialog.cpp
@@ -52,6 +52,8 @@ ExportDissectionDialog::ExportDissectionDialog(QWidget *parent, capture_file *ca
cap_file_(cap_file)
#if !defined(Q_OS_WIN)
, save_bt_(NULL)
+#else
+ , sel_range_(selRange)
#endif /* Q_OS_WIN */
{
setWindowTitle(wsApp->windowTitleString(tr("Export Packet Dissections")));
@@ -162,7 +164,7 @@ void ExportDissectionDialog::show()
WiresharkFileDialog::show();
}
#else // Q_OS_WIN
- win32_export_file((HWND)parentWidget()->effectiveWinId(), windowTitle().toStdWString().c_str(), cap_file_, export_type_);
+ win32_export_file((HWND)parentWidget()->effectiveWinId(), windowTitle().toStdWString().c_str(), cap_file_, export_type_, sel_range_.toStdString().c_str());
#endif // Q_OS_WIN
}
diff --git a/ui/qt/export_dissection_dialog.h b/ui/qt/export_dissection_dialog.h
index 0911e5b3a4..a38d022189 100644
--- a/ui/qt/export_dissection_dialog.h
+++ b/ui/qt/export_dissection_dialog.h
@@ -58,6 +58,8 @@ private:
PacketFormatGroupBox packet_format_group_box_;
QPushButton *save_bt_;
+#else
+ QString sel_range_;
#endif // Q_OS_WIN
};
diff --git a/ui/win32/file_dlg_win32.c b/ui/win32/file_dlg_win32.c
index 97d029fe4e..552e45ac3d 100644
--- a/ui/win32/file_dlg_win32.c
+++ b/ui/win32/file_dlg_win32.c
@@ -467,7 +467,7 @@ win32_merge_file (HWND h_wnd, const wchar_t *title, GString *file_name, GString
}
void
-win32_export_file(HWND h_wnd, const wchar_t *title, capture_file *cf, export_type_e export_type) {
+win32_export_file(HWND h_wnd, const wchar_t *title, capture_file *cf, export_type_e export_type, const gchar *range_) {
OPENFILENAME *ofn;
TCHAR file_name[MAX_PATH] = _T("");
char *dirname;
@@ -501,6 +501,12 @@ win32_export_file(HWND h_wnd, const wchar_t *title, capture_file *cf, export_typ
/* Fill in our print (and export) args */
+ /* init the printing range */
+ packet_range_init(&print_args.range, cf);
+
+ if (strlen(range_) > 0)
+ packet_range_convert_selection_str(&print_args.range, range_);
+
print_args.format = PR_FMT_TEXT;
print_args.to_file = TRUE;
print_args.cmd = NULL;
@@ -1705,11 +1711,6 @@ export_file_hook_proc(HWND ef_hwnd, UINT msg, WPARAM w_param, LPARAM l_param) {
switch(msg) {
case WM_INITDIALOG: {
- OPENFILENAME *ofnp = (OPENFILENAME *) l_param;
- capture_file *cf = (capture_file *) ofnp->lCustData;
-
- /* init the printing range */
- packet_range_init(&print_args.range, cf);
/* default to displayed packets */
print_args.range.process_filtered = TRUE;
range_handle_wm_initdialog(ef_hwnd, &print_args.range);
diff --git a/ui/win32/file_dlg_win32.h b/ui/win32/file_dlg_win32.h
index 86a518a859..a71c2973a9 100644
--- a/ui/win32/file_dlg_win32.h
+++ b/ui/win32/file_dlg_win32.h
@@ -101,8 +101,9 @@ gboolean win32_merge_file (HWND h_wnd, const wchar_t *title, GString *file_name,
* @param h_wnd HWND of the parent window.
* @param cf capture_file Structure for the capture to be saved
* @param export_type The export type.
+ * @param range a possible range
*/
-void win32_export_file (HWND h_wnd, const wchar_t *title, capture_file *cf, export_type_e export_type);
+void win32_export_file (HWND h_wnd, const wchar_t *title, capture_file *cf, export_type_e export_type, const gchar *range);
/* Open dialog defines */
/* #define EWFD_FILTER_BTN 1000 */