#if (wxUSE_HTML || wxUSE_FS_INET || wxUSE_FS_ZIP) && wxUSE_STREAMS
#include "wx/stream.h"
-#include "wx/mimetype.h"
#include "wx/url.h"
#include "wx/datetime.h"
wxString GetMimeTypeFromExt(const wxString& location);
// Returns MIME type of the file - w/o need to open it
// (default behaviour is that it returns type based on extension)
-
- public:
- static void CleanUpStatics();
- // deletes static members (m_MimeMng). It can be called
- // as many times as you wish because m_MimeMng is created
- // on demand
-
- private:
- static wxMimeTypesManager *m_MimeMng;
- // MIME manager
- // (it's static and thus shared by all instances and derived classes)
};
#include "wx/wfstream.h"
#include "wx/module.h"
#include "wx/filesys.h"
+#include "wx/mimetype.h"
+
+
+
//--------------------------------------------------------------------------------
// wxFileSystemHandler
IMPLEMENT_ABSTRACT_CLASS(wxFileSystemHandler, wxObject)
-wxMimeTypesManager *wxFileSystemHandler::m_MimeMng = NULL;
-
-void wxFileSystemHandler::CleanUpStatics()
-{
- if (m_MimeMng) delete m_MimeMng;
- m_MimeMng = NULL;
-}
-
wxString wxFileSystemHandler::GetMimeTypeFromExt(const wxString& location)
{
if ((c == wxT('/')) || (c == wxT('\\')) || (c == wxT(':'))) {return wxEmptyString;}
}
- if (m_MimeMng == NULL) {
- m_MimeMng = new wxMimeTypesManager;
-
+ static bool s_MinimalMimeEnsured = FALSE;
+ if (!s_MinimalMimeEnsured) {
static const wxFileTypeInfo fallbacks[] =
{
wxFileTypeInfo("image/jpeg",
wxFileTypeInfo()
};
- m_MimeMng -> AddFallbacks(fallbacks);
+ wxTheMimeTypesManager -> AddFallbacks(fallbacks);
}
- ft = m_MimeMng -> GetFileTypeFromExtension(ext);
+ ft = wxTheMimeTypesManager -> GetFileTypeFromExtension(ext);
if (ft && (ft -> GetMimeType(&mime))) {
delete ft;
return mime;
}
virtual void OnExit()
{
- wxFileSystemHandler::CleanUpStatics();
wxFileSystem::CleanUpHandlers();
}
};
protected:
wxImageList m_ImageList;
wxHashTable m_HashTable;
- wxMimeTypesManager m_Mime;
};
static wxFileIconsTable *g_IconsTable = NULL;
wxFileIconsTable::wxFileIconsTable() :
m_ImageList(16, 16),
- m_HashTable(wxKEY_STRING),
- m_Mime()
+ m_HashTable(wxKEY_STRING)
{
m_HashTable.DeleteContents(TRUE);
m_ImageList.Add(wxBitmap(folder_xpm)); // FI_FOLDER
}
wxFileType *ft = (mime.IsEmpty()) ?
- m_Mime.GetFileTypeFromExtension(extension) :
- m_Mime.GetFileTypeFromMimeType(mime);
+ wxTheMimeTypesManager -> GetFileTypeFromExtension(extension) :
+ wxTheMimeTypesManager -> GetFileTypeFromMimeType(mime);
wxIcon ic;
if (ft == NULL || (!ft -> GetIcon(&ic)))
{