locationmanager/locationtrail/src/locationremappingao.cpp
branchRCL_3
changeset 19 b73252188534
parent 8 50de4d668bb6
--- a/locationmanager/locationtrail/src/locationremappingao.cpp	Thu Jul 15 19:07:24 2010 +0300
+++ b/locationmanager/locationtrail/src/locationremappingao.cpp	Thu Aug 19 10:20:41 2010 +0300
@@ -24,6 +24,11 @@
 
 using namespace MdeConstants;
 
+
+// --------------------------------------------------------------------------
+// CLocationRemappingAO::NewL()
+// --------------------------------------------------------------------------
+//
 CLocationRemappingAO* CLocationRemappingAO::NewL()
 	{
 	LOG( "CLocationRemappingAO::NewL" ); // DEBUG INFO
@@ -35,6 +40,10 @@
 	return self;
 	}
 
+// --------------------------------------------------------------------------
+// CLocationRemappingAO::ConstructL()
+// --------------------------------------------------------------------------
+//
 void CLocationRemappingAO::ConstructL()
 	{
 	LOG( "CLocationRemappingAO::ConstructL" ); // DEBUG INFO
@@ -49,6 +58,10 @@
 		}
 	}
 
+// --------------------------------------------------------------------------
+// CLocationRemappingAO::~CLocationRemappingAO()
+// --------------------------------------------------------------------------
+//
 CLocationRemappingAO::~CLocationRemappingAO()
 	{
 	LOG( "CLocationRemappingAO::~CLocationRemappingAO" ); // DEBUG INFO
@@ -59,6 +72,10 @@
 	iObjects.ResetAndDestroy();
 	}
 
+// --------------------------------------------------------------------------
+// CLocationRemappingAO::CLocationRemappingAO()
+// --------------------------------------------------------------------------
+//
 CLocationRemappingAO::CLocationRemappingAO() : CActive( CActive::EPriorityStandard ),
 	iState ( EIdle ),
 	iContinue( EFalse ),
@@ -71,7 +88,10 @@
 	// No implementation required
 	}
 
-
+// --------------------------------------------------------------------------
+// CLocationRemappingAO::InitialiseL()
+// --------------------------------------------------------------------------
+//
 void CLocationRemappingAO::InitialiseL(CMdESession* aMdEClient)
 	{
 	LOG( "CLocationRemappingAO::Initialise start" ); // DEBUG INFO
@@ -97,21 +117,41 @@
 	LOG( "CLocationRemappingAO::Initialise end" );
 	}
 
+
+// --------------------------------------------------------------------------
+// CLocationRemappingAO::Append()
+// --------------------------------------------------------------------------
+//
 void CLocationRemappingAO::Append( TRemapItem aItem )
 	{
 	iRemapItems.Append( aItem );
 	}
 
+
+// --------------------------------------------------------------------------
+// CLocationRemappingAO::ResetQueue()
+// --------------------------------------------------------------------------
+//
 void CLocationRemappingAO::ResetQueue()
 	{
 	iRemapItems.Reset();
 	}
 
+
+// --------------------------------------------------------------------------
+// CLocationRemappingAO::ItemsInQueue()
+// --------------------------------------------------------------------------
+//
 TBool CLocationRemappingAO::ItemsInQueue()
 	{
 	return iRemapItems.Count() > 0;
 	}
 
+
+// --------------------------------------------------------------------------
+// CLocationRemappingAO::CheckQueue()
+// --------------------------------------------------------------------------
+//
 TBool CLocationRemappingAO::CheckQueue()
 	{
 	LOG( "CLocationRemappingAO::CheckQueue - start" );
@@ -165,13 +205,21 @@
 	return create;
 	}
 
-
+// --------------------------------------------------------------------------
+// CLocationRemappingAO::StopRemapping()
+// --------------------------------------------------------------------------
+//
 void CLocationRemappingAO::StopRemapping()
 	{
 	LOG( "CLocationRemappingAO::StopRemapping" ); // DEBUG INFO
 	NextState(EIdle);
 	}
 
+
+// --------------------------------------------------------------------------
+// CLocationRemappingAO::StartRemappingObjects()
+// --------------------------------------------------------------------------
+//
 void CLocationRemappingAO::StartRemappingObjects( const TLocationData& aLocationData )
 	{
 	iLocationData = aLocationData;
@@ -185,6 +233,11 @@
 	NextState( ERemapObjects );
 	}
 
+
+// --------------------------------------------------------------------------
+// CLocationRemappingAO::NextState()
+// --------------------------------------------------------------------------
+//
 void CLocationRemappingAO::NextState(TMappingState aState)
 	{
 	LOG1( "CLocationRemappingAO::NextState - state: %d", aState ); // DEBUG INFO
@@ -198,6 +251,11 @@
 		}	
 	}
 
+
+// --------------------------------------------------------------------------
+// CLocationRemappingAO::DoCancel()
+// --------------------------------------------------------------------------
+//
 void CLocationRemappingAO::DoCancel()
 	{
 	LOG( "CLocationRemappingAO::DoCancel" ); // DEBUG INFO
@@ -205,6 +263,11 @@
 	NextState(EIdle);
 	}
 
+
+// --------------------------------------------------------------------------
+// CLocationRemappingAO::RunError()
+// --------------------------------------------------------------------------
+//
 TInt CLocationRemappingAO::RunError( TInt aError )
 	{
 	if (aError != KErrNone)
@@ -216,6 +279,11 @@
 	return KErrNone;
 	}
 
+
+// --------------------------------------------------------------------------
+// CLocationRemappingAO::RunL()
+// --------------------------------------------------------------------------
+//
 void CLocationRemappingAO::RunL()
 	{
 	LOG1( "CCameraTrailMonitorAO::RunL iStatus: %d", iStatus.Int() ); // DEBUG INFO
@@ -252,7 +320,10 @@
 		}
 	}
 
-
+// --------------------------------------------------------------------------
+// CLocationRemappingAO::RemapObjectsL()
+// --------------------------------------------------------------------------
+//
 void CLocationRemappingAO::RemapObjectsL()
 	{	
 	LOG( "CLocationRemappingAO::RemapObjects - start" ); // DEBUG INFO
@@ -314,12 +385,14 @@
 		relation = iMdEClient->GetRelationL( iRemapItems[i].iRelationId );
 		
 		if(relation)
-		    {   
+		    {
+		    CleanupStack::PushL(relation);
             TTime timestamp( 0 );
             timestamp.UniversalTime();
             relation->SetLastModifiedDate( timestamp );
     	
             iMdEClient->UpdateRelationL( *relation );
+		    CleanupStack::PopAndDestroy(relation);
 		    }
 		}
 	
@@ -331,6 +404,11 @@
 	LOG( "CLocationRemappingAO::RemapObjects - end" );
 	}
 
+
+// --------------------------------------------------------------------------
+// CLocationRemappingAO::CommitObjectsL()
+// --------------------------------------------------------------------------
+//
 void CLocationRemappingAO::CommitObjectsL()
 	{
 	LOG( "CLocationRemappingAO::CommitObjects" ); // DEBUG INFO
@@ -360,7 +438,10 @@
     LOG( "CLocationRemappingAO::ReadTimeFromCenRepL(), end" );   
 	}
 
-
+// --------------------------------------------------------------------------
+// CLocationRemappingAO::UpdateRelationsL()
+// --------------------------------------------------------------------------
+//
 void CLocationRemappingAO::UpdateRelationsL( TItemId aLocationId )
 	{ 
 	LOG("CLocationRemappingAO::UpdateRelationsL - start");
@@ -381,14 +462,16 @@
 						iRemapItems[i].iObjectId, aLocationId, 0 );
 				iMdEClient->AddRelationL( *relationObject );
 				CleanupStack::PopAndDestroy( relationObject );
-				LOG("CLocationRemappingAO::UpdateRelationsL - new relation created");
+				LOG("new relation created");
 				}
 			else
 				{
 				CMdERelation* relationObject = iMdEClient->GetRelationL( iRemapItems[i].iRelationId );
+                CleanupStack::PushL(relationObject);
 				relationObject->SetRightObjectIdL( aLocationId );
 				iMdEClient->UpdateRelationL( *relationObject );
-				LOG("CLocationRemappingAO::UpdateRelationsL - old relation updated");
+                CleanupStack::PopAndDestroy(relationObject);
+				LOG("old relation updated");
 				}
 			iRemapItems.Remove( i );
 			}
@@ -396,6 +479,30 @@
 	LOG("CLocationRemappingAO::UpdateRelationsL - end");
 	}
 
+#ifdef LOC_REVERSEGEOCODE
+// --------------------------------------------------------------------------
+// CLocationRemapping::AttachGeoTagsL
+// --------------------------------------------------------------------------
+//
+void CLocationRemappingAO::AttachGeoTagsL( CTagCreator *aTagCreator,
+                                         const TItemId aCountryTagId, const TItemId aCityTagId )
+    { 
+    LOG("CLocationRemapping::AttachGeoTagsL - start");
+    
+    TInt count = iObjectIds.Count() - 1;
+    for( TInt i = count; i >= 0; i-- )
+        {
+        aTagCreator->AttachTagsL( iObjectIds[i], aCountryTagId, aCityTagId );
+        }
+    
+    iObjectIds.Reset();
+    
+    LOG("CLocationRemapping::AttachGeoTagsL - end");
+    }
+
+#endif //LOC_REVERSEGEOCODE
+
+
 // --------------------------------------------------------------------------
 // TRemapItem constructor
 // --------------------------------------------------------------------------
@@ -409,3 +516,4 @@
 	
 	}
 
+// End of file