From 956418ab763b5397804c70f7fcea34d9ea442caa Mon Sep 17 00:00:00 2001 From: =?utf8?q?V=C3=A1clav=20Slav=C3=ADk?= Date: Sun, 8 Aug 1999 22:28:48 +0000 Subject: [PATCH 1/1] added MIME manager fallback support git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@3322 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- src/common/filesys.cpp | 40 +++++++++++++++++++++++++++++++++++++++- 1 file changed, 39 insertions(+), 1 deletion(-) diff --git a/src/common/filesys.cpp b/src/common/filesys.cpp index da3b6342f1..5935588b9e 100644 --- a/src/common/filesys.cpp +++ b/src/common/filesys.cpp @@ -57,7 +57,45 @@ wxString wxFileSystemHandler::GetMimeTypeFromExt(const wxString& location) if (c == _T('.')) {ext = loc.Right(l2-i-1); break;} if ((c == _T('/')) || (c == _T('\\')) || (c == _T(':'))) {return wxEmptyString;} } - if (m_MimeMng == NULL) m_MimeMng = new wxMimeTypesManager; + + if (m_MimeMng == NULL) { + m_MimeMng = new wxMimeTypesManager; + + static const wxFileTypeInfo fallbacks[] = + { + wxFileTypeInfo("image/jpeg", + "", + "", + "JPEG image (from fallback)", + "jpg", "jpeg", NULL), + wxFileTypeInfo("image/gif", + "", + "", + "GIF image (from fallback)", + "gif", NULL), + wxFileTypeInfo("image/png", + "", + "", + "PNG image (from fallback)", + "png", NULL), + wxFileTypeInfo("image/bmp", + "", + "", + "windows bitmap image (from fallback)", + "bmp", NULL), + wxFileTypeInfo("text/html", + "", + "", + "HTML document (from fallback)", + "htm", "html", NULL), + + // must terminate the table with this! + wxFileTypeInfo() + }; + + m_MimeMng -> AddFallbacks(fallbacks); + } + ft = m_MimeMng -> GetFileTypeFromExtension(ext); if (ft && (ft -> GetMimeType(&mime))) return mime; else return wxEmptyString; -- 2.45.2