diff options
author | Gerald Combs <gerald@wireshark.org> | 2019-12-09 15:18:06 -0800 |
---|---|---|
committer | Gerald Combs <gerald@wireshark.org> | 2019-12-11 20:14:11 +0000 |
commit | 932a1a4ddfe3c75270a5ecc7af47ea4cf32d54e2 (patch) | |
tree | cdbcad30d0850f24b51bbce4dae7de565fa042de | |
parent | 69c096955194167b08bfc5b5197e86baac1b10f7 (diff) | |
download | wireshark-932a1a4ddfe3c75270a5ecc7af47ea4cf32d54e2.tar.gz wireshark-932a1a4ddfe3c75270a5ecc7af47ea4cf32d54e2.tar.bz2 wireshark-932a1a4ddfe3c75270a5ecc7af47ea4cf32d54e2.zip |
Win32: Fixup our file dialog titles.
Add a "title" argument to each of the Win32 file dialog routines, and
pass in one constructed using wsApp->windowTitleString.
Change-Id: I5ff862bd28cd16093d99ae1559ecbaca907350da
Reviewed-on: https://code.wireshark.org/review/35383
Reviewed-by: Gerald Combs <gerald@wireshark.org>
Petri-Dish: Gerald Combs <gerald@wireshark.org>
Tested-by: Petri Dish Buildbot
Reviewed-by: Michael Mann <mmann78@netscape.net>
(cherry picked from commit dc19356be2bc30f6abf8aa0dee1ef630224dd35b)
Reviewed-on: https://code.wireshark.org/review/35412
-rw-r--r-- | ui/qt/capture_file_dialog.cpp | 13 | ||||
-rw-r--r-- | ui/qt/export_dissection_dialog.cpp | 4 | ||||
-rw-r--r-- | ui/win32/file_dlg_win32.c | 21 | ||||
-rw-r--r-- | ui/win32/file_dlg_win32.h | 9 |
4 files changed, 27 insertions, 20 deletions
diff --git a/ui/qt/capture_file_dialog.cpp b/ui/qt/capture_file_dialog.cpp index 6bdc06e5c8..0d5e6556ad 100644 --- a/ui/qt/capture_file_dialog.cpp +++ b/ui/qt/capture_file_dialog.cpp @@ -261,12 +261,13 @@ wtap_compression_type CaptureFileDialog::compressionType() { } int CaptureFileDialog::open(QString &file_name, unsigned int &type) { + QString title_str = wsApp->windowTitleString(tr("Open Capture 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, &type, dfilter); + wof_status = win32_open_file((HWND)parentWidget()->effectiveWinId(), title_str.toStdWString().c_str(), fname, &type, dfilter); file_name = fname->str; display_filter_ = dfilter->str; @@ -277,10 +278,11 @@ int CaptureFileDialog::open(QString &file_name, unsigned int &type) { } check_savability_t CaptureFileDialog::saveAs(QString &file_name, bool must_support_all_comments) { + QString title_str = wsApp->windowTitleString(tr("Save Capture File As")); GString *fname = g_string_new(file_name.toUtf8().constData()); gboolean wsf_status; - wsf_status = win32_save_as_file((HWND)parentWidget()->effectiveWinId(), cap_file_, fname, &file_type_, &compression_type_, must_support_all_comments); + wsf_status = win32_save_as_file((HWND)parentWidget()->effectiveWinId(), title_str.toStdWString().c_str(), cap_file_, fname, &file_type_, &compression_type_, must_support_all_comments); file_name = fname->str; g_string_free(fname, TRUE); @@ -293,6 +295,7 @@ check_savability_t CaptureFileDialog::saveAs(QString &file_name, bool must_suppo } check_savability_t CaptureFileDialog::exportSelectedPackets(QString &file_name, packet_range_t *range, QString selRange) { + QString title_str = wsApp->windowTitleString(tr("Export Specified Packets")); GString *fname = g_string_new(file_name.toUtf8().constData()); gboolean wespf_status; @@ -301,7 +304,7 @@ check_savability_t CaptureFileDialog::exportSelectedPackets(QString &file_name, packet_range_convert_selection_str(range, selRange.toUtf8().constData()); } - wespf_status = win32_export_specified_packets_file((HWND)parentWidget()->effectiveWinId(), cap_file_, fname, &file_type_, &compression_type_, range); + wespf_status = win32_export_specified_packets_file((HWND)parentWidget()->effectiveWinId(), title_str.toStdWString().c_str(), cap_file_, fname, &file_type_, &compression_type_, range); file_name = fname->str; g_string_free(fname, TRUE); @@ -314,11 +317,13 @@ check_savability_t CaptureFileDialog::exportSelectedPackets(QString &file_name, } int CaptureFileDialog::merge(QString &file_name) { + QString title_str = wsApp->windowTitleString(tr("Merge Capture File")); GString *fname = g_string_new(file_name.toUtf8().constData()); GString *dfilter = g_string_new(display_filter_.toUtf8().constData()); gboolean wmf_status; - wmf_status = win32_merge_file((HWND)parentWidget()->effectiveWinId(), fname, dfilter, &merge_type_); + + wmf_status = win32_merge_file((HWND)parentWidget()->effectiveWinId(), title_str.toStdWString().c_str(), fname, dfilter, &merge_type_); file_name = fname->str; display_filter_ = dfilter->str; diff --git a/ui/qt/export_dissection_dialog.cpp b/ui/qt/export_dissection_dialog.cpp index 507d4c75e5..ee9c4797bd 100644 --- a/ui/qt/export_dissection_dialog.cpp +++ b/ui/qt/export_dissection_dialog.cpp @@ -54,6 +54,7 @@ ExportDissectionDialog::ExportDissectionDialog(QWidget *parent, capture_file *ca , save_bt_(NULL) #endif /* Q_OS_WIN */ { + setWindowTitle(wsApp->windowTitleString(tr("Export Packet Dissections"))); switch (prefs.gui_fileopen_style) { @@ -87,7 +88,6 @@ ExportDissectionDialog::ExportDissectionDialog(QWidget *parent, capture_file *ca QStringList name_filters; int last_row; - setWindowTitle(wsApp->windowTitleString(tr("Export Packet Dissections"))); setAcceptMode(QFileDialog::AcceptSave); setLabelText(FileType, tr("Export As:")); @@ -162,7 +162,7 @@ void ExportDissectionDialog::show() QFileDialog::show(); } #else // Q_OS_WIN - win32_export_file((HWND)parentWidget()->effectiveWinId(), cap_file_, export_type_); + win32_export_file((HWND)parentWidget()->effectiveWinId(), windowTitle().toStdWString().c_str(), cap_file_, export_type_); #endif // Q_OS_WIN } diff --git a/ui/win32/file_dlg_win32.c b/ui/win32/file_dlg_win32.c index ae383d8206..4bb2f4a9d3 100644 --- a/ui/win32/file_dlg_win32.c +++ b/ui/win32/file_dlg_win32.c @@ -161,7 +161,7 @@ static unsigned int g_format_type = WTAP_TYPE_AUTO; */ gboolean -win32_open_file (HWND h_wnd, GString *file_name, unsigned int *type, GString *display_filter) { +win32_open_file (HWND h_wnd, const wchar_t *title, GString *file_name, unsigned int *type, GString *display_filter) { OPENFILENAME *ofn; TCHAR file_name16[MAX_PATH] = _T(""); int ofnsize = sizeof(OPENFILENAME); @@ -199,7 +199,7 @@ win32_open_file (HWND h_wnd, GString *file_name, unsigned int *type, GString *di } else { ofn->lpstrInitialDir = utf_8to16(get_last_open_dir()); } - ofn->lpstrTitle = _T("Wireshark: Open Capture File"); + ofn->lpstrTitle = title; ofn->Flags = OFN_ENABLESIZING | OFN_ENABLETEMPLATE | OFN_EXPLORER | OFN_NOCHANGEDIR | OFN_FILEMUSTEXIST | OFN_HIDEREADONLY | OFN_ENABLEHOOK | OFN_SHOWHELP; @@ -314,7 +314,7 @@ win32_check_save_as_with_comments(HWND parent, capture_file *cf, int file_type) } gboolean -win32_save_as_file(HWND h_wnd, capture_file *cf, GString *file_name, int *file_type, +win32_save_as_file(HWND h_wnd, const wchar_t *title, capture_file *cf, GString *file_name, int *file_type, wtap_compression_type *compression_type, gboolean must_support_all_comments) { @@ -359,7 +359,7 @@ win32_save_as_file(HWND h_wnd, capture_file *cf, GString *file_name, int *file_t ofn->lpstrFileTitle = NULL; ofn->nMaxFileTitle = 0; ofn->lpstrInitialDir = utf_8to16(get_last_open_dir()); - ofn->lpstrTitle = _T("Wireshark: Save file as"); + ofn->lpstrTitle = title; ofn->Flags = OFN_ENABLESIZING | OFN_ENABLETEMPLATE | OFN_EXPLORER | OFN_NOCHANGEDIR | OFN_OVERWRITEPROMPT | OFN_HIDEREADONLY | OFN_PATHMUSTEXIST | OFN_ENABLEHOOK | OFN_SHOWHELP; @@ -449,7 +449,8 @@ gboolean win32_save_as_statstree(HWND h_wnd, GString *file_name, int *file_type) gboolean -win32_export_specified_packets_file(HWND h_wnd, capture_file *cf, +win32_export_specified_packets_file(HWND h_wnd, const wchar_t *title, + capture_file *cf, GString *file_name, int *file_type, wtap_compression_type *compression_type, @@ -490,7 +491,7 @@ win32_export_specified_packets_file(HWND h_wnd, capture_file *cf, ofn->lpstrFileTitle = NULL; ofn->nMaxFileTitle = 0; ofn->lpstrInitialDir = utf_8to16(get_last_open_dir()); - ofn->lpstrTitle = _T("Wireshark: Export Specified Packets"); + ofn->lpstrTitle = title; ofn->Flags = OFN_ENABLESIZING | OFN_ENABLETEMPLATE | OFN_EXPLORER | OFN_NOCHANGEDIR | OFN_OVERWRITEPROMPT | OFN_HIDEREADONLY | OFN_PATHMUSTEXIST | OFN_ENABLEHOOK | OFN_SHOWHELP; @@ -531,7 +532,7 @@ win32_export_specified_packets_file(HWND h_wnd, capture_file *cf, gboolean -win32_merge_file (HWND h_wnd, GString *file_name, GString *display_filter, int *merge_type) { +win32_merge_file (HWND h_wnd, const wchar_t *title, GString *file_name, GString *display_filter, int *merge_type) { OPENFILENAME *ofn; TCHAR file_name16[MAX_PATH] = _T(""); int ofnsize = sizeof(OPENFILENAME); @@ -569,7 +570,7 @@ win32_merge_file (HWND h_wnd, GString *file_name, GString *display_filter, int * } else { ofn->lpstrInitialDir = utf_8to16(get_last_open_dir()); } - ofn->lpstrTitle = _T("Wireshark: Merge with capture file"); + ofn->lpstrTitle = title; ofn->Flags = OFN_ENABLESIZING | OFN_ENABLETEMPLATE | OFN_EXPLORER | OFN_NOCHANGEDIR | OFN_FILEMUSTEXIST | OFN_HIDEREADONLY | OFN_ENABLEHOOK | OFN_SHOWHELP; @@ -608,7 +609,7 @@ win32_merge_file (HWND h_wnd, GString *file_name, GString *display_filter, int * } void -win32_export_file(HWND h_wnd, 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) { OPENFILENAME *ofn; TCHAR file_name[MAX_PATH] = _T(""); char *dirname; @@ -631,7 +632,7 @@ win32_export_file(HWND h_wnd, capture_file *cf, export_type_e export_type) { ofn->lpstrFileTitle = NULL; ofn->nMaxFileTitle = 0; ofn->lpstrInitialDir = utf_8to16(get_last_open_dir()); - ofn->lpstrTitle = _T("Wireshark: Export Packet Dissections"); + ofn->lpstrTitle = title; ofn->Flags = OFN_ENABLESIZING | OFN_ENABLETEMPLATE | OFN_EXPLORER | OFN_NOCHANGEDIR | OFN_OVERWRITEPROMPT | OFN_HIDEREADONLY | OFN_PATHMUSTEXIST | OFN_ENABLEHOOK | OFN_SHOWHELP; diff --git a/ui/win32/file_dlg_win32.h b/ui/win32/file_dlg_win32.h index e80c944de5..971cf11bd8 100644 --- a/ui/win32/file_dlg_win32.h +++ b/ui/win32/file_dlg_win32.h @@ -48,7 +48,7 @@ void revert_thread_per_monitor_v2_awareness(HANDLE context); * @param type File type * @param display_filter a display filter */ -gboolean win32_open_file (HWND h_wnd, GString *file_name, unsigned int *type, GString *display_filter); +gboolean win32_open_file (HWND h_wnd, const wchar_t *title, 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. @@ -73,7 +73,7 @@ check_savability_t win32_check_save_as_with_comments(HWND parent, capture_file * * * @return TRUE if packets were discarded when saving, FALSE otherwise */ -gboolean win32_save_as_file(HWND h_wnd, capture_file *cf, +gboolean win32_save_as_file(HWND h_wnd, const wchar_t *title, capture_file *cf, GString *file_name, int *file_type, wtap_compression_type *compression_type, gboolean must_support_comments); @@ -90,6 +90,7 @@ gboolean win32_save_as_file(HWND h_wnd, capture_file *cf, * @return TRUE if packets were discarded when saving, FALSE otherwise */ gboolean win32_export_specified_packets_file(HWND h_wnd, + const wchar_t *title, capture_file *cf, GString *file_name, int *file_type, @@ -104,7 +105,7 @@ gboolean win32_export_specified_packets_file(HWND h_wnd, * @param display_filter a display filter * @param merge_type type of merge */ -gboolean win32_merge_file (HWND h_wnd, GString *file_name, GString *display_filter, int *merge_type); +gboolean win32_merge_file (HWND h_wnd, const wchar_t *title, GString *file_name, GString *display_filter, int *merge_type); /** Open the "Export" dialog box. * @@ -112,7 +113,7 @@ gboolean win32_merge_file (HWND h_wnd, GString *file_name, GString *display_filt * @param cf capture_file Structure for the capture to be saved * @param export_type The export type. */ -void win32_export_file (HWND h_wnd, 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); /** Open the "Save As" dialog box for stats_tree statistics window. * |