omadrm/drmplugins/drmromtm/ui/src/RoMtmUi.cpp
branchRCL_3
changeset 67 50c53e893c3f
parent 66 99ea7534c5ab
equal deleted inserted replaced
66:99ea7534c5ab 67:50c53e893c3f
     1 /*
     1 /*
     2 * Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies).
     2 * Copyright (c) 2002-2010 Nokia Corporation and/or its subsidiary(-ies).
     3 * All rights reserved.
     3 * All rights reserved.
     4 * This component and the accompanying materials are made available
     4 * This component and the accompanying materials are made available
     5 * under the terms of "Eclipse Public License v1.0"
     5 * under the terms of "Eclipse Public License v1.0"
     6 * which accompanies this distribution, and is available
     6 * which accompanies this distribution, and is available
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
    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"
    53 #include "drmmsgwatcherobserver.h"
       
    54 
       
    55 #include "cleanupresetanddestroy.h"
    54 
    56 
    55 // EXTERNAL DATA STRUCTURES
    57 // EXTERNAL DATA STRUCTURES
    56 // EXTERNAL FUNCTION PROTOTYPES
    58 // EXTERNAL FUNCTION PROTOTYPES
    57 // CONSTANTS
    59 // CONSTANTS
    58 _LIT(KRoAcquisitionPrefix, "ROA:");
    60 _LIT(KRoAcquisitionPrefix, "ROA:");
   564     // get message context
   566     // get message context
   565     BaseMtm().LoadMessageL();
   567     BaseMtm().LoadMessageL();
   566     CRichText& body = BaseMtm().Body();
   568     CRichText& body = BaseMtm().Body();
   567     TPtrC ptr16( body.Read(0) );
   569     TPtrC ptr16( body.Read(0) );
   568     //const TUid KUidDRMUI = { 0x101f85c7 };
   570     //const TUid KUidDRMUI = { 0x101f85c7 };
   569     CDrmMsgWatcherObserver* operation = NULL;
   571     CMsvOperation* operation( NULL );
   570 
   572 
   571     if ( iType == ERoapTrigger || iType == ERoapTriggerRoAcquisition )
   573     if ( iType == ERoapTrigger || iType == ERoapTriggerRoAcquisition )
   572         {
   574         {
   573         _LIT8( KRoapTriggerMimeType, "application/vnd.oma.drm.roap-trigger+xml" );
   575         _LIT8( KRoapTriggerMimeType, "application/vnd.oma.drm.roap-trigger+xml" );
   574         TDataType type = TDataType( KRoapTriggerMimeType );
   576         TDataType type = TDataType( KRoapTriggerMimeType );
   578         filename = HBufC::NewLC(ptr16.Length()-4);
   580         filename = HBufC::NewLC(ptr16.Length()-4);
   579         ptr.Set(filename->Des());
   581         ptr.Set(filename->Des());
   580         ptr.Append(ptr16.Right(ptr16.Length()-4));
   582         ptr.Append(ptr16.Right(ptr16.Length()-4));
   581 
   583 
   582         show = ShowQueryL(ptr);
   584         show = ShowQueryL(ptr);
       
   585 
   583         if (!show)
   586         if (!show)
   584             {
   587             {
   585             CleanupStack::PopAndDestroy(filename);
   588             operation = CompletedOperationL( aStatus );
   586             return CompletedOperationL( aStatus );
       
   587             }
   589             }
   588 
   590         else
   589 	operation = CDrmMsgWatcherObserver::NewL( 
   591             {
   590             Session(),
   592             operation = CDrmMsgWatcherObserver::NewL(
   591             CActive::EPriorityStandard,
   593                     Session(),
   592             aStatus,
   594                     CActive::EPriorityStandard,
   593             Type(),
   595                     aStatus,
   594             ptr,
   596                     Type(),
   595             type );
   597                     ptr,
       
   598                     type );
       
   599             }
       
   600 
       
   601         CleanupStack::PopAndDestroy(filename);
   596         }
   602         }
   597     else
   603     else
   598         {
   604         {
   599 
       
   600         CAiwGenericParamList* paramList = CAiwGenericParamList::NewLC();
   605         CAiwGenericParamList* paramList = CAiwGenericParamList::NewLC();
   601         TAiwVariant variantObject( ptr16 );
   606         TAiwVariant variantObject( ptr16 );
   602         TAiwGenericParam param( EGenericParamFile, variantObject );
   607         TAiwGenericParam param( EGenericParamFile, variantObject );
   603         paramList->AppendL( param );
   608         paramList->AppendL( param );
   604 
   609 
   605 	operation = CDrmMsgWatcherObserver::NewL( 
   610         operation = CDrmMsgWatcherObserver::NewL(
   606             Session(),
   611                 Session(),
   607             CActive::EPriorityStandard,
   612                 CActive::EPriorityStandard,
   608             aStatus,
   613                 aStatus,
   609             Type(),
   614                 Type(),
   610             paramList );
   615                 paramList );
   611 
   616 
   612         CleanupStack::PopAndDestroy( paramList ); // paramList
   617         CleanupStack::PopAndDestroy( paramList );
   613         }
   618         }
   614 
   619 
   615     return operation;
   620     return operation;
   616     }
   621     }
   617 
   622 
   763     CleanupStack::Pop(buf);
   768     CleanupStack::Pop(buf);
   764     CleanupStack::PopAndDestroy(&file);
   769     CleanupStack::PopAndDestroy(&file);
   765     CleanupStack::PushL(buf);
   770     CleanupStack::PushL(buf);
   766     roap = Roap::CRoapEng::NewL();
   771     roap = Roap::CRoapEng::NewL();
   767     CleanupStack::PushL(roap);
   772     CleanupStack::PushL(roap);
       
   773     CleanupResetAndDestroyPushL(array);
   768     roap->SetTriggerL(ptr,NULL,type,status,op,array);
   774     roap->SetTriggerL(ptr,NULL,type,status,op,array);
   769     array.ResetAndDestroy();
   775     CleanupStack::PopAndDestroy(&array);
   770     array.Close();
       
   771     CleanupStack::PopAndDestroy(roap);
   776     CleanupStack::PopAndDestroy(roap);
   772     CleanupStack::PopAndDestroy(buf);
   777     CleanupStack::PopAndDestroy(buf);
   773 
   778 
   774 #ifdef _DRM_TESTING
   779 #ifdef _DRM_TESTING
   775     WriteL(_L8("CheckTriggerTypeL-End"),type);
   780     WriteL(_L8("CheckTriggerTypeL-End"),type);