locationmanager/locationtrail/src/locationremappingao.cpp
changeset 54 a3cc46f37772
parent 36 aa5a574040a4
equal deleted inserted replaced
36:aa5a574040a4 54:a3cc46f37772
   383 		{
   383 		{
   384 		CMdERelation* relation = NULL;
   384 		CMdERelation* relation = NULL;
   385 		relation = iMdEClient->GetRelationL( iRemapItems[i].iRelationId );
   385 		relation = iMdEClient->GetRelationL( iRemapItems[i].iRelationId );
   386 		
   386 		
   387 		if(relation)
   387 		if(relation)
   388 		    {   
   388 		    {
       
   389 		    CleanupStack::PushL(relation);
   389             TTime timestamp( 0 );
   390             TTime timestamp( 0 );
   390             timestamp.UniversalTime();
   391             timestamp.UniversalTime();
   391             relation->SetLastModifiedDate( timestamp );
   392             relation->SetLastModifiedDate( timestamp );
   392     	
   393     	
   393             iMdEClient->UpdateRelationL( *relation );
   394             iMdEClient->UpdateRelationL( *relation );
       
   395 		    CleanupStack::PopAndDestroy(relation);
   394 		    }
   396 		    }
   395 		}
   397 		}
   396 	
   398 	
   397 	LOG("CLocationRemappingAO::RemapObjectsL - relations updated");
   399 	LOG("CLocationRemappingAO::RemapObjectsL - relations updated");
   398 	
   400 	
   458 				{
   460 				{
   459 				CMdERelation* relationObject = iMdEClient->NewRelationLC( containsRelDef,
   461 				CMdERelation* relationObject = iMdEClient->NewRelationLC( containsRelDef,
   460 						iRemapItems[i].iObjectId, aLocationId, 0 );
   462 						iRemapItems[i].iObjectId, aLocationId, 0 );
   461 				iMdEClient->AddRelationL( *relationObject );
   463 				iMdEClient->AddRelationL( *relationObject );
   462 				CleanupStack::PopAndDestroy( relationObject );
   464 				CleanupStack::PopAndDestroy( relationObject );
   463 				LOG("CLocationRemappingAO::UpdateRelationsL - new relation created");
   465 				LOG("new relation created");
   464 				}
   466 				}
   465 			else
   467 			else
   466 				{
   468 				{
   467 				CMdERelation* relationObject = iMdEClient->GetRelationL( iRemapItems[i].iRelationId );
   469 				CMdERelation* relationObject = iMdEClient->GetRelationL( iRemapItems[i].iRelationId );
       
   470                 CleanupStack::PushL(relationObject);
   468 				relationObject->SetRightObjectIdL( aLocationId );
   471 				relationObject->SetRightObjectIdL( aLocationId );
   469 				iMdEClient->UpdateRelationL( *relationObject );
   472 				iMdEClient->UpdateRelationL( *relationObject );
   470 				LOG("CLocationRemappingAO::UpdateRelationsL - old relation updated");
   473                 CleanupStack::PopAndDestroy(relationObject);
       
   474 				LOG("old relation updated");
   471 				}
   475 				}
   472 			iRemapItems.Remove( i );
   476 			iRemapItems.Remove( i );
   473 			}
   477 			}
   474 		}
   478 		}
   475 	LOG("CLocationRemappingAO::UpdateRelationsL - end");
   479 	LOG("CLocationRemappingAO::UpdateRelationsL - end");