API published in: S60 1st Ed
Link against: commonui.lib
Required Capabilities
None
#include <documenthandler.h>
This class declares an interface for the DocumentHandler, a common component in Series60.
The CDocumentHandler class will not itself implement any content handling routines. It's responsible for finding out which application can handle given data type and constructing a correct handler implementation for that application. If the given data type is supported by the system but no specific handler is found, the CDocDefaltHandler is then constructed. The default handler is an implementation of the CDoCDocHandlerBase class with standard "Epoc-style" content handling.
The handler application can be lauched standalone or embedded. The Embedded launching is preferred way in Series60. Standalone launching means that the application will run in it's own process. Embedded launching means that the UI of an application, which is responsible for handling given data type, is embedded into the parent application. There will be only parent applications icon shown in the fast swap window when an application is embedded.
Link your application against CommonUI.lib.
An example:
include <DocumentHandler.h>
// Define DocHandler CDocumentHandler* iDocHandler;
// Construct DocHandler void ConstructL() { iDocHandler = CDocumentHandler::NewL();
// I want to be notified when exit happends. Because I // pass "this" pointer, I have to derive from // MAknServerAppExitObserver class. iDocHandler->SetExitObserver(this) }
// delete DocHandler void ~Myapp() { delete iDocHandler; }
// and use like this
void OpenAttachmentL( RFile& aFile, // A file to be open TDataType& aDataType ) // DataType can be empty { TInt error = KErrNone; TFileName path;
// Leaves on system wide errors like disk full, out of memory etc. error = iDocHandler->OpenFileEmbeddedL( aFile, aDataType ); // The status code can be either KErrNone or KUserCancel
}
Public Member Functions |
|
virtual IMPORT_C | ~CDocumentHandler () |
Destructor. |
|
IMPORT_C void | OpenTempFileL (const TDesC &aFileName, RFile &aSharableFile) |
Utility method for opening filehandle from existing file for OpenFileL calls. |
|
IMPORT_C void | SaveTempFileL (const TDesC8 &aContent, TDataType &aDataType, const TDesC &aFileName, RFile &aSharableFile) |
Utility method for save aContent with aDataType temporarily for OpenFileL calls. |
|
IMPORT_C CAiwGenericParamList & | InParamListL () |
Returns an empty instance of CAiwGenericParamList class. |
|
IMPORT_C const CAiwGenericParamList * | OutParamList () |
Returns a list of possible output parameters handler application may have set after executing the service. |
|
IMPORT_C TInt | OpenFileL (RFile &aSharableFile, TDataType &aDataType) |
Launches an application in standalone capable of handling data in aSharableFile (using aDatatype if available). |
|
IMPORT_C TInt | OpenFileEmbeddedL (RFile &aSharableFile, TDataType &aDataType, const CAiwGenericParamList &aParamList) |
Launches an application in embedded (if possible) capable of handling data in aSharableFile (using aDatatype if available).
|
|
IMPORT_C TInt | OpenFileEmbeddedL (RFile &aSharableFile, TDataType &aDataType) |
Launches an application in embedded (if possible) capable of handling data in aSharableFile (using aDatatype if available).
|
|
IMPORT_C TInt | OpenFileL (const TDesC &aFileName, TDataType &aDataType) |
Launches an application standalone capable of handling data in aFilename, with aDataType. |
|
IMPORT_C TInt | OpenFileEmbeddedL (const TDesC &aFileName, TDataType &aDataType) |
Launches an application embedded capable of handling data in aFilename with aDataType. |
|
IMPORT_C TInt | SaveL (const TDesC8 &aContent, TDataType &aDataType, const TUint aAttr) |
Save aContent with aDataType using aAttr to a correct directory. |
|
IMPORT_C TInt | SaveL (const TDesC8 &aContent, TDataType &aDataType, const TDesC &aName, const TUint aAttr) |
Save aBuffer with aDataType using aAttr to a correct storage with a supplied name. |
|
IMPORT_C TInt | CopyL (const TDesC &aFileNameOld, const TDesC &aNameNew, TDataType &aDataType, const TUint aAttr) |
Copy a file named aFileNameOld to the correct storage using name aNameNew and aFileAttr. |
|
IMPORT_C TInt | CopyL (const RFile &aFileOld, const TDesC &aNameNew, TDataType &aDataType, const TUint aAttr) |
Copy a file with handle aFileOld to the correct storage using name aNameNew and aFileAttr. |
|
IMPORT_C TInt | MoveL (const TDesC &aFileNameOld, const TDesC &aNameNew, TDataType &aDataType, const TUint aAttr) |
Move a file named aFileNameOld to the correct storage using name aNameNew and aFileAttr. |
|
IMPORT_C TInt | SilentMoveL (const TDesC &aFileNameOld, const TDesC &aNameNew, const TDesC &aRootPath, TDataType &aDataType, const TUint aAttr) |
Move a file named aFileNameOld to the correct storage using name aNameNew and aFileAttr. |
|
IMPORT_C TBool | CanHandleL (const TDataType &aDataType) |
Is the aDataType supported by the system. |
|
IMPORT_C TBool | CanOpenL (const TDataType &aDataType) |
Is opening of aDataType supported by the system. |
|
IMPORT_C TBool | CanSaveL (const TDataType &aDataType) |
Is saving aDataType supported by the system. |
|
IMPORT_C TInt | GetPath (TDes &aPath) |
Get the whole path including filename where the content was saved. |
|
IMPORT_C TInt | HandlerAppUid (TUid &aUid) |
Get the uid of handler application. |
|
IMPORT_C void | SetExitObserver (MAknServerAppExitObserver *aObserver) |
Set an observer for embedded application exit events. |
|
IMPORT_C void | CheckFileNameExtension (TDes &aFileName, const TDataType &aDatatype) |
Utility method for appending a correct file name extension for some content. |
|
RApaLsSession * | ApaLs () |
Get the RApaLsSession. |
|
MAknServerAppExitObserver * | ServerAppExitObserver () const |
Get the exit observer. |
|
TDocOperation | DocOperation () const |
Get the operation code of the api entry function. |
|
void | CloseSharableFS () |
Close sharable FileSession. |
|
void | SetTempFile (const TDesC &aTempFile) |
Set temporary file, which will be deleted in destructor. |
|
IMPORT_C TBool | CanHandleProgressivelyL (const TDataType &aDataType, TUid &aUid) |
Utility method to find out if there are any applications that support progressive downloading for a given data type. |
|
IMPORT_C void | GetProgressiveDownloadAppUidsL (RArray< TInt32 > &aUidList) |
Utility method to provide a list of applications that support progressive downloading. |
|
Static Public Member Functions |
|
static IMPORT_C CDocumentHandler * | NewL (CEikProcess *aProcess) |
Two-phased constructor. |
|
static IMPORT_C CDocumentHandler * | NewLC (CEikProcess *aProcess) |
Two-phased constructor. |
|
static IMPORT_C CDocumentHandler * | NewL () |
Two-phased constructor. |
|
static IMPORT_C CDocumentHandler * | NewLC () |
Two-phased constructor. |
|
Destructor. |
|
Get the RApaLsSession.
|
|
Is the aDataType supported by the system.
|
|
Utility method to find out if there are any applications that support progressive downloading for a given data type. The decision is based on configuration made in central repository.
|
|
Is opening of aDataType supported by the system.
|
|
Is saving aDataType supported by the system.
|
|
Utility method for appending a correct file name extension for some content. This method should be called if wanted quarantee that file extension of aFileName is correct with aDataType. This method uses internal mapping table to find correct file extension to aFileName. Mapping table contains mainly extensions and datatypes, which cannot be recognized based on the data it self (No header information etc.). This method replaces existing extension with correct one at aFileName if needed. If aDatatype is not found from mapping table or aDatatype is not supported by any application, aFileName will remain unchanged.
|
|
Close sharable FileSession. |
|
Copy a file with handle aFileOld to the correct storage using name aNameNew and aFileAttr. If aNameNew is empty, use the old name. This function can leave in some system wide error situation. E.g. out of memory, not enough space in filesystem etc. See also possible error codes from documenthandler.h header file.
|
|
Copy a file named aFileNameOld to the correct storage using name aNameNew and aFileAttr. If aNameNew is empty, use the old name. This function can leave in some system wide error situation. E.g. out of memory, not enough space in filesystem etc. See also possible error codes from documenthandler.h header file.
|
|
Get the operation code of the api entry function. |
|
Get the whole path including filename where the content was saved. If the content was not saved to a file, this function returns a name that represents the saved object. It may not be possible to open the object with the returned value, if it's not a real file in the filesystem. This situation may happen when e.g. the handler application stores it's contents in some weird data structure.
|
|
Utility method to provide a list of applications that support progressive downloading. The list of applications uids is configured central repository.
|
|
Get the uid of handler application. In case of media files uid is Media Gallery's uid. This method should be called only succesfully completed DocumentHandler operations.
|
|
Returns an empty instance of CAiwGenericParamList class. It can be used for example as an input parameter list for API methods. This is just a convinience method and doesn't have to be used. If consumer wants to create input list by itself it is ok. If this method is used, service handler takes care of deleting returned generic parameter list.
|
|
Move a file named aFileNameOld to the correct storage using name aNameNew and aFileAttr. Note that file in the old location (aFileNameOld) will be removed during this operation. This function can leave in some system wide error situation. E.g. out of memory, not enough space in filesystem etc. See also possible error codes from documenthandler.h header file.
|
|
Two-phased constructor. Leaves on failure.
|
|
Two-phased constructor. Leaves on failure.
|
|
Two-phased constructor. Leaves on failure.
|
|
Two-phased constructor. Leaves on failure.
|
|
Launches an application embedded capable of handling data in aFilename with aDataType. Doesn't copy data from the file. This function can leave in some system wide error situation. E.g. out of memory, not enough space in filesystem etc. See also possible error codes from documenthandler.h header file.
|
|
Launches an application in embedded (if possible) capable of handling data in aSharableFile (using aDatatype if available). Doesn't save data from the file. In case of DRM protected files with restricted rights, there will be query asking if user want open file. This function can leave in some system wide error situation. E.g. out of memory, not enough space in filesystem etc. See also possible error codes from documenthandler.h header file.
|
|
Launches an application in embedded (if possible) capable of handling data in aSharableFile (using aDatatype if available). Doesn't save data from the file. In case of DRM protected files with restricted rights, there will be query asking if user want open file. This function can leave in some system wide error situation. E.g. out of memory, not enough space in filesystem etc. See also possible error codes from documenthandler.h header file.
|
|
Launches an application standalone capable of handling data in aFilename, with aDataType. Doesn't copy data from the file. This function can leave in some system wide error situation. E.g. out of memory, not enough space in filesystem etc. See also possible error codes from documenthandler.h header file.
|
|
Launches an application in standalone capable of handling data in aSharableFile (using aDatatype if available). Doesn't save data from the file. In case of DRM protected files with restricted rights, there will be query asking if user want open file. This function can leave in some system wide error situation. E.g. out of memory, not enough space in filesystem etc. See also possible error codes from documenthandler.h header file.
|
|
Utility method for opening filehandle from existing file for OpenFileL calls. The created file handle is meant to be shared across process boundaries. This function can leave in some system wide error situation. E.g. out of memory, not enough space in filesystem etc. These errors are usually trapped by the application framework. NOTE! Caller is responsible of closing opened file handle.
|
|
Returns a list of possible output parameters handler application may have set after executing the service. The caller is responsible for deleting the parameter instance if not null.
|
|
Save aBuffer with aDataType using aAttr to a correct storage with a supplied name. The storage is usually a filesystem, but can be anything from application spesific data structures to a database. This function can leave in some system wide error situation. E.g. out of memory, not enough space in filesystem etc. See also possible error codes from documenthandler.h header file.
|
|
Save aContent with aDataType using aAttr to a correct directory. Generates a new name for saving. The storage is usually a filesystem, but can be anything from application spesific data structures to a database. This function can leave in some system wide error situation. E.g. out of memory, not enough space in filesystem etc. See also possible error codes from documenthandler.h header file.
|
|
Utility method for save aContent with aDataType temporarily for OpenFileL calls. The created file handle is meant to be shared across process boundaries. This temporary file will be saved to process private temp directory. Temporary directory will be created if not existing yet. This function can leave in some system wide error situation. E.g. out of memory, not enough space in filesystem etc. These errors are usually trapped by the application framework. NOTE! Caller is responsible of closing opened file handle! Created temporary file will be deleted in destructor of DocumentHandler, but caller can delete it self as well.
|
|
Get the exit observer.
|
|
Set an observer for embedded application exit events. DocumentHandler will delegate embedding applications exit events to aObserver if it's not NULL:
|
|
Set temporary file, which will be deleted in destructor. |
|
Move a file named aFileNameOld to the correct storage using name aNameNew and aFileAttr. This method operates silently, so nothing will be asked from user. Caller should give root path of the selected memory. Unique file name will be created automatically without user interaction. Note that file in the old location (aFileNameOld) will be removed during this operation. This function can leave in some system wide error situation. E.g. out of memory, not enough space in filesystem etc. See also possible error codes from documenthandler.h header file.
|