]> git.saurik.com Git - wxWidgets.git/blobdiff - src/common/filesys.cpp
better control of what need refresh.
[wxWidgets.git] / src / common / filesys.cpp
index da3b6342f1274e8269018226d010da02f2845cb6..5935588b9ef963d44143dabba30fc7edaa35e183 100644 (file)
@@ -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;