00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024 #ifndef DOCUMENTHANDLER_H
00025 #define DOCUMENTHANDLER_H
00026
00027
00028 #include <e32base.h>
00029 #include <f32file.h>
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039 const TInt KTextHandler = 0x1000599d;
00040 const TInt KWmlcHandler = 0x10008D39;
00041 const TInt KJamHandler = 0x100009C1;
00042 const TInt KAppInstHandler = 0x101F875A;
00043 const TInt KBioViewerAppHandler = 0x0FC99F01;
00044 const TInt KImageViewerHandler = 0x101f4d90;
00045 const TInt KCertSaveAppHandler = 0x100059D2;
00046 const TInt KCODHandler = 0x10008d4a;
00047 const TInt KDDhandler = 0x10008d3f;
00048
00049
00050 _LIT8(KGameMimeType, "application/x-NokiaGameData");
00051 _LIT8(KDataTypeODM,"application/vnd.oma.drm.message");
00052 _LIT8(KDataTypeDCF,"application/vnd.oma.drm.content");
00053
00054
00055 const TInt KBadMimeType = -12002;
00056 const TInt KMimeNotSupported = -12003;
00057 const TInt KNullContent = -12005;
00058 const TInt KDataDirNotFound = -12006;
00059 const TInt KExecNotAllowed = -12007;
00060 const TInt KNoHostProcess = -12008;
00061 const TInt KNotInitialized = -12009;
00062 const TInt KUserCancel = -12010;
00063 const TInt KDRMErrSession = -12011;
00064 const TInt KDRMErrNoRights = -12012;
00065 const TInt KDRMErrRightsDBCorrupted = -12013;
00066 const TInt KDRMErrInvalidVersion = -12014;
00067 const TInt KDRMErrPreviewRights = -12015;
00068
00069
00070
00071
00072
00073 enum TDocOperation
00074 {
00075 EDocCopy,
00076 EDocSave,
00077 EDocSaveAs,
00078 EDocOpenFile,
00079 EDocOpenFileEmb,
00080 EDocMove,
00081 EDocSilentMove,
00082 EDocSaveTemp,
00083 };
00084
00085
00086 class CDocHandlerBase;
00087 class CEikProcess;
00088 class MAknServerAppExitObserver;
00089 class TDataType;
00090 class RApaLsSession;
00091 class CAiwGenericParamList;
00092
00093
00094
00161 NONSHARABLE_CLASS(CDocumentHandler) : public CBase
00162 {
00163 public:
00164
00174 IMPORT_C static CDocumentHandler* NewL( CEikProcess* aProcess );
00175
00185 IMPORT_C static CDocumentHandler* NewLC( CEikProcess* aProcess );
00186
00194 IMPORT_C static CDocumentHandler* NewL( );
00195
00203 IMPORT_C static CDocumentHandler* NewLC( );
00204
00208 IMPORT_C virtual ~CDocumentHandler();
00209
00210 private:
00211
00215 CDocumentHandler( );
00216
00220 CDocumentHandler( const CDocumentHandler& );
00221
00225 void ConstructL();
00226
00227 public:
00228
00246 IMPORT_C void OpenTempFileL(
00247 const TDesC& aFileName,
00248 RFile &aSharableFile);
00249
00275 IMPORT_C void SaveTempFileL(
00276 const TDesC8& aContent,
00277 TDataType& aDataType,
00278 const TDesC& aFileName,
00279 RFile &aSharableFile);
00280
00281 public:
00282
00294 IMPORT_C CAiwGenericParamList& InParamListL();
00295
00304 IMPORT_C const CAiwGenericParamList* OutParamList();
00305
00306 public:
00307
00327 IMPORT_C TInt OpenFileL(
00328 RFile& aSharableFile,
00329 TDataType& aDataType);
00330
00351 IMPORT_C TInt OpenFileEmbeddedL(
00352 RFile& aSharableFile,
00353 TDataType& aDataType,
00354 const CAiwGenericParamList& aParamList);
00355
00375 IMPORT_C TInt OpenFileEmbeddedL(
00376 RFile& aSharableFile,
00377 TDataType& aDataType);
00378
00379 public:
00380
00396 IMPORT_C TInt OpenFileL(
00397 const TDesC& aFileName,
00398 TDataType& aDataType );
00399
00414 IMPORT_C TInt OpenFileEmbeddedL(
00415 const TDesC& aFileName,
00416 TDataType& aDataType );
00417
00418 public:
00419
00442 IMPORT_C TInt SaveL(
00443 const TDesC8& aContent,
00444 TDataType& aDataType,
00445 const TUint aAttr );
00446
00470 IMPORT_C TInt SaveL(
00471 const TDesC8& aContent,
00472 TDataType& aDataType,
00473 const TDesC& aName,
00474 const TUint aAttr );
00475
00495 IMPORT_C TInt CopyL(
00496 const TDesC& aFileNameOld,
00497 const TDesC& aNameNew,
00498 TDataType& aDataType,
00499 const TUint aAttr );
00500
00520 IMPORT_C TInt CopyL(
00521 const RFile& aFileOld,
00522 const TDesC& aNameNew,
00523 TDataType& aDataType,
00524 const TUint aAttr );
00525
00546 IMPORT_C TInt MoveL(
00547 const TDesC& aFileNameOld,
00548 const TDesC& aNameNew,
00549 TDataType& aDataType,
00550 const TUint aAttr );
00551
00576 IMPORT_C TInt SilentMoveL(
00577 const TDesC& aFileNameOld,
00578 const TDesC& aNameNew,
00579 const TDesC& aRootPath,
00580 TDataType& aDataType,
00581 const TUint aAttr );
00582
00583
00584 public:
00585
00595 IMPORT_C TBool CanHandleL( const TDataType& aDataType );
00596
00606 IMPORT_C TBool CanOpenL( const TDataType& aDataType );
00607
00617 IMPORT_C TBool CanSaveL( const TDataType& aDataType );
00618
00634 IMPORT_C TInt GetPath( TDes& aPath );
00635
00647 IMPORT_C TInt HandlerAppUid( TUid& aUid );
00648
00657 IMPORT_C void SetExitObserver( MAknServerAppExitObserver* aObserver );
00658
00677 IMPORT_C void CheckFileNameExtension(
00678 TDes& aFileName,
00679 const TDataType& aDatatype );
00680
00686 RApaLsSession* ApaLs();
00687
00694 MAknServerAppExitObserver* ServerAppExitObserver() const;
00695
00699 TDocOperation DocOperation() const;
00700
00704 void CloseSharableFS();
00705
00709 void SetTempFile( const TDesC& aTempFile);
00710
00723 IMPORT_C TBool CanHandleProgressivelyL(
00724 const TDataType& aDataType,
00725 TUid& aUid );
00726
00736 IMPORT_C void GetProgressiveDownloadAppUidsL( RArray<TInt32>& aUidList );
00737
00738 private:
00739
00754 TInt FindHandlerL(
00755 const TDataType& aDataType,
00756 const TUid& aUid);
00757
00764 void FindHandlerByUidL(
00765 const TUid& aUid,
00766 const TDataType& aDataType);
00767
00774 void FindHandlerByMimeTypeL(
00775 const TUid& aUid,
00776 const TDataType& aDataType);
00777
00790 TInt RecognizeAndCheckFileL(
00791 const TDesC& aFileName,
00792 TDataType& aDataType,
00793 TUid& aUid );
00794
00807 TInt RecognizeAndCheckFileL(
00808 RFile& aFileHandle,
00809 TDataType& aDataType,
00810 TUid& aUid );
00811
00816 void ListSupportedMimeTypesL();
00817
00821 CDocumentHandler operator=( const CDocumentHandler& ) const;
00822
00826 TInt ConvertHexStringToInt32(
00827 const TDesC& aHexString,
00828 TInt32& aInt );
00829
00830 private:
00831
00836 TDocOperation iOperation;
00837
00841 CDocHandlerBase* iHandler;
00842
00846 RApaLsSession* iApaLs;
00847
00851 MAknServerAppExitObserver* iServerAppExitObserver;
00852
00856 RFs iSharableFS;
00857
00861 CAiwGenericParamList* iInParams;
00862
00867 TFileName iTempFileName;
00868
00869 };
00870
00871
00872 #endif
00873
00874