commondrm/drmutility/src/DrmUiHandlingImpl.cpp
branchRCL_3
changeset 66 99ea7534c5ab
parent 25 04da681812a9
child 71 1221b68b8a5f
equal deleted inserted replaced
55:ad2863178d17 66:99ea7534c5ab
    47 
    47 
    48 // launching embedded details view
    48 // launching embedded details view
    49 #include <AknLaunchAppService.h>
    49 #include <AknLaunchAppService.h>
    50 #include <AiwGenericParam.h>
    50 #include <AiwGenericParam.h>
    51 #include <apgcli.h>
    51 #include <apgcli.h>
       
    52 
       
    53 // DCF repository
       
    54 #include <DcfRep.h>
       
    55 #include <DcfEntry.h>
    52 
    56 
    53 // character conversions
    57 // character conversions
    54 #include <utf.h>
    58 #include <utf.h>
    55 
    59 
    56 // handling urls
    60 // handling urls
   178     CleanupStack::PopAndDestroy( &cMeth );
   182     CleanupStack::PopAndDestroy( &cMeth );
   179     CleanupStack::PopAndDestroy( &dest );
   183     CleanupStack::PopAndDestroy( &dest );
   180     return iapIdOfDest;
   184     return iapIdOfDest;
   181     }
   185     }
   182 
   186 
       
   187 // ---------------------------------------------------------
       
   188 // UpdateDCFRepositoryL()
       
   189 // Update saved file to DCFRepository
       
   190 // ---------------------------------------------------------
       
   191 
       
   192 LOCAL_C void UpdateDCFRepositoryL( TDesC& aFullFileName )
       
   193     {
       
   194     CDcfEntry* dcfEntry( NULL );
       
   195     CDcfRep* dcfRep( NULL );
       
   196     
       
   197     dcfEntry = CDcfEntry::NewL();
       
   198     CleanupStack::PushL( dcfEntry );
       
   199 
       
   200     dcfRep = CDcfRep::NewL();
       
   201     CleanupStack::PushL( dcfRep );
       
   202 
       
   203     dcfEntry->SetLocationL( aFullFileName, 0 );
       
   204     dcfRep->UpdateL( dcfEntry );
       
   205     CleanupStack::PopAndDestroy( dcfRep );
       
   206     CleanupStack::PopAndDestroy( dcfEntry );
       
   207     }
       
   208 
       
   209 // ---------------------------------------------------------
       
   210 // FindFullFileNameAndUpdateDCFRepositoryL()
       
   211 // Find full file name for the content and update saved 
       
   212 // file to DCFRepository
       
   213 // ---------------------------------------------------------
       
   214 
       
   215 LOCAL_C void FindFullFileNameAndUpdateDCFRepositoryL(
       
   216     const RFile& aFileHandle )
       
   217     {
       
   218     HBufC* fullPath( NULL );
       
   219     TPtr fullPathPtr( NULL, 0 );
       
   220         
       
   221     fullPath = HBufC::NewLC( KUrlMaxLen );
       
   222     fullPathPtr.Set( fullPath->Des() );
       
   223     
       
   224     aFileHandle.FullName( fullPathPtr );
       
   225     UpdateDCFRepositoryL( fullPathPtr );
       
   226     CleanupStack::PopAndDestroy( fullPath );
       
   227     }
       
   228 
       
   229 // ---------------------------------------------------------
       
   230 // FindFullFileNameAndUpdateDCFRepositoryL()
       
   231 // Find full file name for the content and update saved 
       
   232 // file to DCFRepository
       
   233 // ---------------------------------------------------------
       
   234 
       
   235 LOCAL_C void FindFullFileNameAndUpdateDCFRepositoryL(
       
   236     const ContentAccess::CData& aFileData  )
       
   237     {
       
   238     HBufC* fullPath( NULL );
       
   239     TPtr fullPathPtr( NULL, 0 );
       
   240     
       
   241     fullPath = HBufC::NewLC( KUrlMaxLen );
       
   242     fullPathPtr.Set( fullPath->Des() );
       
   243                 
       
   244     aFileData.GetStringAttribute( DRM::EDrmFullName, 
       
   245         fullPathPtr );
       
   246     
       
   247     UpdateDCFRepositoryL( fullPathPtr );
       
   248     CleanupStack::PopAndDestroy( fullPath );    
       
   249     }
       
   250 
   183 // ============================ MEMBER FUNCTIONS ===============================
   251 // ============================ MEMBER FUNCTIONS ===============================
   184 
   252 
   185 // -----------------------------------------------------------------------------
   253 // -----------------------------------------------------------------------------
   186 // CDrmUiHandlingImpl::CDrmUiHandlingImpl
   254 // CDrmUiHandlingImpl::CDrmUiHandlingImpl
   187 // C++ default constructor can NOT contain any code, that
   255 // C++ default constructor can NOT contain any code, that
  1418         ContentAccess::EPeek );
  1486         ContentAccess::EPeek );
  1419 
  1487 
  1420     if ( ( !agent.Compare( DRM::KDrmOmaAgentName ) ) || ( iOmaBasedAgentName
  1488     if ( ( !agent.Compare( DRM::KDrmOmaAgentName ) ) || ( iOmaBasedAgentName
  1421         && !agent.Compare( *iOmaBasedAgentName ) ) )
  1489         && !agent.Compare( *iOmaBasedAgentName ) ) )
  1422         {
  1490         {
       
  1491         // To embed Domain RO in superdistribution case, register the content
       
  1492         TRAP_IGNORE( FindFullFileNameAndUpdateDCFRepositoryL( *aData.iFile ) );
       
  1493         
  1423         HandleOmaErrorL( *content, aData.iIntent, aData.iError,
  1494         HandleOmaErrorL( *content, aData.iIntent, aData.iError,
  1424             aData.iErrorObserver, aData.iOperationId );
  1495             aData.iErrorObserver, aData.iOperationId );
  1425         }
  1496         }
  1426 
  1497 
  1427     else if ( !agent.Compare( DRM::KDrmWMAgentName ) && iWmClient )
  1498     else if ( !agent.Compare( DRM::KDrmWMAgentName ) && iWmClient )
  1439 // -----------------------------------------------------------------------------
  1510 // -----------------------------------------------------------------------------
  1440 //
  1511 //
  1441 void DRM::CDrmUiHandlingImpl::PerformHandleErrorDataL(
  1512 void DRM::CDrmUiHandlingImpl::PerformHandleErrorDataL(
  1442     DRM::CDrmUiHandlingData& aData )
  1513     DRM::CDrmUiHandlingData& aData )
  1443     {
  1514     {
       
  1515     
  1444     DRM::TDrmAgentUid agentUid( DRM::EDrmOmaAgent );
  1516     DRM::TDrmAgentUid agentUid( DRM::EDrmOmaAgent );
  1445     IsProtectedL( aData.iFileData, agentUid );
  1517     IsProtectedL( aData.iFileData, agentUid );
  1446     IsProperErrorL( aData.iError );
  1518     IsProperErrorL( aData.iError );
  1447 
  1519 
  1448     // *** WMDRM
  1520     // *** WMDRM
  1449     switch ( agentUid )
  1521     switch ( agentUid )
  1450         {
  1522         {
  1451         case DRM::EDrmOmaAgent:
  1523         case DRM::EDrmOmaAgent:
  1452 
  1524             
       
  1525             // To embed Domain RO in superdistribution case, register the content
       
  1526             TRAP_IGNORE( FindFullFileNameAndUpdateDCFRepositoryL( 
       
  1527                 *aData.iFileData ) );
       
  1528             
  1453             HandleOmaErrorL( *aData.iFileData, aData.iIntent, aData.iError,
  1529             HandleOmaErrorL( *aData.iFileData, aData.iIntent, aData.iError,
  1454                 aData.iErrorObserver, aData.iOperationId );
  1530                 aData.iErrorObserver, aData.iOperationId );
  1455 
  1531 
  1456             break;
  1532             break;
  1457 
  1533 
  1555     HBufC8* contentId( NULL );
  1631     HBufC8* contentId( NULL );
  1556     HBufC8* silentUrl( NULL );
  1632     HBufC8* silentUrl( NULL );
  1557     HBufC* riUrl( NULL );
  1633     HBufC* riUrl( NULL );
  1558     HBufC* domainRiUrl( NULL );
  1634     HBufC* domainRiUrl( NULL );
  1559     DRM::TDrmUiUrlType urlType( DRM::EUHRightsIssuerUrl );
  1635     DRM::TDrmUiUrlType urlType( DRM::EUHRightsIssuerUrl );
  1560 
  1636             
       
  1637     // To embed Domain RO in superdistribution case, register the content
       
  1638     TRAP_IGNORE( FindFullFileNameAndUpdateDCFRepositoryL( aContent ) );
       
  1639     
  1561     User::LeaveIfError( GetContentIdLC( aContent, contentId ) );
  1640     User::LeaveIfError( GetContentIdLC( aContent, contentId ) );
  1562     GetOmaSilentRightsUrlLC( aContent, silentUrl );
  1641     GetOmaSilentRightsUrlLC( aContent, silentUrl );
  1563     GetOmaRightsIssuerLC( aContent, riUrl );
  1642     GetOmaRightsIssuerLC( aContent, riUrl );
  1564     GetOmaDomainRightsIssuerLC( aContent, domainRiUrl );
  1643     GetOmaDomainRightsIssuerLC( aContent, domainRiUrl );
  1565     SelectOmaRightsUrlL( aContent, domainRiUrl, urlType );
  1644     SelectOmaRightsUrlL( aContent, domainRiUrl, urlType );
  1712     DRM::TDrmRightsInfo rightsStatus( DRM::EURightsInfoValid );
  1791     DRM::TDrmRightsInfo rightsStatus( DRM::EURightsInfoValid );
  1713     DRM::TDrmUiUrlType urlType( DRM::EUHRightsIssuerUrl );
  1792     DRM::TDrmUiUrlType urlType( DRM::EUHRightsIssuerUrl );
  1714     TInt previewType( ContentAccess::ENoPreview );
  1793     TInt previewType( ContentAccess::ENoPreview );
  1715     TUint32 reason( 0 );
  1794     TUint32 reason( 0 );
  1716     TBool handled( EFalse );
  1795     TBool handled( EFalse );
  1717 
  1796     
  1718     User::LeaveIfError( GetContentIdLC( aContent, contentId ) );
  1797     User::LeaveIfError( GetContentIdLC( aContent, contentId ) );
  1719 
  1798 
  1720     // Check that this really is an error situation
  1799     // Check that this really is an error situation
  1721     omaError = iOmaClient.CheckRights( aIntent, *contentId, reason );
  1800     omaError = iOmaClient.CheckRights( aIntent, *contentId, reason );
  1722 
  1801