harvester/harvesterplugins/WMVPlugin/src/harvesterwmvplugin.cpp
branchRCL_3
changeset 63 e538444823de
parent 47 b73252188534
--- a/harvester/harvesterplugins/WMVPlugin/src/harvesterwmvplugin.cpp	Wed Sep 15 12:40:59 2010 +0300
+++ b/harvester/harvesterplugins/WMVPlugin/src/harvesterwmvplugin.cpp	Wed Oct 13 15:02:02 2010 +0300
@@ -31,24 +31,11 @@
 #include "mdetextproperty.h"
 #include "mdeobjectwrapper.h"
 
-CHarvesterWmvPluginPropertyDefs::CHarvesterWmvPluginPropertyDefs() : CBase(),
-    iCreationDatePropertyDef( NULL )
+CHarvesterWmvPluginPropertyDefs::CHarvesterWmvPluginPropertyDefs() : CBase()
 	{
 	}
 
-void CHarvesterWmvPluginPropertyDefs::ConstructL( CMdEObjectDef& aObjectDef )
-    {
-    SetByObjectDefL( aObjectDef );
-    }
-
-CHarvesterWmvPluginPropertyDefs* CHarvesterWmvPluginPropertyDefs::NewL()
-    {
-    CHarvesterWmvPluginPropertyDefs* self = 
-        new (ELeave) CHarvesterWmvPluginPropertyDefs();
-    return self;
-    }
-
-void CHarvesterWmvPluginPropertyDefs::SetByObjectDefL( CMdEObjectDef& aObjectDef )
+void CHarvesterWmvPluginPropertyDefs::ConstructL(CMdEObjectDef& aObjectDef)
 	{
 	CMdENamespaceDef& nsDef = aObjectDef.NamespaceDef();
 	
@@ -68,6 +55,16 @@
     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 ========
 
 // ---------------------------------------------------------------------------
@@ -92,12 +89,9 @@
     {
     WRITELOG( "CHarvesterWMVPlugin::~CHarvesterWMVPlugin()" );
     delete iPropDefs;
-    iPropDefs = NULL;
     
     delete iPhoneVideosPath;
-    iPhoneVideosPath = NULL;
     delete iMmcVideosPath;
-    iMmcVideosPath = NULL;
     }
 
 // ---------------------------------------------------------------------------
@@ -157,7 +151,6 @@
         {
         err = content->GetStringAttribute( ContentAccess::EMimeType, aMimeType );
         delete content;
-        content = NULL;
         }
     }
 
@@ -177,8 +170,6 @@
     {
     WRITELOG( "CHarvesterWMVPlugin::ConstructL()" );
     
-    iPropDefs = CHarvesterWmvPluginPropertyDefs::NewL();
-    
     TFileName videos = PathInfo::VideosPath();
     
     TFileName phonePath = PathInfo::PhoneMemoryRootPath();
@@ -303,7 +294,13 @@
     
     CMdEObject& mdeObject = aHD.MdeObject();
     
-    InitPropDefsL( mdeObject.Def() );
+    if( !iPropDefs )
+		{
+		CMdEObjectDef& objectDef = mdeObject.Def();
+		iPropDefs = CHarvesterWmvPluginPropertyDefs::NewL( objectDef );
+		// Prefetch max text lengt for validity checking
+		iMaxTextLength = iPropDefs->iGenrePropertyDef->MaxTextLengthL();
+		}
     
     if( ! mdeObject.Placeholder() )
     	{
@@ -369,13 +366,3 @@
         }   
     }
 
-void CHarvesterWMVPlugin::InitPropDefsL(CMdEObjectDef& aObjectDef)
-    {
-    if( !iPropDefs->iCreationDatePropertyDef )
-        {
-        iPropDefs->SetByObjectDefL( aObjectDef );
-        // Prefetch max text lengt for validity checking
-        iMaxTextLength = iPropDefs->iGenrePropertyDef->MaxTextLengthL();
-        }
-    }
-