locationsystemui/locationsysui/locsuplsettingsui/src/locsuplserverlbmodel.cpp
branchRCL_3
changeset 49 10852b179f64
parent 0 667063e416a2
--- a/locationsystemui/locationsysui/locsuplsettingsui/src/locsuplserverlbmodel.cpp	Tue Sep 14 22:09:33 2010 +0300
+++ b/locationsystemui/locationsysui/locsuplsettingsui/src/locsuplserverlbmodel.cpp	Wed Sep 15 12:40:28 2010 +0300
@@ -23,6 +23,8 @@
 #include <epos_csuplsettings.h>
 #include <epos_csuplsettingparams.h>
 #include <epos_csuplsettingsconstants.h>
+#include <bldvariant.hrh>
+#include <featmgr.h>
 
 // User Include
 #include "locsuplserverlbmodel.h"
@@ -33,6 +35,7 @@
 
 const TInt KMaxConversionBufferLength 	= 0x200;
 const TInt KServerEntryGranularity		= 10;
+const TInt KMaxServerAddressLength = 255;
 
 
 // ========================= MEMBER FUNCTIONS ================================
@@ -204,12 +207,15 @@
 //	    
 void CLocSUPLServerLBModel::UpdateSlpIdsL()
 	{
-	DEBUG( + CLocSUPLServerLBModel::CollectSlpIdsL );
+	DEBUG( + CLocSUPLServerLBModel::UpdateSlpIdsL );
 
 	iSlpIdList.Reset();
 	iSlpAddressList.ResetAndDestroy();
 	iEnableFlagList.Reset();
 
+	TBool displayImsiAddress = FeatureManager::FeatureSupported(KFeatureIdFfSuplImsiGeneratedAddressDisplay);
+
+
 	if( iEngine.SlpCount() > 0 )
 		{
 		RPointerArray< CServerParams > 	serverList;
@@ -217,11 +223,16 @@
 		// Get all server entries
 		iEngine.GetAllSlpL( serverList );		
 		
-		for( TInt i = 0; i < serverList.Count() ; i++ )
+		TBuf<KMaxServerAddressLength> imsiAddress;
+		iEngine.GenerateHslpAddressFromImsi(imsiAddress);		
+		
+		TInt serverCount = 	serverList.Count();
+		
+		for( TInt i = 0; i < serverCount ; i++ )
 			{
 		    TInt64 slpId;
-		    HBufC* hslpAddr = HBufC::NewL( KMaxHSLPAddrLen );    
-		    HBufC* iapName 	= HBufC::NewL( KMaxIAPLen );
+		    HBufC* hslpAddr = HBufC::NewLC( KMaxHSLPAddrLen );    
+		    HBufC* iapName 	= HBufC::NewLC( KMaxIAPLen );
 		    TBool enabledFlag, simChangeFlag, usageInHomeNwFlag, editFlag;    
 		    		    
 		    TInt errParams = serverList[i]->Get(
@@ -233,22 +244,27 @@
 		    							usageInHomeNwFlag, 
 		    							editFlag
 		    						);
+		    						
+		    						
+		   			
 		    if ( errParams != KErrNone )
 		        {
-		        // Error has occured 
-		        }  
-			
+		         	User::Leave(errParams);
+		        }
+		        	       
+			if ( displayImsiAddress || imsiAddress.Compare(hslpAddr->Des()) ) // Flag is true->Show IMSI server too, not otherwise!
+			{
 			iSlpIdList.Append( slpId );
 			iSlpAddressList.Append( hslpAddr->AllocL() );
 			iEnableFlagList.Append( enabledFlag );
+			}
 			
-			delete hslpAddr;
-			delete iapName;
+			CleanupStack::PopAndDestroy(2);
 			}
 		serverList.ResetAndDestroy();
 		serverList.Close();		
 		}	
-	DEBUG( - CLocSUPLServerLBModel::CollectSlpIdsL );
+	DEBUG( - CLocSUPLServerLBModel::UpdateSlpIdsL );
 	}        
     
 // ---------------------------------------------------------------------------