/////////////////////////////////////////////////////////////////////////////
-// Name: common/mimetype.cpp
+// Name: msw/mimetype.cpp
// Purpose: classes and functions to manage MIME types
// Author: Vadim Zeitlin
// Modified by:
#pragma hdrstop
#endif
-#ifndef WX_PRECOMP
- #include "wx/defs.h"
-#endif
-
-#if (wxUSE_FILE && wxUSE_TEXTFILE) || defined(__WXMSW__)
+// Doesn't compile in WIN16 mode
+#ifndef __WIN16__
#ifndef WX_PRECOMP
#include "wx/string.h"
#endif
#endif //WX_PRECOMP
-// Doesn't compile in WIN16 mode
-#ifndef __WIN16__
-
#include "wx/log.h"
#include "wx/file.h"
#include "wx/intl.h"
#ifdef __WXMSW__
#include "wx/msw/registry.h"
#include "windows.h"
-#elif defined(__UNIX__) || defined(__WXPM__)
- #include "wx/ffile.h"
- #include "wx/textfile.h"
- #include "wx/dir.h"
- #include "wx/utils.h"
- #include "wx/tokenzr.h"
#endif // OS
#include "wx/msw/mimetype.h"
// in case we're compiling in non-GUI mode
class WXDLLEXPORT wxIcon;
-
// These classes use Windows registry to retrieve the required information.
//
// Keys used (not all of them are documented, so it might actually stop working
// location, uses it, so it isn't likely to change
static const wxChar *MIME_DATABASE_KEY = wxT("MIME\\Database\\Content Type\\");
-
-
-
wxString wxFileTypeImpl::GetCommand(const wxChar *verb) const
{
// suppress possible error messages
}
}
+#if wxUSE_IPC
// look whether we must issue some DDE requests to the application
// (and not just launch it)
strKey += _T("\\DDEExec");
<< _T('#') << ddeTopic
<< _T('#') << ddeCommand;
}
- else if ( !foundFilename ) {
+ else
+#endif // wxUSE_IPC
+ if ( !foundFilename ) {
// we didn't find any '%1' - the application doesn't know which
// file to open (note that we only do it if there is no DDEExec
// subkey)
// suppress possible error messages
wxLogNull nolog;
wxRegKey key(wxRegKey::HKCR, wxT(".") + m_ext);
- if ( key.Open() && key.QueryValue(wxT("Content Type"), *mimeType) ) {
- return TRUE;
- }
- else {
+
+ return key.Open() && key.QueryValue(wxT("Content Type"), *mimeType);
+}
+
+
+bool wxFileTypeImpl::GetMimeTypes(wxArrayString& mimeTypes) const
+{
+ wxString s;
+
+ if ( !GetMimeType(&s) )
+ {
return FALSE;
}
+
+ mimeTypes.Clear();
+ mimeTypes.Add(s);
+ return TRUE;
}
+
bool wxFileTypeImpl::GetIcon(wxIcon *icon) const
{
#if wxUSE_GUI
}
}
- if ( knownExtension )
- {
- wxFileType *fileType = new wxFileType;
- fileType->m_impl->Init(wxEmptyString, ext);
-
- return fileType;
- }
- else
+ if ( !knownExtension )
{
// unknown extension
return NULL;
}
+
+ wxFileType *fileType = new wxFileType;
+ fileType->m_impl->Init(wxEmptyString, ext);
+
+ return fileType;
}
// MIME type -> extension -> file type
}
-#endif
- // wxUSE_FILE && wxUSE_TEXTFILE
-
#endif
// __WIN16__