harvester/harvesterplugins/WMVPlugin/src/harvesterwmvplugin.cpp
changeset 43 c5e73110f733
parent 40 910a23996aa0
equal deleted inserted replaced
40:910a23996aa0 43:c5e73110f733
    29 #include <mdeobjectdef.h>
    29 #include <mdeobjectdef.h>
    30 #include "mdeobject.h"
    30 #include "mdeobject.h"
    31 #include "mdetextproperty.h"
    31 #include "mdetextproperty.h"
    32 #include "mdeobjectwrapper.h"
    32 #include "mdeobjectwrapper.h"
    33 
    33 
    34 CHarvesterWmvPluginPropertyDefs::CHarvesterWmvPluginPropertyDefs() : CBase()
    34 CHarvesterWmvPluginPropertyDefs::CHarvesterWmvPluginPropertyDefs() : CBase(),
       
    35     iCreationDatePropertyDef( NULL )
    35 	{
    36 	{
    36 	}
    37 	}
    37 
    38 
    38 void CHarvesterWmvPluginPropertyDefs::ConstructL(CMdEObjectDef& aObjectDef)
    39 void CHarvesterWmvPluginPropertyDefs::ConstructL( CMdEObjectDef& aObjectDef )
       
    40     {
       
    41     SetByObjectDefL( aObjectDef );
       
    42     }
       
    43 
       
    44 CHarvesterWmvPluginPropertyDefs* CHarvesterWmvPluginPropertyDefs::NewL()
       
    45     {
       
    46     CHarvesterWmvPluginPropertyDefs* self = 
       
    47         new (ELeave) CHarvesterWmvPluginPropertyDefs();
       
    48     return self;
       
    49     }
       
    50 
       
    51 void CHarvesterWmvPluginPropertyDefs::SetByObjectDefL( CMdEObjectDef& aObjectDef )
    39 	{
    52 	{
    40 	CMdENamespaceDef& nsDef = aObjectDef.NamespaceDef();
    53 	CMdENamespaceDef& nsDef = aObjectDef.NamespaceDef();
    41 	
    54 	
    42 	// Common property definitions
    55 	// Common property definitions
    43 	CMdEObjectDef& objectDef = nsDef.GetObjectDefL( MdeConstants::Object::KBaseObject );
    56 	CMdEObjectDef& objectDef = nsDef.GetObjectDefL( MdeConstants::Object::KBaseObject );
    53     iDescriptionPropertyDef = &mediaDef.GetPropertyDefL( MdeConstants::MediaObject::KDescriptionProperty );
    66     iDescriptionPropertyDef = &mediaDef.GetPropertyDefL( MdeConstants::MediaObject::KDescriptionProperty );
    54     iAuthorPropertyDef = &mediaDef.GetPropertyDefL( MdeConstants::MediaObject::KAuthorProperty );
    67     iAuthorPropertyDef = &mediaDef.GetPropertyDefL( MdeConstants::MediaObject::KAuthorProperty );
    55     iGenrePropertyDef = &mediaDef.GetPropertyDefL( MdeConstants::MediaObject::KGenreProperty );
    68     iGenrePropertyDef = &mediaDef.GetPropertyDefL( MdeConstants::MediaObject::KGenreProperty );
    56 	}
    69 	}
    57 
    70 
    58 CHarvesterWmvPluginPropertyDefs* CHarvesterWmvPluginPropertyDefs::NewL(CMdEObjectDef& aObjectDef)
       
    59 	{
       
    60 	CHarvesterWmvPluginPropertyDefs* self = 
       
    61 		new (ELeave) CHarvesterWmvPluginPropertyDefs();
       
    62 	CleanupStack::PushL( self );
       
    63 	self->ConstructL( aObjectDef );
       
    64 	CleanupStack::Pop( self );
       
    65 	return self;
       
    66 	}
       
    67 
       
    68 // ======== MEMBER FUNCTIONS ========
    71 // ======== MEMBER FUNCTIONS ========
    69 
    72 
    70 // ---------------------------------------------------------------------------
    73 // ---------------------------------------------------------------------------
    71 // Constructor
    74 // Constructor
    72 // ---------------------------------------------------------------------------
    75 // ---------------------------------------------------------------------------
   171 // ---------------------------------------------------------------------------
   174 // ---------------------------------------------------------------------------
   172 //
   175 //
   173 void CHarvesterWMVPlugin::ConstructL()
   176 void CHarvesterWMVPlugin::ConstructL()
   174     {
   177     {
   175     WRITELOG( "CHarvesterWMVPlugin::ConstructL()" );
   178     WRITELOG( "CHarvesterWMVPlugin::ConstructL()" );
       
   179     
       
   180     iPropDefs = CHarvesterWmvPluginPropertyDefs::NewL();
   176     
   181     
   177     TFileName videos = PathInfo::VideosPath();
   182     TFileName videos = PathInfo::VideosPath();
   178     
   183     
   179     TFileName phonePath = PathInfo::PhoneMemoryRootPath();
   184     TFileName phonePath = PathInfo::PhoneMemoryRootPath();
   180     phonePath.Append( videos );
   185     phonePath.Append( videos );
   296     {
   301     {
   297     WRITELOG( "CHarvesterWMVPlugin::HandleObjectPropertiesL()" );
   302     WRITELOG( "CHarvesterWMVPlugin::HandleObjectPropertiesL()" );
   298     
   303     
   299     CMdEObject& mdeObject = aHD.MdeObject();
   304     CMdEObject& mdeObject = aHD.MdeObject();
   300     
   305     
   301     if( !iPropDefs )
   306     InitPropDefsL( mdeObject.Def() );
   302 		{
       
   303 		CMdEObjectDef& objectDef = mdeObject.Def();
       
   304 		iPropDefs = CHarvesterWmvPluginPropertyDefs::NewL( objectDef );
       
   305 		// Prefetch max text lengt for validity checking
       
   306 		iMaxTextLength = iPropDefs->iGenrePropertyDef->MaxTextLengthL();
       
   307 		}
       
   308     
   307     
   309     if( ! mdeObject.Placeholder() )
   308     if( ! mdeObject.Placeholder() )
   310     	{
   309     	{
   311         // Creation date
   310         // Creation date
   312     	TTimeIntervalSeconds timeOffset = User::UTCOffset();
   311     	TTimeIntervalSeconds timeOffset = User::UTCOffset();
   368         CMdeObjectWrapper::HandleObjectPropertyL(mdeObject, 
   367         CMdeObjectWrapper::HandleObjectPropertyL(mdeObject, 
   369                 *iPropDefs->iGenrePropertyDef, &aClipDetails.iGenre, aIsAdd );
   368                 *iPropDefs->iGenrePropertyDef, &aClipDetails.iGenre, aIsAdd );
   370         }   
   369         }   
   371     }
   370     }
   372 
   371 
       
   372 void CHarvesterWMVPlugin::InitPropDefsL(CMdEObjectDef& aObjectDef)
       
   373     {
       
   374     if( !iPropDefs->iCreationDatePropertyDef )
       
   375         {
       
   376         iPropDefs->SetByObjectDefL( aObjectDef );
       
   377         // Prefetch max text lengt for validity checking
       
   378         iMaxTextLength = iPropDefs->iGenrePropertyDef->MaxTextLengthL();
       
   379         }
       
   380     }
       
   381