commondrm/drmutility/src/DrmUiHandlingImpl.cpp
branchRCL_3
changeset 66 99ea7534c5ab
parent 25 04da681812a9
child 71 1221b68b8a5f
--- a/commondrm/drmutility/src/DrmUiHandlingImpl.cpp	Mon Jun 21 15:58:55 2010 +0300
+++ b/commondrm/drmutility/src/DrmUiHandlingImpl.cpp	Thu Jul 15 18:57:30 2010 +0300
@@ -50,6 +50,10 @@
 #include <AiwGenericParam.h>
 #include <apgcli.h>
 
+// DCF repository
+#include <DcfRep.h>
+#include <DcfEntry.h>
+
 // character conversions
 #include <utf.h>
 
@@ -180,6 +184,70 @@
     return iapIdOfDest;
     }
 
+// ---------------------------------------------------------
+// UpdateDCFRepositoryL()
+// Update saved file to DCFRepository
+// ---------------------------------------------------------
+
+LOCAL_C void UpdateDCFRepositoryL( TDesC& aFullFileName )
+    {
+    CDcfEntry* dcfEntry( NULL );
+    CDcfRep* dcfRep( NULL );
+    
+    dcfEntry = CDcfEntry::NewL();
+    CleanupStack::PushL( dcfEntry );
+
+    dcfRep = CDcfRep::NewL();
+    CleanupStack::PushL( dcfRep );
+
+    dcfEntry->SetLocationL( aFullFileName, 0 );
+    dcfRep->UpdateL( dcfEntry );
+    CleanupStack::PopAndDestroy( dcfRep );
+    CleanupStack::PopAndDestroy( dcfEntry );
+    }
+
+// ---------------------------------------------------------
+// FindFullFileNameAndUpdateDCFRepositoryL()
+// Find full file name for the content and update saved 
+// file to DCFRepository
+// ---------------------------------------------------------
+
+LOCAL_C void FindFullFileNameAndUpdateDCFRepositoryL(
+    const RFile& aFileHandle )
+    {
+    HBufC* fullPath( NULL );
+    TPtr fullPathPtr( NULL, 0 );
+        
+    fullPath = HBufC::NewLC( KUrlMaxLen );
+    fullPathPtr.Set( fullPath->Des() );
+    
+    aFileHandle.FullName( fullPathPtr );
+    UpdateDCFRepositoryL( fullPathPtr );
+    CleanupStack::PopAndDestroy( fullPath );
+    }
+
+// ---------------------------------------------------------
+// FindFullFileNameAndUpdateDCFRepositoryL()
+// Find full file name for the content and update saved 
+// file to DCFRepository
+// ---------------------------------------------------------
+
+LOCAL_C void FindFullFileNameAndUpdateDCFRepositoryL(
+    const ContentAccess::CData& aFileData  )
+    {
+    HBufC* fullPath( NULL );
+    TPtr fullPathPtr( NULL, 0 );
+    
+    fullPath = HBufC::NewLC( KUrlMaxLen );
+    fullPathPtr.Set( fullPath->Des() );
+                
+    aFileData.GetStringAttribute( DRM::EDrmFullName, 
+        fullPathPtr );
+    
+    UpdateDCFRepositoryL( fullPathPtr );
+    CleanupStack::PopAndDestroy( fullPath );    
+    }
+
 // ============================ MEMBER FUNCTIONS ===============================
 
 // -----------------------------------------------------------------------------
@@ -1420,6 +1488,9 @@
     if ( ( !agent.Compare( DRM::KDrmOmaAgentName ) ) || ( iOmaBasedAgentName
         && !agent.Compare( *iOmaBasedAgentName ) ) )
         {
+        // To embed Domain RO in superdistribution case, register the content
+        TRAP_IGNORE( FindFullFileNameAndUpdateDCFRepositoryL( *aData.iFile ) );
+        
         HandleOmaErrorL( *content, aData.iIntent, aData.iError,
             aData.iErrorObserver, aData.iOperationId );
         }
@@ -1441,6 +1512,7 @@
 void DRM::CDrmUiHandlingImpl::PerformHandleErrorDataL(
     DRM::CDrmUiHandlingData& aData )
     {
+    
     DRM::TDrmAgentUid agentUid( DRM::EDrmOmaAgent );
     IsProtectedL( aData.iFileData, agentUid );
     IsProperErrorL( aData.iError );
@@ -1449,7 +1521,11 @@
     switch ( agentUid )
         {
         case DRM::EDrmOmaAgent:
-
+            
+            // To embed Domain RO in superdistribution case, register the content
+            TRAP_IGNORE( FindFullFileNameAndUpdateDCFRepositoryL( 
+                *aData.iFileData ) );
+            
             HandleOmaErrorL( *aData.iFileData, aData.iIntent, aData.iError,
                 aData.iErrorObserver, aData.iOperationId );
 
@@ -1557,7 +1633,10 @@
     HBufC* riUrl( NULL );
     HBufC* domainRiUrl( NULL );
     DRM::TDrmUiUrlType urlType( DRM::EUHRightsIssuerUrl );
-
+            
+    // To embed Domain RO in superdistribution case, register the content
+    TRAP_IGNORE( FindFullFileNameAndUpdateDCFRepositoryL( aContent ) );
+    
     User::LeaveIfError( GetContentIdLC( aContent, contentId ) );
     GetOmaSilentRightsUrlLC( aContent, silentUrl );
     GetOmaRightsIssuerLC( aContent, riUrl );
@@ -1714,7 +1793,7 @@
     TInt previewType( ContentAccess::ENoPreview );
     TUint32 reason( 0 );
     TBool handled( EFalse );
-
+    
     User::LeaveIfError( GetContentIdLC( aContent, contentId ) );
 
     // Check that this really is an error situation