harvester/harvesterplugins/WMVPlugin/src/harvesterwmvplugin.cpp
branchRCL_3
changeset 47 b73252188534
parent 27 4a4892eec172
child 63 e538444823de
equal deleted inserted replaced
46:63c982fb92f2 47:b73252188534
    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 // ---------------------------------------------------------------------------
    87 //
    90 //
    88 CHarvesterWMVPlugin::~CHarvesterWMVPlugin()
    91 CHarvesterWMVPlugin::~CHarvesterWMVPlugin()
    89     {
    92     {
    90     WRITELOG( "CHarvesterWMVPlugin::~CHarvesterWMVPlugin()" );
    93     WRITELOG( "CHarvesterWMVPlugin::~CHarvesterWMVPlugin()" );
    91     delete iPropDefs;
    94     delete iPropDefs;
       
    95     iPropDefs = NULL;
    92     
    96     
    93     delete iPhoneVideosPath;
    97     delete iPhoneVideosPath;
       
    98     iPhoneVideosPath = NULL;
    94     delete iMmcVideosPath;
    99     delete iMmcVideosPath;
       
   100     iMmcVideosPath = NULL;
    95     }
   101     }
    96 
   102 
    97 // ---------------------------------------------------------------------------
   103 // ---------------------------------------------------------------------------
    98 // Harvest file
   104 // Harvest file
    99 // ---------------------------------------------------------------------------
   105 // ---------------------------------------------------------------------------
   149     TRAPD( err, content = ContentAccess::CContent::NewL( aUri ) );
   155     TRAPD( err, content = ContentAccess::CContent::NewL( aUri ) );
   150     if (err == KErrNone) 
   156     if (err == KErrNone) 
   151         {
   157         {
   152         err = content->GetStringAttribute( ContentAccess::EMimeType, aMimeType );
   158         err = content->GetStringAttribute( ContentAccess::EMimeType, aMimeType );
   153         delete content;
   159         delete content;
       
   160         content = NULL;
   154         }
   161         }
   155     }
   162     }
   156 
   163 
   157 // ---------------------------------------------------------------------------
   164 // ---------------------------------------------------------------------------
   158 // Default constructor
   165 // Default constructor
   167 // ---------------------------------------------------------------------------
   174 // ---------------------------------------------------------------------------
   168 //
   175 //
   169 void CHarvesterWMVPlugin::ConstructL()
   176 void CHarvesterWMVPlugin::ConstructL()
   170     {
   177     {
   171     WRITELOG( "CHarvesterWMVPlugin::ConstructL()" );
   178     WRITELOG( "CHarvesterWMVPlugin::ConstructL()" );
       
   179     
       
   180     iPropDefs = CHarvesterWmvPluginPropertyDefs::NewL();
   172     
   181     
   173     TFileName videos = PathInfo::VideosPath();
   182     TFileName videos = PathInfo::VideosPath();
   174     
   183     
   175     TFileName phonePath = PathInfo::PhoneMemoryRootPath();
   184     TFileName phonePath = PathInfo::PhoneMemoryRootPath();
   176     phonePath.Append( videos );
   185     phonePath.Append( videos );
   292     {
   301     {
   293     WRITELOG( "CHarvesterWMVPlugin::HandleObjectPropertiesL()" );
   302     WRITELOG( "CHarvesterWMVPlugin::HandleObjectPropertiesL()" );
   294     
   303     
   295     CMdEObject& mdeObject = aHD.MdeObject();
   304     CMdEObject& mdeObject = aHD.MdeObject();
   296     
   305     
   297     if( !iPropDefs )
   306     InitPropDefsL( mdeObject.Def() );
   298 		{
       
   299 		CMdEObjectDef& objectDef = mdeObject.Def();
       
   300 		iPropDefs = CHarvesterWmvPluginPropertyDefs::NewL( objectDef );
       
   301 		// Prefetch max text lengt for validity checking
       
   302 		iMaxTextLength = iPropDefs->iGenrePropertyDef->MaxTextLengthL();
       
   303 		}
       
   304     
   307     
   305     if( ! mdeObject.Placeholder() )
   308     if( ! mdeObject.Placeholder() )
   306     	{
   309     	{
   307         // Creation date
   310         // Creation date
   308     	TTimeIntervalSeconds timeOffset = User::UTCOffset();
   311     	TTimeIntervalSeconds timeOffset = User::UTCOffset();
   364         CMdeObjectWrapper::HandleObjectPropertyL(mdeObject, 
   367         CMdeObjectWrapper::HandleObjectPropertyL(mdeObject, 
   365                 *iPropDefs->iGenrePropertyDef, &aClipDetails.iGenre, aIsAdd );
   368                 *iPropDefs->iGenrePropertyDef, &aClipDetails.iGenre, aIsAdd );
   366         }   
   369         }   
   367     }
   370     }
   368 
   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