photosgallery/viewframework/drmutility/src/glxdrmutility.cpp
branchRCL_3
changeset 32 78ad99c24f08
parent 18 bcb43dc84c44
child 56 b023a8d2866a
equal deleted inserted replaced
30:a60acebbbd9d 32:78ad99c24f08
   152     
   152     
   153     return rightsValid;
   153     return rightsValid;
   154     }
   154     }
   155 
   155 
   156 //============================================================================
   156 //============================================================================
       
   157 // ItemRightsValidityCheckL
       
   158 // for checking DRM rights validity for item.
       
   159 // is called before right is consumed and for all items (focused or unfocused).
       
   160 //============================================================================
       
   161 EXPORT_C TBool CGlxDRMUtility::ItemRightsValidityCheckL( RFile& aFileHandle,
       
   162                                                 TBool aCheckViewRights )
       
   163     {
       
   164     TRACER("CGlxDRMUtility::ItemRightsValidityCheckL()");
       
   165     TBool rightsValid = EFalse;
       
   166 
       
   167     ContentAccess::CContent* content = ContentAccess::CContent::NewLC( aFileHandle );
       
   168     TInt err( content->GetAttribute( ContentAccess::ECanView, rightsValid ) );
       
   169     CleanupStack::PopAndDestroy( content );
       
   170     return rightsValid;
       
   171     }
       
   172 
       
   173 //============================================================================
   157 // DisplayItemRightsCheckL
   174 // DisplayItemRightsCheckL
   158 // is called after right is consumed and for only focused/displayed item.
   175 // is called after right is consumed and for only focused/displayed item.
   159 //============================================================================
   176 //============================================================================
   160 EXPORT_C TBool CGlxDRMUtility::DisplayItemRightsCheckL( const TDesC& aUri,
   177 EXPORT_C TBool CGlxDRMUtility::DisplayItemRightsCheckL( const TDesC& aUri,
   161                                                     TBool aCheckViewRights )
   178                                                     TBool aCheckViewRights )
   177     // Otherwise, check current rights for the URI of newly focused item
   194     // Otherwise, check current rights for the URI of newly focused item
   178     return ItemRightsValidityCheckL( aUri, aCheckViewRights );
   195     return ItemRightsValidityCheckL( aUri, aCheckViewRights );
   179     }
   196     }
   180 
   197 
   181 //============================================================================
   198 //============================================================================
       
   199 // DisplayItemRightsCheckL
       
   200 // is called after right is consumed and for only focused/displayed item.
       
   201 //============================================================================
       
   202 EXPORT_C TBool CGlxDRMUtility::DisplayItemRightsCheckL( RFile& aFileHandle,
       
   203                                                     TBool aCheckViewRights )
       
   204     {
       
   205     TRACER("CGlxDRMUtility::DisplayItemRightsCheckL()");
       
   206     // Otherwise, check current rights for the URI of newly focused item
       
   207     return ItemRightsValidityCheckL( aFileHandle, aCheckViewRights );
       
   208     }
       
   209 
       
   210 
       
   211 //============================================================================
   182 // ConsumeRightsL
   212 // ConsumeRightsL
   183 //============================================================================    
   213 //============================================================================    
   184 EXPORT_C TBool CGlxDRMUtility::ConsumeRightsL(const TDesC& aUri)
   214 EXPORT_C TBool CGlxDRMUtility::ConsumeRightsL(const TDesC& aUri)
   185     {
   215     {
   186     TRACER("CGlxDRMUtility::ConsumeRightsL()");
   216     TRACER("CGlxDRMUtility::ConsumeRightsL()");
   204         newPtr.Copy( aUri );
   234         newPtr.Copy( aUri );
   205         }
   235         }
   206 
   236 
   207     CleanupStack::PopAndDestroy(data);
   237     CleanupStack::PopAndDestroy(data);
   208 
   238 
       
   239     return (err == KErrNone);
       
   240     }
       
   241 
       
   242 
       
   243 //============================================================================
       
   244 // ConsumeRightsL
       
   245 //============================================================================    
       
   246 EXPORT_C TBool CGlxDRMUtility::ConsumeRightsL(RFile& aFileHandle)
       
   247     {
       
   248     TRACER("CGlxDRMUtility::ConsumeRightsL(RFile& aFileHandle)");
       
   249     CData* data = CData::NewLC( aFileHandle, KDefaultContentObject(), EPeek );
       
   250     TInt err = data->ExecuteIntent(ContentAccess::EView);
       
   251     CleanupStack::PopAndDestroy( data );
   209     return (err == KErrNone);
   252     return (err == KErrNone);
   210     }
   253     }
   211 
   254 
   212 //============================================================================
   255 //============================================================================
   213 //Clears Last Consumed Uri
   256 //Clears Last Consumed Uri
   313         }
   356         }
   314 
   357 
   315     }
   358     }
   316 
   359 
   317 //============================================================================
   360 //============================================================================
       
   361 // ShowDRMDetailsPane
       
   362 //============================================================================  
       
   363 EXPORT_C void CGlxDRMUtility::ShowDRMDetailsPaneL(RFile& aFileHandle)
       
   364     {
       
   365     TRACER("CGlxDRMUtility::ShowDRMDetailsPaneL()");
       
   366     TRAPD( err, iDrmHelper->LaunchDetailsViewEmbeddedL( aFileHandle ) );
       
   367     // if no rights ask user to re-activate
       
   368     if( err == KErrCANoRights )
       
   369         {
       
   370         //need to check if we need to handle.
       
   371         }
       
   372 
       
   373     }
       
   374 
       
   375 //============================================================================
   318 // IsForwardLockedL
   376 // IsForwardLockedL
   319 //============================================================================  
   377 //============================================================================  
   320 EXPORT_C TBool CGlxDRMUtility::IsForwardLockedL(const TDesC& aUri)
   378 EXPORT_C TBool CGlxDRMUtility::IsForwardLockedL(const TDesC& aUri)
   321     {
   379     {
   322     TRACER("CGlxDRMUtility::IsForwardLockedL()");
   380     TRACER("CGlxDRMUtility::IsForwardLockedL()");
   334 //============================================================================    
   392 //============================================================================    
   335 EXPORT_C void CGlxDRMUtility::ShowRightsInfoL(const TDesC& aUri)    
   393 EXPORT_C void CGlxDRMUtility::ShowRightsInfoL(const TDesC& aUri)    
   336     {
   394     {
   337     TRACER("CGlxDRMUtility::ShowRightsInfoL()");
   395     TRACER("CGlxDRMUtility::ShowRightsInfoL()");
   338     iDrmHelper->CheckRightsAmountL( aUri );
   396     iDrmHelper->CheckRightsAmountL( aUri );
       
   397     }
       
   398 
       
   399 //============================================================================
       
   400 // ShowRightsInfoL
       
   401 //============================================================================    
       
   402 EXPORT_C void CGlxDRMUtility::ShowRightsInfoL(RFile& aFileHandle)    
       
   403     {
       
   404     TRACER("CGlxDRMUtility::ShowRightsInfoL(aFileHandle)");
       
   405     iDrmHelper->CheckRightsAmountL( aFileHandle );
   339     }
   406     }
   340 
   407 
   341 //============================================================================
   408 //============================================================================
   342 // Return size for DRM thumbnail request.
   409 // Return size for DRM thumbnail request.
   343 //============================================================================
   410 //============================================================================