summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--image/file_dlg_win32.rc1
-rw-r--r--ui/gtk/capture_file_dlg.c2
-rw-r--r--ui/qt/capture_file_dialog.cpp4
-rw-r--r--ui/win32/file_dlg_win32.c15
-rw-r--r--ui/win32/file_dlg_win32.h5
5 files changed, 21 insertions, 6 deletions
diff --git a/image/file_dlg_win32.rc b/image/file_dlg_win32.rc
index f500718c27..72295880ae 100644
--- a/image/file_dlg_win32.rc
+++ b/image/file_dlg_win32.rc
@@ -11,6 +11,7 @@ FONT 8, "MS Shell Dlg"
LTEXT "Read filter:", EWFD_FILTER_LBL, 67, 2, 49, 14
CONTROL "", EWFD_FILTER_EDIT, RICHEDIT_CLASS, ES_AUTOHSCROLL, 112, 0, 88, 12, WS_EX_CLIENTEDGE
+ COMBOBOX EWFD_FORMAT_TYPE, 67, 15, 135, 8, CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
CHECKBOX "MAC name resolution", EWFD_MAC_NR_CB, 67, 30, 100, 8, BS_AUTOCHECKBOX | WS_GROUP | WS_TABSTOP
CHECKBOX "Transport name resolution", EWFD_TRANS_NR_CB, 67, 45, 100, 8, BS_AUTOCHECKBOX | WS_GROUP | WS_TABSTOP
CHECKBOX "Network name resolution", EWFD_NET_NR_CB, 67, 60, 100, 8, BS_AUTOCHECKBOX | WS_GROUP | WS_TABSTOP
diff --git a/ui/gtk/capture_file_dlg.c b/ui/gtk/capture_file_dlg.c
index 5125376efc..f7de3eea23 100644
--- a/ui/gtk/capture_file_dlg.c
+++ b/ui/gtk/capture_file_dlg.c
@@ -692,7 +692,7 @@ file_open_cmd(capture_file *cf, GtkWidget *w _U_)
*/
for (;;) {
#ifdef USE_WIN32_FILE_DIALOGS
- if (win32_open_file(GDK_WINDOW_HWND(gtk_widget_get_window(top_level)), file_name, display_filter)) {
+ if (win32_open_file(GDK_WINDOW_HWND(gtk_widget_get_window(top_level)), file_name, &type, display_filter)) {
#else /* USE_WIN32_FILE_DIALOGS */
if (gtk_open_file(top_level, file_name, &type, display_filter)) {
#endif /* USE_WIN32_FILE_DIALOGS */
diff --git a/ui/qt/capture_file_dialog.cpp b/ui/qt/capture_file_dialog.cpp
index 20625f64fd..2cf966f77d 100644
--- a/ui/qt/capture_file_dialog.cpp
+++ b/ui/qt/capture_file_dialog.cpp
@@ -230,15 +230,13 @@ bool CaptureFileDialog::isCompressed() {
}
int CaptureFileDialog::open(QString &file_name, unsigned int &type) {
- Q_UNUSED(type) // XXX Remove when type supporte is added to win32_open_file.
GString *fname = g_string_new(file_name.toUtf8().constData());
GString *dfilter = g_string_new(display_filter_.toUtf8().constData());
gboolean wof_status;
// XXX Add a widget->HWND routine to qt_ui_utils and use it instead.
- wof_status = win32_open_file((HWND)parentWidget()->effectiveWinId(), fname, dfilter);
+ wof_status = win32_open_file((HWND)parentWidget()->effectiveWinId(), fname, &type, dfilter);
file_name = fname->str;
- //type = format_type_.currentIndex();
display_filter_ = dfilter->str;
g_string_free(fname, TRUE);
diff --git a/ui/win32/file_dlg_win32.c b/ui/win32/file_dlg_win32.c
index 1fdfb8ce73..f1f1d38cb0 100644
--- a/ui/win32/file_dlg_win32.c
+++ b/ui/win32/file_dlg_win32.c
@@ -125,6 +125,7 @@ static print_args_t print_args;
*/
static HWND g_sf_hwnd = NULL;
static char *g_dfilter_str = NULL;
+static unsigned int g_format_type = WTAP_TYPE_AUTO;
static int
win32_get_ofnsize()
@@ -192,7 +193,7 @@ win32_get_ofnsize()
*/
gboolean
-win32_open_file (HWND h_wnd, GString *file_name, GString *display_filter) {
+win32_open_file (HWND h_wnd, GString *file_name, unsigned int *type, GString *display_filter) {
OPENFILENAME *ofn;
TCHAR file_name16[MAX_PATH] = _T("");
int ofnsize;
@@ -243,6 +244,7 @@ win32_open_file (HWND h_wnd, GString *file_name, GString *display_filter) {
if (gofn_ok) {
g_string_printf(file_name, "%s", utf_16to8(file_name16));
g_string_printf(display_filter, "%s", g_dfilter_str ? g_dfilter_str : "");
+ *type = g_format_type;
}
g_free( (void *) ofn->lpstrFilter);
@@ -1334,6 +1336,7 @@ open_file_hook_proc(HWND of_hwnd, UINT msg, WPARAM w_param, LPARAM l_param) {
HWND cur_ctrl, parent;
OFNOTIFY *notify = (OFNOTIFY *) l_param;
TCHAR sel_name[MAX_PATH];
+ gint i;
switch(msg) {
case WM_INITDIALOG:
@@ -1343,6 +1346,13 @@ open_file_hook_proc(HWND of_hwnd, UINT msg, WPARAM w_param, LPARAM l_param) {
SetWindowText(cur_ctrl, utf_8to16(g_dfilter_str));
}
+ cur_ctrl = GetDlgItem(of_hwnd, EWFD_FORMAT_TYPE);
+ SendMessage(cur_ctrl, CB_ADDSTRING, 0, (WPARAM) _T("Automatic"));
+ for (i = 0; open_routines[i].name != NULL; i += 1) {
+ SendMessage(cur_ctrl, CB_ADDSTRING, 0, (WPARAM) utf_8to16(open_routines[i].name));
+ }
+ SendMessage(cur_ctrl, CB_SETCURSEL, 0, 0);
+
/* Fill in our resolution values */
cur_ctrl = GetDlgItem(of_hwnd, EWFD_MAC_NR_CB);
SendMessage(cur_ctrl, BM_SETCHECK, gbl_resolv_flags.mac_name, 0);
@@ -1364,6 +1374,9 @@ open_file_hook_proc(HWND of_hwnd, UINT msg, WPARAM w_param, LPARAM l_param) {
g_free(g_dfilter_str);
g_dfilter_str = filter_tb_get(cur_ctrl);
+ cur_ctrl = GetDlgItem(of_hwnd, EWFD_FORMAT_TYPE);
+ g_format_type = SendMessage(cur_ctrl, CB_GETCURSEL, 0, 0);
+
/* Fetch our resolution values */
cur_ctrl = GetDlgItem(of_hwnd, EWFD_MAC_NR_CB);
if (SendMessage(cur_ctrl, BM_GETCHECK, 0, 0) == BST_CHECKED)
diff --git a/ui/win32/file_dlg_win32.h b/ui/win32/file_dlg_win32.h
index 14ce1def16..f26c1e6951 100644
--- a/ui/win32/file_dlg_win32.h
+++ b/ui/win32/file_dlg_win32.h
@@ -33,9 +33,10 @@ extern "C" {
*
* @param h_wnd HWND of the parent window.
* @param file_name File name
+ * @param type File type
* @param display_filter a display filter
*/
-gboolean win32_open_file (HWND h_wnd, GString *file_name, GString *display_filter);
+gboolean win32_open_file (HWND h_wnd, GString *file_name, unsigned int *type, GString *display_filter);
/** Verify that our proposed capture file format supports comments. If it can't
* ask the user what to do and return his or her response.
@@ -167,6 +168,8 @@ void file_set_save_marked_sensitive();
#define EWFD_PTX_FIRST_PKT 1014
#define EWFD_PTX_ELAPSED 1015
+#define EWFD_FORMAT_TYPE 1016
+
/* Save as and export dialog defines */
#define EWFD_GZIP_CB 1040