harvester/harvesterplugins/WMVPlugin/src/harvesterwmvplugin.cpp
changeset 43 c5e73110f733
parent 40 910a23996aa0
--- a/harvester/harvesterplugins/WMVPlugin/src/harvesterwmvplugin.cpp	Fri Jul 23 10:03:59 2010 +0300
+++ b/harvester/harvesterplugins/WMVPlugin/src/harvesterwmvplugin.cpp	Fri Aug 06 09:56:02 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 ========
 
 // ---------------------------------------------------------------------------
@@ -174,6 +177,8 @@
     {
     WRITELOG( "CHarvesterWMVPlugin::ConstructL()" );
     
+    iPropDefs = CHarvesterWmvPluginPropertyDefs::NewL();
+    
     TFileName videos = PathInfo::VideosPath();
     
     TFileName phonePath = PathInfo::PhoneMemoryRootPath();
@@ -298,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() )
     	{
@@ -370,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();
+        }
+    }
+