browserui/browser/BrowserAppSrc/BrowserPreferences.cpp
branchRCL_3
changeset 39 08ffbd51e3fd
parent 36 c9249d037530
child 40 3154c14a33db
equal deleted inserted replaced
37:25214794fad6 39:08ffbd51e3fd
   794     switch ( AccessPointSelectionMode() )
   794     switch ( AccessPointSelectionMode() )
   795         {
   795         {
   796         //get the destination identifyer based on the snap Id
   796         //get the destination identifyer based on the snap Id
   797         case EDestination:
   797         case EDestination:
   798         	{
   798         	{
       
   799             BROWSER_LOG( ( _L( "CBrowserPreferences::SetDefaultAccessPointL EDestination" ) ) );
   799 		    RCmManager        cmManager;
   800 		    RCmManager        cmManager;
   800 		    cmManager.OpenL();
   801 		    cmManager.OpenL();
   801 
   802 
   802             // if user-defined destination then check that destination still exists.
   803             // if user-defined destination then check that destination still exists.
   803             // if it doesn't, reset access point to always ask and homepage to blank access point home page.
   804             // if it doesn't, reset access point to always ask and homepage to blank access point home page.
   828         	}
   829         	}
   829 
   830 
   830         //if connecting with Iap Id
   831         //if connecting with Iap Id
   831         case EConnectionMethod:
   832         case EConnectionMethod:
   832             {
   833             {
       
   834             BROWSER_LOG( ( _L( "CBrowserPreferences::SetDefaultAccessPointL EConnectionMethod" ) ) );
   833             // if user-defined access point then check that access point still exists.
   835             // if user-defined access point then check that access point still exists.
   834             // if it doesn't, reset access point to always ask and homepage to blank access point home page.
   836             // if it doesn't, reset access point to always ask and homepage to blank access point home page.
   835   	        CApListItem* apItem = iCommsModel.AccessPointsL()->ItemForUid( aDefaultAccessPoint );
   837   	        CApListItem* apItem = iCommsModel.AccessPointsL()->ItemForUid( aDefaultAccessPoint );
   836 	        if (apItem == NULL)
   838 	        if (apItem == NULL)
   837                 {
   839                 {
   843                         {
   845                         {
   844                         BROWSER_LOG( ( _L( " This is VPN AP which has a snap in it" ) ) );
   846                         BROWSER_LOG( ( _L( " This is VPN AP which has a snap in it" ) ) );
   845                         break;
   847                         break;
   846                         }
   848                         }
   847                 }
   849                 }
       
   850                 BROWSER_LOG( ( _L( "CBrowserPreferences::SetDefaultAccessPointL Ap is not exist, Setting to Always Ask" ) ) );
   848     	    	aDefaultAccessPoint = KWmlNoDefaultAccessPoint;
   851     	    	aDefaultAccessPoint = KWmlNoDefaultAccessPoint;
   849     	    	aAssocVpn = KWmlNoDefaultAccessPoint;
   852     	    	aAssocVpn = KWmlNoDefaultAccessPoint;
   850     	    	delete iAllPreferences.iDefaultAPDetails;
   853     	    	delete iAllPreferences.iDefaultAPDetails;
   851     			iAllPreferences.iDefaultAPDetails = NULL;
   854     			iAllPreferences.iDefaultAPDetails = NULL;
   852     			SetAccessPointSelectionModeL(EAlwaysAsk );
   855     			SetAccessPointSelectionModeL(EAlwaysAsk );
   925         }
   928         }
   926     BROWSER_LOG( ( _L( " AccessPointDataL: %d" ), err ) );
   929     BROWSER_LOG( ( _L( " AccessPointDataL: %d" ), err ) );
   927 	//Reset default AP pointer and delete the data
   930 	//Reset default AP pointer and delete the data
   928 	delete iAllPreferences.iDefaultAPDetails;
   931 	delete iAllPreferences.iDefaultAPDetails;
   929 	iAllPreferences.iDefaultAPDetails = NULL;
   932 	iAllPreferences.iDefaultAPDetails = NULL;
   930 	if  ( err != KErrNone )//Let's select the first
   933 	if  ( err != KErrNone )// Set it to always ask
   931 		{
   934 		{
   932 #ifndef __WINSCW__ //we will not select on Wins (defaultap will be assigned a uid indicating that there is
   935         iAllPreferences.iDefaultAccessPoint = KWmlNoDefaultAccessPoint;
   933 					//no default ap) but rather let ConnMan show the Conn Dlg
   936         iAllPreferences.iDefaultAPDetails = NULL;
   934 		// The first valid access point has to be selected if exists
   937         CleanupStack::PopAndDestroy( api );
   935 		LOG_WRITE("WE SHOULD NOT BE HERE!!!");
       
   936 		CApSelect* apSelect = CApSelect::NewLC
       
   937 			(
       
   938 			iCommsModel.CommsDb(),
       
   939 			KEApIspTypeAll, //KEApIspTypeWAPMandatory,
       
   940 			EApBearerTypeAll,
       
   941 			KEApSortNameAscending,
       
   942 			EIPv4 | EIPv6
       
   943 			);
       
   944 		if ( apSelect->MoveToFirst() )
       
   945 			{
       
   946 			iAllPreferences.iDefaultAccessPoint = apSelect->Uid();
       
   947 			iApDH->AccessPointDataL( iAllPreferences.iDefaultAccessPoint, *api );
       
   948 			iAllPreferences.iDefaultAPDetails = api;//save the ap details
       
   949 			}
       
   950 		else
       
   951 			{
       
   952 			iAllPreferences.iDefaultAccessPoint = KWmlNoDefaultAccessPoint;
       
   953 			iAllPreferences.iDefaultAPDetails = NULL;
       
   954 			delete api;
       
   955 			}
       
   956 		CleanupStack::PopAndDestroy(); // apSelect
       
   957 		CleanupStack::Pop();//api
       
   958 #else
       
   959 		iAllPreferences.iDefaultAccessPoint = KWmlNoDefaultAccessPoint;
       
   960 		iAllPreferences.iDefaultAPDetails = NULL;
       
   961 		CleanupStack::PopAndDestroy( api );
       
   962 #endif//WINSCW
       
   963 		}
   938 		}
   964 	else
   939 	else
   965 		{
   940 		{
   966 		iAllPreferences.iDefaultAPDetails = api;//store new default accesspoint details
   941 		iAllPreferences.iDefaultAPDetails = api;//store new default accesspoint details
   967 		CleanupStack::Pop( ); // api
   942 		CleanupStack::Pop( ); // api