harvester/harvesterplugins/MessagePlugin/src/harvestermessageplugin.cpp
branchRCL_3
changeset 15 3cebc1a84278
parent 0 c53acadfccc6
child 19 82c0024438c8
equal deleted inserted replaced
14:646a02f170b9 15:3cebc1a84278
    28 #include <mtclreg.h>
    28 #include <mtclreg.h>
    29 #include <mmsclient.h>
    29 #include <mmsclient.h>
    30 #include <mdetextproperty.h>
    30 #include <mdetextproperty.h>
    31 
    31 
    32 #include "harvestermessageplugin.h"
    32 #include "harvestermessageplugin.h"
       
    33 #include "harvestercommon.h"
    33 #include "harvesterlog.h"
    34 #include "harvesterlog.h"
    34 #include "mdsutils.h"
    35 #include "mdsutils.h"
    35 #include "mdeobjectdef.h"
    36 #include "mdeobjectdef.h"
    36 
    37 
    37 #ifdef _DEBUG
    38 #ifdef _DEBUG
   281 	}
   282 	}
   282 
   283 
   283 void CHarvesterMessagePlugin::SetPropertiesL( CHarvesterData& aHD )
   284 void CHarvesterMessagePlugin::SetPropertiesL( CHarvesterData& aHD )
   284 	{	    
   285 	{	    
   285 	WRITELOG( "CHarvesterMessagePlugin::SetPropertiesL enter" );
   286 	WRITELOG( "CHarvesterMessagePlugin::SetPropertiesL enter" );
   286 	CMdEObject& aMetadataObject = aHD.MdeObject();
   287 	CMdEObject& metadataObject = aHD.MdeObject();
   287 	
   288 	
   288 	CMdEObjectDef& messageObjectDef = aMetadataObject.Def();
   289 	CMdEObjectDef& messageObjectDef = metadataObject.Def();
   289 	
   290 	
   290 	CMdEPropertyDef& creationTimeDef = messageObjectDef.GetPropertyDefL( 									  
   291 	CMdEPropertyDef& creationTimeDef = messageObjectDef.GetPropertyDefL( 									  
   291 		MdeConstants::Object::KCreationDateProperty ) ;
   292 		MdeConstants::Object::KCreationDateProperty ) ;
   292 	
   293 	
   293 	CMdEPropertyDef& lastModTimeDef = messageObjectDef.GetPropertyDefL(
   294 	CMdEPropertyDef& lastModTimeDef = messageObjectDef.GetPropertyDefL(
   316 	TTime now;
   317 	TTime now;
   317 	now.HomeTime();
   318 	now.HomeTime();
   318 	
   319 	
   319 	if ( EHarvesterAdd == aHD.EventType() )
   320 	if ( EHarvesterAdd == aHD.EventType() )
   320 		{
   321 		{
   321 		aMetadataObject.AddTimePropertyL( creationTimeDef, now );			
   322 	    metadataObject.AddTimePropertyL( creationTimeDef, now );			
   322 		aMetadataObject.AddTimePropertyL( lastModTimeDef, iDate );										
   323 	    metadataObject.AddTimePropertyL( lastModTimeDef, iDate );										
   323 		aMetadataObject.AddBoolPropertyL( receivedDef, iIncoming );
   324 	    metadataObject.AddBoolPropertyL( receivedDef, iIncoming );
   324 		if (iFromOrTo && iFromOrTo->Length())
   325 		if (iFromOrTo && iFromOrTo->Length())
   325 			{
   326 			{
   326 			aMetadataObject.AddTextPropertyL( textDef, *iFromOrTo );
   327 		    metadataObject.AddTextPropertyL( textDef, *iFromOrTo );
   327 			}
   328 			}
   328 		aMetadataObject.AddTextPropertyL( ItemtypeDef, iItemType );									
   329 		metadataObject.AddTextPropertyL( ItemtypeDef, iItemType );									
   329 		aMetadataObject.AddUint32PropertyL( sizeDef, iSize );
   330 		metadataObject.AddUint32PropertyL( sizeDef, iSize );
   330 		aMetadataObject.AddInt16PropertyL( offSetDef, timeOffset.Int() / 60 );
   331 		metadataObject.AddInt16PropertyL( offSetDef, timeOffset.Int() / 60 );
   331 		
   332 		
   332 		CMdEProperty* prop = NULL;	
   333 		CMdEProperty* prop = NULL;	
   333 		TInt index = aMetadataObject.Property( titleDef, prop );
   334 		TInt index = metadataObject.Property( titleDef, prop );
   334 		
   335 		
   335 		if (iSubject.Length())
   336 		if (iSubject.Length())
   336 			{
   337 			{
   337 			if( prop )
   338 			if( prop )
   338 				{
   339 				{
   339 				prop->SetTextValueL( iSubject );
   340 				prop->SetTextValueL( iSubject );
   340 				}
   341 				}
   341 			else
   342 			else
   342 				{
   343 				{
   343 				aMetadataObject.AddTextPropertyL( titleDef, iSubject );
   344 			    metadataObject.AddTextPropertyL( titleDef, iSubject );
   344 				}
   345 				}
   345 			}
   346 			}
   346 		else
   347 		else
   347 			{
   348 			{
   348 			if (iFromOrTo && iFromOrTo->Length())
   349 			if (iFromOrTo && iFromOrTo->Length())
   351 					{
   352 					{
   352 					prop->SetTextValueL( *iFromOrTo );
   353 					prop->SetTextValueL( *iFromOrTo );
   353 					}
   354 					}
   354 				else
   355 				else
   355 					{
   356 					{
   356 					aMetadataObject.AddTextPropertyL( titleDef, *iFromOrTo );
   357 				    metadataObject.AddTextPropertyL( titleDef, *iFromOrTo );
   357 					}
   358 					}
   358 				}
   359 				}
   359 			}
   360 			}
   360 		}
   361 		}
   361 	else
   362 	else
   362 		{	
   363 		{	
   363 		CMdEProperty* prop = NULL;	
   364 		CMdEProperty* prop = NULL;	
   364 		TInt index = aMetadataObject.Property( textDef, prop );
   365 		TInt index = metadataObject.Property( textDef, prop );
   365 		if (iFromOrTo && iFromOrTo->Length())
   366 		if (iFromOrTo && iFromOrTo->Length())
   366 			{
   367 			{
   367 			if (prop)
   368 			if (prop)
   368 				{
   369 				{
   369 				prop->SetTextValueL( *iFromOrTo );
   370 				prop->SetTextValueL( *iFromOrTo );
   370 				}
   371 				}
   371 			else
   372 			else
   372 				{
   373 				{
   373 				aMetadataObject.AddTextPropertyL( textDef, *iFromOrTo );
   374 			    metadataObject.AddTextPropertyL( textDef, *iFromOrTo );
   374 				}
   375 				}
   375 			}
   376 			}
   376 		else if (index >= 0)
   377 		else if (index >= 0)
   377 			{
   378 			{
   378 			aMetadataObject.RemoveProperty(index);
   379 		    metadataObject.RemoveProperty(index);
   379 			}
   380 			}
   380 		
   381 		
   381 		aMetadataObject.Property( sizeDef, prop );
   382 		metadataObject.Property( sizeDef, prop );
   382 		static_cast<CMdEUint32Property *>(prop)->SetValueL( iSize );
   383 		static_cast<CMdEUint32Property *>(prop)->SetValueL( iSize );
   383 		
   384 		
   384 		aMetadataObject.Property( lastModTimeDef, prop );
   385 		metadataObject.Property( lastModTimeDef, prop );
   385 		static_cast <CMdETimeProperty *>(prop)->SetValueL( iDate );										
   386 		static_cast <CMdETimeProperty *>(prop)->SetValueL( iDate );										
   386 		}
   387 		}
   387 
   388 
   388     iStatus = KErrNone;
   389     iStatus = KErrNone;
   389 	WRITELOG( "CHarvesterMessagePlugin::SetPropertiesL return" );
   390 	WRITELOG( "CHarvesterMessagePlugin::SetPropertiesL return" );