harvester/harvesterplugins/WMVPlugin/src/harvesterwmvplugin.cpp
branchRCL_3
changeset 19 b73252188534
parent 13 4a4892eec172
--- a/harvester/harvesterplugins/WMVPlugin/src/harvesterwmvplugin.cpp	Thu Jul 15 19:07:24 2010 +0300
+++ b/harvester/harvesterplugins/WMVPlugin/src/harvesterwmvplugin.cpp	Thu Aug 19 10:20:41 2010 +0300
@@ -31,11 +31,24 @@
 #include "mdetextproperty.h"
 #include "mdeobjectwrapper.h"
 
-CHarvesterWmvPluginPropertyDefs::CHarvesterWmvPluginPropertyDefs() : CBase()
+CHarvesterWmvPluginPropertyDefs::CHarvesterWmvPluginPropertyDefs() : CBase(),
+    iCreationDatePropertyDef( NULL )
 	{
 	}
 
-void CHarvesterWmvPluginPropertyDefs::ConstructL(CMdEObjectDef& aObjectDef)
+void CHarvesterWmvPluginPropertyDefs::ConstructL( CMdEObjectDef& aObjectDef )
+    {
+    SetByObjectDefL( aObjectDef );
+    }
+
+CHarvesterWmvPluginPropertyDefs* CHarvesterWmvPluginPropertyDefs::NewL()
+    {
+    CHarvesterWmvPluginPropertyDefs* self = 
+        new (ELeave) CHarvesterWmvPluginPropertyDefs();
+    return self;
+    }
+
+void CHarvesterWmvPluginPropertyDefs::SetByObjectDefL( CMdEObjectDef& aObjectDef )
 	{
 	CMdENamespaceDef& nsDef = aObjectDef.NamespaceDef();
 	
@@ -55,16 +68,6 @@
     iGenrePropertyDef = &mediaDef.GetPropertyDefL( MdeConstants::MediaObject::KGenreProperty );
 	}
 
-CHarvesterWmvPluginPropertyDefs* CHarvesterWmvPluginPropertyDefs::NewL(CMdEObjectDef& aObjectDef)
-	{
-	CHarvesterWmvPluginPropertyDefs* self = 
-		new (ELeave) CHarvesterWmvPluginPropertyDefs();
-	CleanupStack::PushL( self );
-	self->ConstructL( aObjectDef );
-	CleanupStack::Pop( self );
-	return self;
-	}
-
 // ======== MEMBER FUNCTIONS ========
 
 // ---------------------------------------------------------------------------
@@ -89,9 +92,12 @@
     {
     WRITELOG( "CHarvesterWMVPlugin::~CHarvesterWMVPlugin()" );
     delete iPropDefs;
+    iPropDefs = NULL;
     
     delete iPhoneVideosPath;
+    iPhoneVideosPath = NULL;
     delete iMmcVideosPath;
+    iMmcVideosPath = NULL;
     }
 
 // ---------------------------------------------------------------------------
@@ -151,6 +157,7 @@
         {
         err = content->GetStringAttribute( ContentAccess::EMimeType, aMimeType );
         delete content;
+        content = NULL;
         }
     }
 
@@ -170,6 +177,8 @@
     {
     WRITELOG( "CHarvesterWMVPlugin::ConstructL()" );
     
+    iPropDefs = CHarvesterWmvPluginPropertyDefs::NewL();
+    
     TFileName videos = PathInfo::VideosPath();
     
     TFileName phonePath = PathInfo::PhoneMemoryRootPath();
@@ -294,13 +303,7 @@
     
     CMdEObject& mdeObject = aHD.MdeObject();
     
-    if( !iPropDefs )
-		{
-		CMdEObjectDef& objectDef = mdeObject.Def();
-		iPropDefs = CHarvesterWmvPluginPropertyDefs::NewL( objectDef );
-		// Prefetch max text lengt for validity checking
-		iMaxTextLength = iPropDefs->iGenrePropertyDef->MaxTextLengthL();
-		}
+    InitPropDefsL( mdeObject.Def() );
     
     if( ! mdeObject.Placeholder() )
     	{
@@ -366,3 +369,13 @@
         }   
     }
 
+void CHarvesterWMVPlugin::InitPropDefsL(CMdEObjectDef& aObjectDef)
+    {
+    if( !iPropDefs->iCreationDatePropertyDef )
+        {
+        iPropDefs->SetByObjectDefL( aObjectDef );
+        // Prefetch max text lengt for validity checking
+        iMaxTextLength = iPropDefs->iGenrePropertyDef->MaxTextLengthL();
+        }
+    }
+