| ID | TSS000191 | Creation date | March 17, 2005 |
| Platform | S60 2nd Edition S60 2nd Edition, FP1 S60 2nd Edition, FP2 S60 2nd Edition, FP3 S60 3rd Editon | Devices | |
| Category | Subcategory | Base & System, Application Framework |
| Keywords (APIs, classes, methods, functions): |
Launching the correct viewer application
If a file (content) type is supported in the device, the correct viewer for it can be launched as an embedded application with the CDocumentHandler class as follows:
#include <DocumentHandler.h> // link against commonui.lib
#include <apmstd.h> // link against apmime.lib
void TTestEmbedApp::EmbedLaunchFileL( const TDesC& aFile )
{
// iDocHandler is a pointer to CDocumentHandler
if( !iDocHandler )
{
// On S60 3rd Edition, CDocumentHandler constructor no longer requires
// a CEikProcess pointer as a parameter
#ifdef __SERIES60_3X__
iDocHandler = CDocumentHandler::NewL();
#else
iDocHandler = CDocumentHandler::NewL( iEikonEnv->Process() );
#endif
}
TDataType empty;
iDocHandler->OpenFileEmbeddedL( aFile, empty );
}
This will launch the correct application to display the specified file. Because an empty data (MIME) type is used, document handler tries to resolve the data type automatically by passing the file to system recognizers. For example, if the file (aFile) is a .txt file, the Notes application will be launched. If the file is a .jpg file, Gallery/Image Viewer will be launched.
No related wiki articles found