// Created: 23.09.98
// RCS-ID: $Id$
// Copyright: (c) 1998 Vadim Zeitlin <zeitlin@dptmaths.ens-cachan.fr>
-// Licence: wxWindows license (part of wxExtra library)
+// Licence: wxWindows licence (part of wxExtra library)
/////////////////////////////////////////////////////////////////////////////
// known bugs; there may be others!! chris elliott, biol75@york.ac.uk 27 Mar 01
#include "wx/dir.h"
#include "wx/utils.h"
#include "wx/tokenzr.h"
+#include "wx/iconloc.h"
#include "wx/unix/mimetype.h"
return wxFileType::ExpandCommand(sTmp, params);
}
-bool wxFileTypeImpl::GetIcon(wxIcon *icon,
- wxString *iconFile /*= NULL */,
- int *iconIndex /*= NULL*/) const
+bool wxFileTypeImpl::GetIcon(wxIconLocation *iconLoc) const
{
-#if wxUSE_GUI
wxString sTmp;
size_t i = 0;
while ( (i < m_index.GetCount() ) && sTmp.empty() )
sTmp = m_manager->m_aIcons[m_index[i]];
i ++;
}
- if ( sTmp.empty () ) return FALSE;
-
- wxIcon icn;
-
- if (sTmp.Right(4).MakeUpper() == _T(".XPM"))
- icn = wxIcon(sTmp);
- else
- icn = wxIcon(sTmp, wxBITMAP_TYPE_ANY);
+ if ( sTmp.empty () )
+ return FALSE;
- if ( icn.Ok() )
+ if ( iconLoc )
{
- *icon = icn;
- if (iconFile) *iconFile = sTmp;
- if (iconIndex) *iconIndex = 0;
- return TRUE;
+ iconLoc->SetFileName(sTmp);
}
-#endif // wxUSE_GUI
- return FALSE;
+ return TRUE;
}
m_aEntries.Add(entry ? entry : new wxMimeTypeCommands);
// change nIndex so we can use it below to add the extensions
- nIndex = m_aExtensions.Add(wxEmptyString);
+ m_aExtensions.Add(wxEmptyString);
+ nIndex = m_aExtensions.size();
m_aDescriptions.Add(strDesc);
}
entryOld->AddOrReplaceVerb(verb, entry->GetCmd(i));
}
}
+
+ // as we don't store it anywhere, it won't be deleted later as
+ // usual -- do it immediately instead
+ delete entry;
}
}
}
else if ( strLHS == wxT("exts") ) {
strExtensions = strRHS;
}
- else {
+ else if ( strLHS != _T("icon") )
+ {
// this one is simply ignored: it usually refers to Netscape
// built in icons which are useless for us anyhow
- if ( strLHS != _T("icon") )
- {
- wxLogWarning(_("Unknown field in file %s, line %d: '%s'."),
- strFileName.c_str(), nLine + 1, strLHS.c_str());
- }
+ }
+ else if ( !strLHS.StartsWith(_T("x-")) )
+ {
+ // we suppose that all fields starting with "X-" are
+ // unregistered extensions according to the standard practice,
+ // but it may be worth telling the user about other junk in
+ // his mime.types file
+ wxLogWarning(_("Unknown field in file %s, line %d: '%s'."),
+ strFileName.c_str(), nLine + 1, strLHS.c_str());
}
if ( !entryEnded ) {