×
Namespaces

Variants
Actions

Launching the correct viewer app on Symbian

From Nokia Developer Wiki
Jump to: navigation, search



Article Metadata
Compatibility
Platform(s): S60 2nd Edition
S60 2nd Edition, FP1
S60 2nd Edition, FP2
S60 2nd Edition, FP3
S60 3rd Editon
S60 3rd Edition (initial release)
S60 2nd Edition (initial release)
Article
Created: User:Technical writer 2 (17 Mar 2005)
Last edited: hamishwillee (14 Jun 2012)

Overview

Launching the correct viewer application

Description

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.

This page was last modified on 14 June 2012, at 04:54.
43 page views in the last 30 days.

Was this page helpful?

Your feedback about this content is important. Let us know what you think.

 

Thank you!

We appreciate your feedback.

×