wxMimeTypeManager::EnumAll() seems to work, couple of minor corrections to the MIME code
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@4858 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -82,7 +82,8 @@ static void TestMimeEnum()
|
||||
extsAll += exts[e];
|
||||
}
|
||||
|
||||
printf("\t%s: %s (%s)\n", mimetypes[n], desc, extsAll);
|
||||
printf("\t%s: %s (%s)\n",
|
||||
mimetypes[n].c_str(), desc.c_str(), extsAll.c_str());
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -1401,8 +1401,8 @@ bool wxMimeTypesManagerImpl::ReadMimeTypes(const wxString& strFileName)
|
||||
while ( wxIsspace(*pc) )
|
||||
pc++;
|
||||
|
||||
// comment?
|
||||
if ( *pc == wxT('#') ) {
|
||||
// comment or blank line?
|
||||
if ( *pc == wxT('#') || !*pc ) {
|
||||
// skip the whole line
|
||||
pc = NULL;
|
||||
continue;
|
||||
@@ -1681,16 +1681,21 @@ bool wxMimeTypesManagerImpl::ReadMailcap(const wxString& strFileName,
|
||||
|
||||
if ( !ok )
|
||||
{
|
||||
// don't flood the user with error messages
|
||||
// if we don't understand something in his
|
||||
// mailcap, but give them in debug mode
|
||||
// because this might be useful for the
|
||||
// programmer
|
||||
// we don't understand this field, but
|
||||
// Netscape stores info in it, so don't warn
|
||||
// about it
|
||||
if ( curField.Left(16u) != "x-mozilla-flags=" )
|
||||
{
|
||||
// don't flood the user with error
|
||||
// messages if we don't understand
|
||||
// something in his mailcap, but give
|
||||
// them in debug mode because this might
|
||||
// be useful for the programmer
|
||||
wxLogDebug
|
||||
(
|
||||
wxT("Mailcap file %s, line %d: unknown "
|
||||
"field '%s' for the MIME type "
|
||||
"'%s' ignored."),
|
||||
wxT("Mailcap file %s, line %d: "
|
||||
"unknown field '%s' for the "
|
||||
"MIME type '%s' ignored."),
|
||||
strFileName.c_str(),
|
||||
nLine + 1,
|
||||
curField.c_str(),
|
||||
@@ -1698,6 +1703,7 @@ bool wxMimeTypesManagerImpl::ReadMailcap(const wxString& strFileName,
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// it already has this value
|
||||
//currentToken = Field_Other;
|
||||
@@ -1801,9 +1807,21 @@ bool wxMimeTypesManagerImpl::ReadMailcap(const wxString& strFileName,
|
||||
|
||||
size_t wxMimeTypesManagerImpl::EnumAllFileTypes(wxArrayString& mimetypes)
|
||||
{
|
||||
mimetypes = m_aTypes;
|
||||
mimetypes.Empty();
|
||||
|
||||
return m_aTypes.GetCount();
|
||||
wxString type;
|
||||
size_t count = m_aTypes.GetCount();
|
||||
for ( size_t n = 0; n < count; n++ )
|
||||
{
|
||||
// don't return template types from here (i.e. anything containg '*')
|
||||
type = m_aTypes[n];
|
||||
if ( type.Find(_T('*')) == wxNOT_FOUND )
|
||||
{
|
||||
mimetypes.Add(type);
|
||||
}
|
||||
}
|
||||
|
||||
return mimetypes.GetCount();
|
||||
}
|
||||
|
||||
#endif
|
||||
|
Reference in New Issue
Block a user