commondrm/drmutility/src/drmutilitywmdrmwrapper.cpp
branchRCL_3
changeset 32 457cd4423b8c
parent 18 8a03a285ab14
child 71 1221b68b8a5f
equal deleted inserted replaced
25:04da681812a9 32:457cd4423b8c
    39 #include <cmmanager.h>
    39 #include <cmmanager.h>
    40 #ifdef __SERIES60_NATIVE_BROWSER
    40 #ifdef __SERIES60_NATIVE_BROWSER
    41 #include <browseruisdkcrkeys.h>
    41 #include <browseruisdkcrkeys.h>
    42 #endif
    42 #endif
    43 
    43 
       
    44 #include <featdiscovery.h>
       
    45 #include <aknmessagequerydialog.h>
       
    46 
    44 #include    <wmdrmagent.h> // for WMDRM file details view
    47 #include    <wmdrmagent.h> // for WMDRM file details view
    45 #include    <drmutilitytypes.h>
    48 #include    <drmutilitytypes.h>
    46 #include    <drmuicheckrightsobserver.h>
    49 #include    <drmuicheckrightsobserver.h>
    47 
    50 
    48 // resources
    51 // resources
    56 
    59 
    57 #include    "drmutilityinternaltypes.h"
    60 #include    "drmutilityinternaltypes.h"
    58 #include    "drmutilitywmdrmutilities.h"
    61 #include    "drmutilitywmdrmutilities.h"
    59 
    62 
    60 #include    "wmdrmdlawrapper.h"
    63 #include    "wmdrmdlawrapper.h"
       
    64 
       
    65 using namespace DRM;
    61 
    66 
    62 // CONSTANTS
    67 // CONSTANTS
    63 const TInt KMaxUrlLength( 1024 );
    68 const TInt KMaxUrlLength( 1024 );
    64 const TInt KMaxUrlSanityLength( 102400 );
    69 const TInt KMaxUrlSanityLength( 102400 );
    65 
    70 
    83 // might leave.
    88 // might leave.
    84 // -----------------------------------------------------------------------------
    89 // -----------------------------------------------------------------------------
    85 //
    90 //
    86 DRM::CDrmUtilityWMDrmWrapper::CDrmUtilityWMDrmWrapper() :
    91 DRM::CDrmUtilityWMDrmWrapper::CDrmUtilityWMDrmWrapper() :
    87     iCoeEnv( NULL ),
    92     iCoeEnv( NULL ),
    88     iDrmUtilityUi( NULL )
    93     iDrmUtilityUi( NULL ),
       
    94     iWmDrmDlaSupportOn ( ETrue )
    89     {
    95     {
    90     }
    96     }
    91 
    97 
    92 // -----------------------------------------------------------------------------
    98 // -----------------------------------------------------------------------------
    93 // CDrmUtilityWMDrmWrapper::ConstructL
    99 // CDrmUtilityWMDrmWrapper::ConstructL
    95 // -----------------------------------------------------------------------------
   101 // -----------------------------------------------------------------------------
    96 //
   102 //
    97 void DRM::CDrmUtilityWMDrmWrapper::ConstructL()
   103 void DRM::CDrmUtilityWMDrmWrapper::ConstructL()
    98     {
   104     {
    99     User::LeaveIfError( iFs.Connect() );
   105     User::LeaveIfError( iFs.Connect() );
       
   106     TUid u = TUid::Uid( KFeatureIdFfWmdrmDlaSupport );
       
   107     TRAPD(err, iWmDrmDlaSupportOn = CFeatureDiscovery::IsFeatureSupportedL( u ));
   100     }
   108     }
   101 
   109 
   102 // -----------------------------------------------------------------------------
   110 // -----------------------------------------------------------------------------
   103 // CDrmUtilityWMDrmWrapper::NewL
   111 // CDrmUtilityWMDrmWrapper::NewL
   104 // Two-phased constructor.
   112 // Two-phased constructor.
   567                 {
   575                 {
   568                 iDrmUtilityUi = DRM::CDrmUtilityUI::NewL( iCoeEnv );
   576                 iDrmUtilityUi = DRM::CDrmUtilityUI::NewL( iCoeEnv );
   569                 }
   577                 }
   570             TFileName fileName;
   578             TFileName fileName;
   571             User::LeaveIfError( aContent.GetStringAttribute( DRM::EDrmFileName, fileName ) );
   579             User::LeaveIfError( aContent.GetStringAttribute( DRM::EDrmFileName, fileName ) );
   572             ret = iDrmUtilityUi->DisplayQueryL( R_DRM_QUERY_EXPIRED_OR_NO_RO, fileName );
   580             if(iWmDrmDlaSupportOn)
   573             }
   581                 {
   574 
   582                 ret = iDrmUtilityUi->DisplayQueryL( R_DRM_QUERY_EXPIRED_OR_NO_RO, fileName );
   575         if ( !err && ( ret == EAknSoftkeyYes || ret == EAknSoftkeyOk ) )
   583                 }
       
   584             else
       
   585                 {
       
   586                 ret = iDrmUtilityUi->DisplayMessageQueryL( R_DRMUTILITY_SYNC_WITH_PC, R_DRMUTILITY_HEAD_NO_LICENSE, fileName);
       
   587                 }
       
   588             }
       
   589         if ( !err && ( ret == EAknSoftkeyYes || ret == EAknSoftkeyOk ) && iWmDrmDlaSupportOn)
   576             {
   590             {
   577             TRAP_IGNORE( DlaLicenseAcquisitionL( file ) );
   591             TRAP_IGNORE( DlaLicenseAcquisitionL( file ) );
   578             }
   592             }
   579         CleanupStack::PopAndDestroy( &file );
   593         CleanupStack::PopAndDestroy( &file );
   580         }
   594         }
   761 // -----------------------------------------------------------------------------
   775 // -----------------------------------------------------------------------------
   762 //
   776 //
   763 void DRM::CDrmUtilityWMDrmWrapper::DlaLicenseAcquisitionL(
   777 void DRM::CDrmUtilityWMDrmWrapper::DlaLicenseAcquisitionL(
   764     RFile& aFile )
   778     RFile& aFile )
   765     {
   779     {
   766     TInt iapId( 0 );
   780     if( iWmDrmDlaSupportOn )
   767     HBufC* contentUrl( NULL );
   781         {
   768     HBufC* htmlData( NULL );
   782         TInt iapId( 0 );
   769     LoadDlaWrapperL();
   783         HBufC* contentUrl( NULL );
   770     TRAPD( err, iapId = DefaultAccessPointL() );
   784         HBufC* htmlData( NULL );
   771     if ( !err )
   785         LoadDlaWrapperL();
   772         {
   786         TRAPD( err, iapId = DefaultAccessPointL() );
   773         iDlaWrapper->SetIapId( iapId );
   787         if ( !err )
   774         }
   788             {
   775     iDlaWrapper->AcquireLicenseL( aFile, contentUrl, htmlData  );
   789             iDlaWrapper->SetIapId( iapId );
   776     delete contentUrl;
   790             }
   777     delete htmlData;
   791         iDlaWrapper->AcquireLicenseL( aFile, contentUrl, htmlData  );
       
   792         delete contentUrl;
       
   793         delete htmlData;
       
   794         }
       
   795     else
       
   796         {
       
   797         if ( !iDrmUtilityUi )
       
   798             {
       
   799             iDrmUtilityUi = DRM::CDrmUtilityUI::NewL( iCoeEnv );
       
   800             }
       
   801         TFileName aFileName;
       
   802         TInt err = aFile.Name(aFileName);
       
   803         iDrmUtilityUi->DisplayNoteL( R_DRMUTILITY_SYNC_WITH_PC , aFileName);
       
   804         }
   778     }
   805     }
   779 
   806 
   780 // -----------------------------------------------------------------------------
   807 // -----------------------------------------------------------------------------
   781 // CDrmUtilityWMDrmWrapper::SilentDlaLicenseAcquisitionL
   808 // CDrmUtilityWMDrmWrapper::SilentDlaLicenseAcquisitionL
   782 // -----------------------------------------------------------------------------
   809 // -----------------------------------------------------------------------------