filemanager/Engine/src/CFileManagerUtils.cpp
branchRCL_3
changeset 12 60626d494346
parent 5 1e73d2d04cbc
child 20 efe289f793e7
equal deleted inserted replaced
10:1772663c5b4e 12:60626d494346
   206 
   206 
   207 // -----------------------------------------------------------------------------
   207 // -----------------------------------------------------------------------------
   208 // CFileManagerUtils::IsDrmProtectedFile
   208 // CFileManagerUtils::IsDrmProtectedFile
   209 // -----------------------------------------------------------------------------
   209 // -----------------------------------------------------------------------------
   210 //
   210 //
   211 TBool CFileManagerUtils::IsDrmProtectedFile( const TDesC& aFullPath ) const
   211 TBool CFileManagerUtils::IsDrmProtectedFileL( const TDesC& aFullPath ) const
   212     {
   212     {
   213     if ( !iDrmFullSupported )
   213     if ( !iDrmFullSupported )
   214         {
   214         {
   215         return EFalse; // Partial DRM is used
   215         return EFalse; // Partial DRM is used
   216         }
   216         }
   224 #else
   224 #else
   225     // Do similar quick check than in old DRMCommon
   225     // Do similar quick check than in old DRMCommon
   226    
   226    
   227     RFile64 drmFile;
   227     RFile64 drmFile;
   228     
   228     
   229     User::LeaveIfError( drmFile.Open( 
   229     TInt err = drmFile.Open( 
   230         iFs, aFullPath, EFileRead | EFileShareReadersOrWriters ) );
   230         iFs, aFullPath, EFileRead | EFileShareReadersOrWriters );
       
   231     if( err != KErrNone )
       
   232         {
       
   233         // Just assume it is not protected when we fail to open it.
       
   234         drmFile.Close();
       
   235         return EFalse;
       
   236         }
   231     CleanupClosePushL( drmFile );
   237     CleanupClosePushL( drmFile );
   232     DRM::CDrmUtility *drmCheck = DRM::CDrmUtility::NewLC();
   238     DRM::CDrmUtility *drmCheck = DRM::CDrmUtility::NewLC();
   233        
   239        
   234     TBool isProtected( EFalse );        
   240     TBool isProtected( EFalse );        
   235     TRAP_IGNORE( isProtected = drmCheck->IsProtectedL( drmFile ) ); 
   241     TRAP_IGNORE( isProtected = drmCheck->IsProtectedL( drmFile ) ); 
   353             }
   359             }
   354         else
   360         else
   355             {
   361             {
   356             fileType |= CFileManagerItemProperties::EFile;
   362             fileType |= CFileManagerItemProperties::EFile;
   357 
   363 
   358             if ( IsDrmProtectedFile( aFullPath) )
   364             if ( IsDrmProtectedFileL( aFullPath) )
   359                 {
   365                 {
   360                 fileType |= CFileManagerItemProperties::EDrmProtected;
   366                 fileType |= CFileManagerItemProperties::EDrmProtected;
   361                 if ( IsDrmLocalDataFile( aFullPath ) )
   367                 if ( IsDrmLocalDataFile( aFullPath ) )
   362                     {
   368                     {
   363                     fileType |= CFileManagerItemProperties::EDrmLocalDataFile;
   369                     fileType |= CFileManagerItemProperties::EDrmLocalDataFile;
   400             fileType |= CFileManagerItemProperties::EFolder;
   406             fileType |= CFileManagerItemProperties::EFolder;
   401             }
   407             }
   402         else
   408         else
   403             {
   409             {
   404             fileType |= CFileManagerItemProperties::EFile;
   410             fileType |= CFileManagerItemProperties::EFile;
   405             if ( IsDrmProtectedFile( aFullPath) )
   411             if ( IsDrmProtectedFileL( aFullPath) )
   406                 {
   412                 {
   407                 fileType |= CFileManagerItemProperties::EDrmProtected;
   413                 fileType |= CFileManagerItemProperties::EDrmProtected;
   408                 }
   414                 }
   409             }
   415             }
   410         }
   416         }