omadrm/drmplugins/drmromtm/ui/src/RoMtmUi.cpp
branchRCL_3
changeset 66 99ea7534c5ab
parent 18 8a03a285ab14
child 54 5ebe1934bb32
equal deleted inserted replaced
55:ad2863178d17 66:99ea7534c5ab
    48 #include <data_caging_path_literals.hrh> // KDC_RESOURCE_FILES_DIR
    48 #include <data_caging_path_literals.hrh> // KDC_RESOURCE_FILES_DIR
    49 #include <AknQueryDialog.h> // CAknQueryDialog
    49 #include <AknQueryDialog.h> // CAknQueryDialog
    50 #include <StringLoader.h> //StringLoader
    50 #include <StringLoader.h> //StringLoader
    51 #include <ConeResLoader.h> //rconeresloader
    51 #include <ConeResLoader.h> //rconeresloader
    52 #include <RoMtmUi.rsg> // test
    52 #include <RoMtmUi.rsg> // test
       
    53 #include "drmmsgwatcherobserver.h"
       
    54 
    53 // EXTERNAL DATA STRUCTURES
    55 // EXTERNAL DATA STRUCTURES
    54 // EXTERNAL FUNCTION PROTOTYPES
    56 // EXTERNAL FUNCTION PROTOTYPES
    55 // CONSTANTS
    57 // CONSTANTS
    56 _LIT(KRoAcquisitionPrefix, "ROA:");
    58 _LIT(KRoAcquisitionPrefix, "ROA:");
    57 _LIT(KTriggerPrefix, "TRI:");
    59 _LIT(KTriggerPrefix, "TRI:");
   228 // -----------------------------------------------------------------------------
   230 // -----------------------------------------------------------------------------
   229 //
   231 //
   230 CRightsObjectMtmUi::CRightsObjectMtmUi( CBaseMtm& aBaseMtm , CRegisteredMtmDll& aRegisteredMtmDll )
   232 CRightsObjectMtmUi::CRightsObjectMtmUi( CBaseMtm& aBaseMtm , CRegisteredMtmDll& aRegisteredMtmDll )
   231     :   CBaseMtmUi( aBaseMtm , aRegisteredMtmDll )
   233     :   CBaseMtmUi( aBaseMtm , aRegisteredMtmDll )
   232     {
   234     {
   233     iOpenService = NULL;
       
   234     iDocHandler = NULL;
       
   235     iHostProcess = NULL;
   235     iHostProcess = NULL;
   236     iType = ERo;
   236     iType = ERo;
   237     }
   237     }
   238 
   238 
   239 // -----------------------------------------------------------------------------
   239 // -----------------------------------------------------------------------------
   270     {
   270     {
   271 #ifdef _DRM_TESTING
   271 #ifdef _DRM_TESTING
   272     TRAP(err,WriteL(_L8("~CRightsObjectMtmUi")));
   272     TRAP(err,WriteL(_L8("~CRightsObjectMtmUi")));
   273 #endif
   273 #endif
   274     iFs.Close();
   274     iFs.Close();
   275 
       
   276   delete iOpenService;
       
   277     delete iDocHandler;
       
   278     }
   275     }
   279 
   276 
   280 
   277 
   281 
   278 
   282 
   279 
   566 #endif
   563 #endif
   567     // get message context
   564     // get message context
   568     BaseMtm().LoadMessageL();
   565     BaseMtm().LoadMessageL();
   569     CRichText& body = BaseMtm().Body();
   566     CRichText& body = BaseMtm().Body();
   570     TPtrC ptr16( body.Read(0) );
   567     TPtrC ptr16( body.Read(0) );
   571     const TUid KUidDRMUI = { 0x101f85c7 };
   568     //const TUid KUidDRMUI = { 0x101f85c7 };
       
   569     CDrmMsgWatcherObserver* operation = NULL;
   572 
   570 
   573     if ( iType == ERoapTrigger || iType == ERoapTriggerRoAcquisition )
   571     if ( iType == ERoapTrigger || iType == ERoapTriggerRoAcquisition )
   574         {
   572         {
   575 
       
   576 #ifdef _DRM_TESTING
       
   577         WriteL(_L8("LaunchEditorApplicationL-iDocHandler"));
       
   578 #endif
       
   579 
       
   580         _LIT8( KRoapTriggerMimeType, "application/vnd.oma.drm.roap-trigger+xml" );
   573         _LIT8( KRoapTriggerMimeType, "application/vnd.oma.drm.roap-trigger+xml" );
   581         TDataType type = TDataType( KRoapTriggerMimeType );
   574         TDataType type = TDataType( KRoapTriggerMimeType );
   582         HBufC* filename = NULL;
   575         HBufC* filename = NULL;
   583         TPtr ptr(NULL,0);
   576         TPtr ptr(NULL,0);
   584         TBool show;
   577         TBool show;
   591             {
   584             {
   592             CleanupStack::PopAndDestroy(filename);
   585             CleanupStack::PopAndDestroy(filename);
   593             return CompletedOperationL( aStatus );
   586             return CompletedOperationL( aStatus );
   594             }
   587             }
   595 
   588 
   596 #ifdef _DRM_TESTING
   589 	operation = CDrmMsgWatcherObserver::NewL( 
   597         WriteL(ptr,ptr.Length());
   590             Session(),
   598 #endif
   591             CActive::EPriorityStandard,
   599         if (iDocHandler)
   592             aStatus,
   600             {
   593             Type(),
   601             delete iDocHandler;
   594             ptr,
   602             iDocHandler = NULL;
   595             type );
   603             }
       
   604 #ifdef _DRM_TESTING
       
   605         WriteL(_L8("LaunchEditorApplicationL-iDocHandler-NewL"));
       
   606 #endif
       
   607         iDocHandler = CDocumentHandler::NewL();
       
   608 #ifdef _DRM_TESTING
       
   609         WriteL(_L8("LaunchEditorApplicationL-iDocHandler-SetExitObserver"));
       
   610 #endif
       
   611         iDocHandler->SetExitObserver(this);
       
   612 #ifdef _DRM_TESTING
       
   613         WriteL(_L8("LaunchEditorApplicationL-iDocHandler-OpenFileEmbeddedL"));
       
   614 #endif
       
   615         iDocHandler->OpenFileEmbeddedL(ptr,type);
       
   616         CleanupStack::PopAndDestroy(filename);
       
   617 #ifdef _DRM_TESTING
       
   618         WriteL(_L8("LaunchEditorApplicationL-iDocHandler-End"));
       
   619 #endif
       
   620         }
   596         }
   621     else
   597     else
   622         {
   598         {
   623         if ( iOpenService )
       
   624             {
       
   625             delete iOpenService;
       
   626             iOpenService = NULL;
       
   627             }
       
   628 #ifdef _DRM_TESTING
       
   629         WriteL(_L8("LaunchEditorApplicationL-CAknOpenFileService::NewL"));
       
   630 #endif
       
   631 
   599 
   632         CAiwGenericParamList* paramList = CAiwGenericParamList::NewLC();
   600         CAiwGenericParamList* paramList = CAiwGenericParamList::NewLC();
   633         TAiwVariant variantObject( ptr16 );
   601         TAiwVariant variantObject( ptr16 );
   634         TAiwGenericParam param( EGenericParamFile, variantObject );
   602         TAiwGenericParam param( EGenericParamFile, variantObject );
   635         paramList->AppendL( param );
   603         paramList->AppendL( param );
   636 
   604 
   637         TRAPD( err, iOpenService = CAknLaunchAppService::NewL( KUidDRMUI, this, paramList ) );
   605 	operation = CDrmMsgWatcherObserver::NewL( 
   638         if (err != KErrNone)
   606             Session(),
   639             {
   607             CActive::EPriorityStandard,
   640             // just return to Inbox
   608             aStatus,
   641             }
   609             Type(),
       
   610             paramList );
   642 
   611 
   643         CleanupStack::PopAndDestroy( paramList ); // paramList
   612         CleanupStack::PopAndDestroy( paramList ); // paramList
   644         }
   613         }
   645 
   614 
   646 #ifdef _DRM_TESTING
   615     return operation;
   647     WriteL(_L8("LaunchEditorApplicationL-End"));
       
   648 #endif
       
   649     return CompletedOperationL( aStatus );
       
   650     }
   616     }
   651 
   617 
   652 
   618 
   653 void CRightsObjectMtmUi::HandleServerAppExit(TInt aReason)
   619 void CRightsObjectMtmUi::HandleServerAppExit(TInt aReason)
   654     {
   620     {