harvester/harvesterplugins/OMADRMPlugin/src/harvesteromadrmplugin.cpp
branchRCL_3
changeset 3 6752808b2036
parent 0 c53acadfccc6
child 7 3cebc1a84278
--- a/harvester/harvesterplugins/OMADRMPlugin/src/harvesteromadrmplugin.cpp	Tue Feb 02 00:24:33 2010 +0200
+++ b/harvester/harvesterplugins/OMADRMPlugin/src/harvesteromadrmplugin.cpp	Fri Feb 19 23:14:48 2010 +0200
@@ -266,16 +266,25 @@
     	CMdeObjectWrapper::HandleObjectPropertyL(mdeObject, 
     			*iPropDefs->iSizePropertyDef, &aVHD.iFileSize, aIsAdd );
     	}
+    
+    // Item Type
+    if(aVHD.iMimetype.Length() > 0)
+        {
+        TBool isAdd( EFalse );
+        CMdEProperty* prop = NULL;
+        TInt index = mdeObject.Property( *iPropDefs->iItemTypePropertyDef, prop );
+        if( index < 0 )
+            {
+            isAdd = ETrue;
+            }
+        CMdeObjectWrapper::HandleObjectPropertyL(mdeObject, 
+                *iPropDefs->iItemTypePropertyDef, &aVHD.iMimetype, isAdd );
+        }
+    
     // DRM protection
     CMdeObjectWrapper::HandleObjectPropertyL(mdeObject, 
     		*iPropDefs->iDrmPropertyDef, &aVHD.iDrmProtected, aIsAdd );
     
-    // Item Type
-    if(aVHD.iMimetype.Length() > 0)
-    	{
-    	CMdeObjectWrapper::HandleObjectPropertyL(mdeObject, 
-    			*iPropDefs->iItemTypePropertyDef, &aVHD.iMimetype, aIsAdd );
-    	}
     // Title (is set from URI by default)
     if(aVHD.iTitle.Length() > 0)
     	{
@@ -357,3 +366,22 @@
 	WRITELOG1( "CHarvesterOMADRMPlugin::GetObjectType - ERROR: mimetype %S. No object type found", &mime );
 	aObjectType.Zero();
 	}
+
+// ---------------------------------------------------------------------------
+// CHarvesterOMADRMPlugin::GetMimeType (from CHarvesterPlugin)
+// ---------------------------------------------------------------------------
+//    
+void CHarvesterOMADRMPlugin::GetMimeType( const TDesC& aUri, TDes& aMimeType )
+    {
+    aMimeType.Zero();
+    
+    ContentAccess::CContent* content = NULL;
+    
+    TRAPD( err, content = ContentAccess::CContent::NewL( aUri ) );
+    if (err == KErrNone) 
+        {
+        err = content->GetStringAttribute( ContentAccess::EMimeType, aMimeType );
+        delete content;
+        }
+    }
+