harvester/harvesterplugins/OMADRMPlugin/src/harvesteromadrmplugin.cpp
changeset 21 50bf9db68373
parent 20 6dfc5f825351
child 23 33ae025ac1e8
equal deleted inserted replaced
20:6dfc5f825351 21:50bf9db68373
    56 
    56 
    57 	CMdEObjectDef& mediaDef = nsDef.GetObjectDefL( MdeConstants::MediaObject::KMediaObject );
    57 	CMdEObjectDef& mediaDef = nsDef.GetObjectDefL( MdeConstants::MediaObject::KMediaObject );
    58 	iDrmPropertyDef = &mediaDef.GetPropertyDefL( MdeConstants::MediaObject::KDRMProperty );
    58 	iDrmPropertyDef = &mediaDef.GetPropertyDefL( MdeConstants::MediaObject::KDRMProperty );
    59 	iDescriptionPropertyDef = &mediaDef.GetPropertyDefL( MdeConstants::MediaObject::KDescriptionProperty );
    59 	iDescriptionPropertyDef = &mediaDef.GetPropertyDefL( MdeConstants::MediaObject::KDescriptionProperty );
    60 	iAuthorPropertyDef = &mediaDef.GetPropertyDefL( MdeConstants::MediaObject::KAuthorProperty );
    60 	iAuthorPropertyDef = &mediaDef.GetPropertyDefL( MdeConstants::MediaObject::KAuthorProperty );
       
    61 	iGenrePropertyDef = &mediaDef.GetPropertyDefL( MdeConstants::MediaObject::KGenreProperty );
    61 	}
    62 	}
    62 
    63 
    63 CHarvesterOmaDrmPluginPropertyDefs* CHarvesterOmaDrmPluginPropertyDefs::NewL(CMdEObjectDef& aObjectDef)
    64 CHarvesterOmaDrmPluginPropertyDefs* CHarvesterOmaDrmPluginPropertyDefs::NewL(CMdEObjectDef& aObjectDef)
    64 	{
    65 	{
    65 	CHarvesterOmaDrmPluginPropertyDefs* self = 
    66 	CHarvesterOmaDrmPluginPropertyDefs* self = 
   165     
   166     
   166     aVHD.iModified = entry->iModified;
   167     aVHD.iModified = entry->iModified;
   167     aVHD.iFileSize = (TUint)entry->iSize;
   168     aVHD.iFileSize = (TUint)entry->iSize;
   168     CleanupStack::PopAndDestroy( entry );
   169     CleanupStack::PopAndDestroy( entry );
   169     
   170     
   170     ContentAccess::CContent* content = NULL;
   171     ContentAccess::CContent* content = ContentAccess::CContent::NewLC( uri );   
   171     content = ContentAccess::CContent::NewLC( uri );
   172     ContentAccess::CData* data = content->OpenContentLC( ContentAccess::EPeek );
   172     
   173     
   173     ContentAccess::RStringAttributeSet attrSet;
   174     ContentAccess::RStringAttributeSet attrSet;
   174     CleanupClosePushL( attrSet );
   175     CleanupClosePushL( attrSet );
   175     
   176     
   176     attrSet.AddL( ContentAccess::EDescription );
   177     attrSet.AddL( ContentAccess::EDescription );
   177     attrSet.AddL( ContentAccess::EMimeType );
   178     attrSet.AddL( ContentAccess::EMimeType );
   178     attrSet.AddL( ContentAccess::ETitle );
   179     attrSet.AddL( ContentAccess::ETitle );
   179     attrSet.AddL( ContentAccess::EAuthor );
   180     attrSet.AddL( ContentAccess::EAuthor );
   180     
   181     attrSet.AddL( ContentAccess::EGenre );
   181     User::LeaveIfError( content->GetStringAttributeSet(attrSet) );
   182 
       
   183     User::LeaveIfError( data->GetStringAttributeSet(attrSet) );
   182     
   184     
   183     TInt err = attrSet.GetValue( ContentAccess::EDescription, aVHD.iDescription );
   185     TInt err = attrSet.GetValue( ContentAccess::EDescription, aVHD.iDescription );
   184     if ( err != KErrNone)
   186     if ( err != KErrNone)
   185         {
   187         {
   186         WRITELOG1( "CHarvesterOMADRMPlugin::GatherDataL - ERROR: getting description failed %d", err );
   188         WRITELOG1( "CHarvesterOMADRMPlugin::GatherDataL - ERROR: getting description failed %d", err );
   221         
   223         
   222     if ( aVHD.iAuthor.Length() <= 0 )
   224     if ( aVHD.iAuthor.Length() <= 0 )
   223         {
   225         {
   224         WRITELOG( "CHarvesterOMADRMPlugin::GatherDataL - no author" );
   226         WRITELOG( "CHarvesterOMADRMPlugin::GatherDataL - no author" );
   225         }
   227         }
       
   228 
       
   229     err = attrSet.GetValue( ContentAccess::EGenre, aVHD.iGenre );
       
   230     if ( err != KErrNone)
       
   231         {
       
   232         WRITELOG1( "CHarvesterOMADRMPlugin::GatherDataL - ERROR: getting genre failed %d", err );
       
   233         }
       
   234         
       
   235     if ( aVHD.iGenre.Length() <= 0 )
       
   236         {
       
   237         WRITELOG( "CHarvesterOMADRMPlugin::GatherDataL - no genre" );
       
   238         }
   226     
   239     
   227     err = content->GetAttribute( ContentAccess::EIsProtected, aVHD.iDrmProtected );
   240     err = content->GetAttribute( ContentAccess::EIsProtected, aVHD.iDrmProtected );
   228     if ( err != KErrNone)
   241     if ( err != KErrNone)
   229         {
   242         {
   230         WRITELOG1( "CHarvesterOMADRMPlugin::GatherDataL - ERROR: getting protection info failed %d", err );
   243         WRITELOG1( "CHarvesterOMADRMPlugin::GatherDataL - ERROR: getting protection info failed %d", err );
   231         }
   244         }
   232         
   245         
   233     CleanupStack::PopAndDestroy( 2, content );
   246     CleanupStack::PopAndDestroy( 3 ); // content, data, attrSet
   234     }
   247     }
   235 
   248 
   236 // ---------------------------------------------------------------------------
   249 // ---------------------------------------------------------------------------
   237 // HandleNewObjectL
   250 // HandleNewObjectL
   238 // ---------------------------------------------------------------------------
   251 // ---------------------------------------------------------------------------
   301     if(aVHD.iAuthor.Length() > 0)
   314     if(aVHD.iAuthor.Length() > 0)
   302     	{
   315     	{
   303     	CMdeObjectWrapper::HandleObjectPropertyL(mdeObject, 
   316     	CMdeObjectWrapper::HandleObjectPropertyL(mdeObject, 
   304     			*iPropDefs->iAuthorPropertyDef, &aVHD.iAuthor, aIsAdd );
   317     			*iPropDefs->iAuthorPropertyDef, &aVHD.iAuthor, aIsAdd );
   305     	}
   318     	}
       
   319     // Genre
       
   320     if(aVHD.iGenre.Length() > 0)
       
   321         {
       
   322         CMdeObjectWrapper::HandleObjectPropertyL(mdeObject, 
       
   323                 *iPropDefs->iGenrePropertyDef, &aVHD.iGenre, aIsAdd );
       
   324         }
   306     }
   325     }
   307 
   326 
   308 // ---------------------------------------------------------------------------
   327 // ---------------------------------------------------------------------------
   309 // ChangeObjectType
   328 // ChangeObjectType
   310 // ---------------------------------------------------------------------------
   329 // ---------------------------------------------------------------------------