Pseudo-sort MIME types (all application/xxx at the end) so that other types are found first

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@58354 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Robert Roebling
2009-01-24 14:10:55 +00:00
parent d6dae1b443
commit 98359ac7b5

View File

@@ -268,11 +268,6 @@ void wxMimeTypesManagerImpl::LoadXDGGlobs(const wxString& filename)
wxArrayString exts;
exts.Add( ext );
// The glob files have two kinds of associations: those, which
// link an extension to a file type (text/html) and those
// which link it to an application type (application/x-mozilla).
// We need the former.
if (mime.Find( "application" ) != 0)
AddToMimeData(mime, wxEmptyString, NULL, exts, wxEmptyString, true );
}
}
@@ -722,6 +717,11 @@ int wxMimeTypesManagerImpl::AddToMimeData(const wxString& strType,
// is this a known MIME type?
int nIndex = m_aTypes.Index(mimeType);
if ( nIndex == wxNOT_FOUND )
{
// We put MIME types containing "application" at the end, so that
// if the MIME type for the extention "htm" is searched for, it will
// rather find "text/html" than "application/x-mozilla-bookmarks".
if (mimeType.Find( "application" ) == 0)
{
// new file type
m_aTypes.Add(mimeType);
@@ -734,6 +734,20 @@ int wxMimeTypesManagerImpl::AddToMimeData(const wxString& strType,
m_aDescriptions.Add(strDesc);
}
else
{
// new file type
m_aTypes.Insert(mimeType,0);
m_aIcons.Insert(strIcon,0);
m_aEntries.Insert(entry ? entry : new wxMimeTypeCommands,0);
// change nIndex so we can use it below to add the extensions
m_aExtensions.Insert(wxEmptyString,0);
nIndex = 0;
m_aDescriptions.Insert(strDesc,0);
}
}
else // yes, we already have it
{
if ( replaceExisting )