-// ============================================================================
-// declarations
-// ============================================================================
-
-// ----------------------------------------------------------------------------
-// headers
-// ----------------------------------------------------------------------------
-
bool GetDescription(wxString *desc) const;
bool GetOpenCommand(wxString *openCmd,
const wxFileType::MessageParameters&) const
bool GetDescription(wxString *desc) const;
bool GetOpenCommand(wxString *openCmd,
const wxFileType::MessageParameters&) const
bool GetPrintCommand(wxString *printCmd,
const wxFileType::MessageParameters&) const
bool GetPrintCommand(wxString *printCmd,
const wxFileType::MessageParameters&) const
- bool ReadMailcap(const wxString& filename, bool fallback = TRUE) { }
- bool ReadMimeTypes(const wxString& filename) { }
+ bool ReadMailcap(const wxString& filename, bool fallback = TRUE)
+ { return TRUE; }
+ bool ReadMimeTypes(const wxString& filename)
+ { return TRUE; }
// '%s' expands into file name (quoted because it might
// contain spaces) - except if there are already quotes
// there because otherwise some programs may get confused
// by double double quotes
#if 0
// '%s' expands into file name (quoted because it might
// contain spaces) - except if there are already quotes
// there because otherwise some programs may get confused
// by double double quotes
#if 0
// TODO %n is the number of parts, %F is an array containing
// the names of temp files these parts were written to
// and their mime types.
break;
default:
// TODO %n is the number of parts, %F is an array containing
// the names of temp files these parts were written to
// and their mime types.
break;
default:
// metamail(1) man page states that if the mailcap entry doesn't have '%s'
// the program will accept the data on stdin: so give it to it!
if ( !hasFilename && !str.IsEmpty() ) {
// metamail(1) man page states that if the mailcap entry doesn't have '%s'
// the program will accept the data on stdin: so give it to it!
if ( !hasFilename && !str.IsEmpty() ) {
bool wxMimeTypesManager::IsOfType(const wxString& mimeType,
const wxString& wildcard)
{
bool wxMimeTypesManager::IsOfType(const wxString& mimeType,
const wxString& wildcard)
{
- wxASSERT_MSG( mimeType.Find('*') == wxNOT_FOUND,
- "first MIME type can't contain wildcards" );
+ wxASSERT_MSG( mimeType.Find(_T('*')) == wxNOT_FOUND,
+ _T("first MIME type can't contain wildcards") );
- if ( strSubtype == '*' ||
- strSubtype.IsSameAs(mimeType.AfterFirst('/'), FALSE) )
+ if ( strSubtype == _T("*") ||
+ strSubtype.IsSameAs(mimeType.AfterFirst(_T('/')), FALSE) )
wxRegKey key(wxRegKey::HKCR, strKey);
if ( key.Open() ) {
// it's the default value of the key
wxRegKey key(wxRegKey::HKCR, strKey);
if ( key.Open() ) {
// it's the default value of the key
// transform it from '%1' to '%s' style format string
// NB: we don't make any attempt to verify that the string is valid,
// i.e. doesn't contain %2, or second %1 or .... But we do make
// sure that we return a string with _exactly_ one '%s'!
size_t len = command->Len();
for ( size_t n = 0; n < len; n++ ) {
// transform it from '%1' to '%s' style format string
// NB: we don't make any attempt to verify that the string is valid,
// i.e. doesn't contain %2, or second %1 or .... But we do make
// sure that we return a string with _exactly_ one '%s'!
size_t len = command->Len();
for ( size_t n = 0; n < len; n++ ) {
// we didn't find any '%1'!
// HACK: append the filename at the end, hope that it will do
// we didn't find any '%1'!
// HACK: append the filename at the end, hope that it will do
- wxRegKey key(wxRegKey::HKCR, /*m_strFileType*/ "." + m_ext);
- if ( key.Open() && key.QueryValue("Content Type", *mimeType) ) {
+ wxRegKey key(wxRegKey::HKCR, /*m_strFileType*/ _T(".") + m_ext);
+ if ( key.Open() && key.QueryValue(_T("Content Type"), *mimeType) ) {
// the format is the following: <full path to file>, <icon index>
// NB: icon index may be negative as well as positive and the full
// path may contain the environment variables inside '%'
// the format is the following: <full path to file>, <icon index>
// NB: icon index may be negative as well as positive and the full
// path may contain the environment variables inside '%'
- wxString strFullPath = strIcon.BeforeLast(','),
- strIndex = strIcon.AfterLast(',');
+ wxString strFullPath = strIcon.BeforeLast(_T(',')),
+ strIndex = strIcon.AfterLast(_T(','));
// index may be omitted, in which case BeforeLast(',') is empty and
// AfterLast(',') is the whole string
if ( strFullPath.IsEmpty() ) {
strFullPath = strIndex;
// index may be omitted, in which case BeforeLast(',') is empty and
// AfterLast(',') is the whole string
if ( strFullPath.IsEmpty() ) {
strFullPath = strIndex;
HICON hIcon = ExtractIcon(GetModuleHandle(NULL), strExpPath, nIndex);
switch ( (int)hIcon ) {
case 0: // means no icons were found
case 1: // means no such file or it wasn't a DLL/EXE/OCX/ICO/...
HICON hIcon = ExtractIcon(GetModuleHandle(NULL), strExpPath, nIndex);
switch ( (int)hIcon ) {
case 0: // means no icons were found
case 1: // means no such file or it wasn't a DLL/EXE/OCX/ICO/...
wxRegKey key(wxRegKey::HKCR, str);
if ( key.Open() ) {
// it's the default value of the key
wxRegKey key(wxRegKey::HKCR, str);
if ( key.Open() ) {
// it's the default value of the key
// create the new wxFileType object
wxFileType *fileType = new wxFileType;
fileType->m_impl->SetFileType(strFileType);
// create the new wxFileType object
wxFileType *fileType = new wxFileType;
fileType->m_impl->SetFileType(strFileType);
{
// HACK I don't know of any official documentation which mentions this
// location, but as a matter of fact IE uses it, so why not we?
{
// HACK I don't know of any official documentation which mentions this
// location, but as a matter of fact IE uses it, so why not we?
// notice that an empty command would always succeed (it's ok)
command = wxFileType::ExpandCommand(entry->GetTestCmd(), params);
// notice that an empty command would always succeed (it's ok)
command = wxFileType::ExpandCommand(entry->GetTestCmd(), params);
- for ( const char *p = strExtensions; ; p++ ) {
- if ( *p == ' ' || *p == ',' || *p == '\0' ) {
+ for ( const wxChar *p = strExtensions; ; p++ ) {
+ if ( *p == _T(' ') || *p == _T(',') || *p == _T('\0') ) {
//else: repeated spaces (shouldn't happen, but it's not that
// important if it does happen)
//else: repeated spaces (shouldn't happen, but it's not that
// important if it does happen)
{
// directories where we look for mailcap and mime.types by default
// (taken from metamail(1) sources)
{
// directories where we look for mailcap and mime.types by default
// (taken from metamail(1) sources)
};
// first read the system wide file(s)
for ( size_t n = 0; n < WXSIZEOF(aStandardLocations); n++ ) {
wxString dir = aStandardLocations[n];
};
// first read the system wide file(s)
for ( size_t n = 0; n < WXSIZEOF(aStandardLocations); n++ ) {
wxString dir = aStandardLocations[n];
if ( wxFile::Exists(strUserMailcap) ) {
ReadMailcap(strUserMailcap);
}
// read the users mime.types
if ( wxFile::Exists(strUserMailcap) ) {
ReadMailcap(strUserMailcap);
}
// read the users mime.types
for ( size_t n = 0; n < count; n++ ) {
wxString extensions = m_aExtensions[n];
while ( !extensions.IsEmpty() ) {
for ( size_t n = 0; n < count; n++ ) {
wxString extensions = m_aExtensions[n];
while ( !extensions.IsEmpty() ) {
// consider extensions as not being case-sensitive
if ( field.IsSameAs(ext, FALSE /* no case */) ) {
// consider extensions as not being case-sensitive
if ( field.IsSameAs(ext, FALSE /* no case */) ) {
// then try to find "text/*" as match for "text/plain" (for example)
// NB: if mimeType doesn't contain '/' at all, BeforeFirst() will return
// the whole string - ok.
// then try to find "text/*" as match for "text/plain" (for example)
// NB: if mimeType doesn't contain '/' at all, BeforeFirst() will return
// the whole string - ok.
- if ( (m_aTypes[n].BeforeFirst('/') == strCategory ) &&
- m_aTypes[n].AfterFirst('/') == "*" ) {
+ if ( (m_aTypes[n].BeforeFirst(_T('/')) == strCategory ) &&
+ m_aTypes[n].AfterFirst(_T('/')) == _T("*") ) {
wxString strMimeType, strDesc, strExtensions;
size_t nLineCount = file.GetLineCount();
wxString strMimeType, strDesc, strExtensions;
size_t nLineCount = file.GetLineCount();
wxString strRHS(pc, pEnd - pc);
// check what follows this entry
wxString strRHS(pc, pEnd - pc);
// check what follows this entry
;
// if there is something left, it may be either a '\\' to continue
// the line or the next field of the same entry
;
// if there is something left, it may be either a '\\' to continue
// the line or the next field of the same entry
// although it doesn't seem to be covered by RFCs, some programs
// (notably Netscape) create their entries with several comma
// separated extensions (RFC mention the spaces only)
// although it doesn't seem to be covered by RFCs, some programs
// (notably Netscape) create their entries with several comma
// separated extensions (RFC mention the spaces only)
size_t nLineCount = file.GetLineCount();
for ( size_t nLine = 0; nLine < nLineCount; nLine++ ) {
// now we're at the start of the line
size_t nLineCount = file.GetLineCount();
for ( size_t nLine = 0; nLine < nLineCount; nLine++ ) {
// now we're at the start of the line
// interpret the next character literally (notice that
// backslash can be used for line continuation)
// interpret the next character literally (notice that
// backslash can be used for line continuation)
- wxString lhs = curField.BeforeFirst('='),
- rhs = curField.AfterFirst('=');
+ wxString lhs = curField.BeforeFirst(_T('=')),
+ rhs = curField.AfterFirst(_T('='));
// TODO support the flags:
// 1. create an xterm for 'needsterminal'
// 2. append "| $PAGER" for 'copiousoutput'
// TODO support the flags:
// 1. create an xterm for 'needsterminal'
// 2. append "| $PAGER" for 'copiousoutput'