locationmanager/locationtrail/src/locationremappingao.cpp
branchRCL_3
changeset 8 50de4d668bb6
parent 7 3cebc1a84278
child 19 b73252188534
equal deleted inserted replaced
7:3cebc1a84278 8:50de4d668bb6
   270 
   270 
   271 	count = iObjectIds.Count();
   271 	count = iObjectIds.Count();
   272 	for (TInt i = 0; i < count; i++)
   272 	for (TInt i = 0; i < count; i++)
   273 		{
   273 		{
   274 		CMdEObject* location = iMdEClient->OpenObjectL(iObjectIds[i], *iObjLocationDef);
   274 		CMdEObject* location = iMdEClient->OpenObjectL(iObjectIds[i], *iObjLocationDef);
   275 		CleanupStack::PushL( location );
       
   276 		
   275 		
   277 		if (location->PropertyCount(*iPropLatDef) == 0)
   276 		if(location)
   278 			{
   277 		    {
   279 			location->AddReal64PropertyL(*iPropLatDef, iLocationData.iPosition.Latitude());
   278             CleanupStack::PushL( location );
   280 			LOG( "CLocationRemappingAO::RemapObjects - wrote latitude" );
   279 		
   281 			}
   280             if (location->PropertyCount(*iPropLatDef) == 0)
   282 		if (location->PropertyCount(*iPropLongDef) == 0)
   281                 {
   283 			{
   282                 location->AddReal64PropertyL(*iPropLatDef, iLocationData.iPosition.Latitude());
   284 			location->AddReal64PropertyL(*iPropLongDef, iLocationData.iPosition.Longitude());
   283                 LOG( "CLocationRemappingAO::RemapObjects - wrote latitude" );
   285 			LOG( "CLocationRemappingAO::RemapObjects - wrote longitude" );
   284                 }
   286 			}
   285             if (location->PropertyCount(*iPropLongDef) == 0)
   287 		if (location->PropertyCount(*iPropAltDef) == 0)
   286                 {
   288 			{
   287                 location->AddReal64PropertyL(*iPropLongDef, iLocationData.iPosition.Longitude());
   289 			location->AddReal64PropertyL(*iPropAltDef, iLocationData.iPosition.Altitude());
   288                 LOG( "CLocationRemappingAO::RemapObjects - wrote longitude" );
   290 			LOG( "CLocationRemappingAO::RemapObjects - wrote altitude" );
   289                 }
   291 			}
   290             if (location->PropertyCount(*iPropAltDef) == 0)
   292 		CMdEProperty* modProp = NULL;
   291                 {
   293 		location->Property( *iPropModifiedDef, modProp, 0 );
   292                 location->AddReal64PropertyL(*iPropAltDef, iLocationData.iPosition.Altitude());
   294 		if ( modProp )
   293                 LOG( "CLocationRemappingAO::RemapObjects - wrote altitude" );
   295 			{
   294                 }
   296 			TTime timestamp( 0 );
   295             CMdEProperty* modProp = NULL;
   297 			timestamp.UniversalTime();
   296             location->Property( *iPropModifiedDef, modProp, 0 );
   298 			modProp->SetTimeValueL( timestamp );
   297             if ( modProp )
   299 			}
   298                 {
   300 		iObjects.AppendL(location);
   299                 TTime timestamp( 0 );
   301 		CleanupStack::Pop( location );
   300                 timestamp.UniversalTime();
       
   301                 modProp->SetTimeValueL( timestamp );
       
   302                 }
       
   303             iObjects.AppendL(location);
       
   304             CleanupStack::Pop( location );
       
   305             
       
   306           }
   302 		}
   307 		}
   303 	count = iRemapItems.Count();
   308 	count = iRemapItems.Count();
   304 	LOG1("CLocationRemappingAO::RemapObjectsL - updating relations, count:%d", count);
   309 	LOG1("CLocationRemappingAO::RemapObjectsL - updating relations, count:%d", count);
   305 	// update relation timestamp, composer will then update exif data
   310 	// update relation timestamp, composer will then update exif data
   306 	for( TInt i = 0; i < count; i++ )
   311 	for( TInt i = 0; i < count; i++ )
   307 		{
   312 		{
   308 		CMdERelation* relation = NULL;
   313 		CMdERelation* relation = NULL;
   309 		relation = iMdEClient->GetRelationL( iRemapItems[i].iRelationId );
   314 		relation = iMdEClient->GetRelationL( iRemapItems[i].iRelationId );
   310 		
   315 		
   311     	TTime timestamp( 0 );
   316 		if(relation)
   312     	timestamp.UniversalTime();
   317 		    {   
   313     	relation->SetLastModifiedDate( timestamp );
   318             TTime timestamp( 0 );
       
   319             timestamp.UniversalTime();
       
   320             relation->SetLastModifiedDate( timestamp );
   314     	
   321     	
   315     	iMdEClient->UpdateRelationL( *relation );
   322             iMdEClient->UpdateRelationL( *relation );
   316 		}
   323 		    }
       
   324 		}
       
   325 	
   317 	LOG("CLocationRemappingAO::RemapObjectsL - relations updated");
   326 	LOG("CLocationRemappingAO::RemapObjectsL - relations updated");
   318 	
   327 	
   319 	iObjectIds.Reset();
   328 	iObjectIds.Reset();
   320 	ResetQueue();
   329 	ResetQueue();
   321 	
   330