diff options
-rw-r--r-- | ui/Makefile.common | 1 | ||||
-rw-r--r-- | ui/all_files_wildcard.h | 54 | ||||
-rw-r--r-- | ui/qt/capture_file_dialog.cpp | 16 | ||||
-rw-r--r-- | ui/qt/extcap_argument_file.cpp | 4 | ||||
-rw-r--r-- | ui/qt/main_window_slots.cpp | 5 | ||||
-rw-r--r-- | ui/win32/file_dlg_win32.c | 25 |
6 files changed, 80 insertions, 25 deletions
diff --git a/ui/Makefile.common b/ui/Makefile.common index 87d9040d94..05f738f41b 100644 --- a/ui/Makefile.common +++ b/ui/Makefile.common @@ -83,6 +83,7 @@ WIRESHARK_UI_SRC = \ noinst_HEADERS = \ alert_box.h \ + all_files_wildcard.h \ capture.h \ capture_globals.h \ capture_ui_utils.h \ diff --git a/ui/all_files_wildcard.h b/ui/all_files_wildcard.h new file mode 100644 index 0000000000..184b8dca6a --- /dev/null +++ b/ui/all_files_wildcard.h @@ -0,0 +1,54 @@ +/* all_files_wildcard.h + * Definition of a macro for the file wildcard pattern that matches + * all files + * + * Wireshark - Network traffic analyzer + * By Gerald Combs <gerald@wireshark.org> + * Copyright 1998 Gerald Combs + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ + +#ifndef __ALL_FILES_WILDCARD_H__ +#define __ALL_FILES_WILDCARD_H__ + +#ifdef _WIN32 +/* + * On Windows, the wildcard for matching all files is "*.*", which + * even matches files with no extension. + */ +#define ALL_FILES_WILDCARD "*.*" +#else +/* + * On UN*X, the wildcard for matching all files is "*"; "*.*" only + * matches files with at least one extension. + */ +#define ALL_FILES_WILDCARD "*" +#endif + +#endif /* __ALL_FILES_WILDCARD_H__ */ + +/* + * Editor modelines + * + * Local Variables: + * c-basic-offset: 4 + * tab-width: 8 + * indent-tabs-mode: nil + * End: + * + * ex: set shiftwidth=4 tabstop=8 expandtab: + * :indentSize=4:tabSize=8:noTabs=true: + */ diff --git a/ui/qt/capture_file_dialog.cpp b/ui/qt/capture_file_dialog.cpp index 6bf27fcd03..3b659557f8 100644 --- a/ui/qt/capture_file_dialog.cpp +++ b/ui/qt/capture_file_dialog.cpp @@ -36,6 +36,7 @@ #include "../../epan/prefs.h" #include "../../wsutil/filesystem.h" #include "../../wsutil/nstime.h" +#include "ui/all_files_wildcard.h" #include <wireshark_application.h> @@ -344,11 +345,11 @@ QString CaptureFileDialog::fileType(int ft, bool extension_globs) extensions_list = wtap_get_file_extensions_list(ft, TRUE); if (extensions_list == NULL) { /* This file type doesn't have any particular extension - conventionally used for it, so we'll just use "*" - as the pattern, as this is UN*X, where "*.*" only - matches files that have an extension. (On Windows, - it matches all files, but this isn't Windows.) */ - filter += "*"; + conventionally used for it, so we'll just use a + wildcard that matches all file names - even those + with no extension, so we don't need to worry about + compressed file extensions. */ + filter += ALL_FILES_WILDCARD; } else { GSList *extension; /* Construct the list of patterns. */ @@ -388,10 +389,7 @@ QStringList CaptureFileDialog::buildFileOpenTypeList() { * the filter will be a bit long, so it *really* shouldn't be shown. * What about other platforms? */ - /* - * Add the "All Files" entry. As per the above, we use *, not *.*. - */ - filters << QString(tr("All Files (*)")); + filters << QString(tr("All Files (" ALL_FILES_WILDCARD ")")); /* * Add an "All Capture Files" entry, with all the extensions we diff --git a/ui/qt/extcap_argument_file.cpp b/ui/qt/extcap_argument_file.cpp index 3c99ae05cc..5e538036bb 100644 --- a/ui/qt/extcap_argument_file.cpp +++ b/ui/qt/extcap_argument_file.cpp @@ -38,6 +38,8 @@ #include <epan/prefs.h> #include <color_utils.h> +#include <ui/all_files_wildcard.h> + #include <extcap_parser.h> ExtcapArgumentFileSelection::ExtcapArgumentFileSelection (extcap_arg * argument) : @@ -107,7 +109,7 @@ void ExtcapArgumentFileSelection::openFileDialog() if (QFileInfo(filename).exists()) workingDir = QFileInfo(filename).dir(); - QString fileExt(tr("Any File (*.*)")); + QString fileExt(tr("All Files (" ALL_FILES_WILDCARD ")")); if ( _argument->fileextension != NULL ) { QString givenExt = QString().fromUtf8(_argument->fileextension); diff --git a/ui/qt/main_window_slots.cpp b/ui/qt/main_window_slots.cpp index 134fb8444d..66770d8b0b 100644 --- a/ui/qt/main_window_slots.cpp +++ b/ui/qt/main_window_slots.cpp @@ -70,6 +70,7 @@ #include "ui/recent_utils.h" #include "ui/ssl_key_export.h" #include "ui/ui_util.h" +#include "ui/all_files_wildcard.h" #include "ui/qt/simple_dialog.h" #ifdef HAVE_SOFTWARE_UPDATE @@ -1731,7 +1732,7 @@ void MainWindow::on_actionFileExportPacketBytes_triggered() file_name = QFileDialog::getSaveFileName(this, wsApp->windowTitleString(tr("Export Selected Packet Bytes")), wsApp->lastOpenDir().canonicalPath(), - tr("Raw data (*.bin *.dat *.raw);;Any File (*.*)") + tr("Raw data (*.bin *.dat *.raw);;All Files (" ALL_FILES_WILDCARD ")") ); if (file_name.length() > 0) { @@ -1806,7 +1807,7 @@ void MainWindow::on_actionFileExportSSLSessionKeys_triggered() file_name = QFileDialog::getSaveFileName(this, save_title, wsApp->lastOpenDir().canonicalPath(), - tr("SSL Session Keys (*.keys *.txt);;Any File (*.*)") + tr("SSL Session Keys (*.keys *.txt);;All Files (" ALL_FILES_WILDCARD ")") ); if (file_name.length() > 0) { gchar *keylist; diff --git a/ui/win32/file_dlg_win32.c b/ui/win32/file_dlg_win32.c index 3b8c0614df..b7630dfd14 100644 --- a/ui/win32/file_dlg_win32.c +++ b/ui/win32/file_dlg_win32.c @@ -50,6 +50,7 @@ #include "ui/ssl_key_export.h" #include "ui/util.h" #include "ui/ui_util.h" +#include "ui/all_files_wildcard.h" #include "file_dlg_win32.h" @@ -67,19 +68,19 @@ #define FILE_TYPES_RAW \ _T("Raw data (*.bin, *.dat, *.raw)\0") _T("*.bin;*.dat;*.raw\0") \ - _T("All Files (*.*)\0") _T("*.*\0") + _T("All Files (") _T(ALL_FILES_WILDCARD) _T(")\0") _T(ALL_FILES_WILDCARD) _T("\0") #define FILE_RAW_DEFAULT 1 #define FILE_TYPES_SSLKEYS \ _T("SSL Session Keys (*.keys)\0") _T("*.keys\0") \ - _T("All Files (*.*)\0") _T("*.*\0") + _T("All Files (") _T(ALL_FILES_WILDCARD) _T(")\0") _T(ALL_FILES_WILDCARD) _T("\0") #define FILE_SSLKEYS_DEFAULT 1 #define FILE_TYPES_COLOR \ _T("Text Files (*.txt)\0") _T("*.txt\0") \ - _T("All Files (*.*)\0") _T("*.*\0") + _T("All Files (") _T(ALL_FILES_WILDCARD) _T(")\0") _T(ALL_FILES_WILDCARD) _T("\0") #define FILE_DEFAULT_COLOR 2 @@ -1501,8 +1502,8 @@ build_file_open_type_list(void) { str16 = utf_8to16("All Files"); sa = g_array_append_vals(sa, str16, (guint) strlen("All Files")); sa = g_array_append_val(sa, zero); - str16 = utf_8to16("*.*"); - sa = g_array_append_vals(sa, str16, (guint) strlen("*.*")); + str16 = utf_8to16(ALL_FILES_WILDCARD); + sa = g_array_append_vals(sa, str16, (guint) strlen(ALL_FILES_WILDCARD)); sa = g_array_append_val(sa, zero); /* @@ -1570,13 +1571,11 @@ append_file_type(GArray *sa, int ft) extensions_list = wtap_get_file_extensions_list(ft, TRUE); if (extensions_list == NULL) { /* This file type doesn't have any particular extension - conventionally used for it, so we'll just use "*.*" - as the pattern; on Windows, that matches all file names - - even those with no extension - so we don't need to - worry about compressed file extensions. (It does not - do so on UN*X; the right pattern on UN*X would just - be "*".) */ - g_string_printf(pattern_str, "*.*"); + conventionally used for it, so we'll just use a + wildcard that matches all file names - even those with + no extension, so we don't need to worry about compressed + file extensions. */ + g_string_printf(pattern_str, ALL_FILES_WILDCARD); } else { /* Construct the list of patterns. */ g_string_printf(pattern_str, ""); @@ -1657,7 +1656,7 @@ build_file_format_list(HWND sf_hwnd) { if(wtap_file_extensions_string(ft) != NULL) { s = g_strdup_printf("%s (%s)", wtap_file_type_string(ft), wtap_file_extensions_string(ft)); } else { - s = g_strdup_printf("%s (*.*)", wtap_file_type_string(ft)); + s = g_strdup_printf("%s (" ALL_FILES_WILDCARD ")", wtap_file_type_string(ft)); } SendMessage(format_cb, CB_ADDSTRING, 0, (LPARAM) utf_8to16(s)); g_free(s); |