omads/omadsappui/AspSyncUtil/src/AspUtil.cpp
branchRCL_3
changeset 8 ad0f53516d84
parent 0 dab8a81a92de
child 14 b922b9936679
equal deleted inserted replaced
4:e6e896426eac 8:ad0f53516d84
    40 #include "AspResHandler.h"
    40 #include "AspResHandler.h"
    41 #include "AspDebug.h"
    41 #include "AspDebug.h"
    42 #include <AspSyncUtil.rsg>
    42 #include <AspSyncUtil.rsg>
    43 
    43 
    44 #include <SyncMLErr.h>  // sync error codes
    44 #include <SyncMLErr.h>  // sync error codes
       
    45 #include <cmapplicationsettingsui.h>
    45 
    46 
    46 //#ifdef __SAP_POLICY_MANAGEMENT
    47 //#ifdef __SAP_POLICY_MANAGEMENT
    47 #include <SettingEnforcementInfo.h> // VSettingEnforcementInfo
    48 #include <SettingEnforcementInfo.h> // VSettingEnforcementInfo
    48 //#endif
    49 //#endif
    49 
    50 
  2052 //
  2053 //
  2053 // -----------------------------------------------------------------------------
  2054 // -----------------------------------------------------------------------------
  2054 //
  2055 //
  2055 TInt CAspAccessPointHandler::ShowApSelectDialogL(TAspAccessPointItem& aItem)
  2056 TInt CAspAccessPointHandler::ShowApSelectDialogL(TAspAccessPointItem& aItem)
  2056 	{
  2057 	{
       
  2058 	FLOG( _L("CAspAccessPointHandler::ShowApSelectDialogL START") );
       
  2059 
  2057 	aItem.iUid = KErrNotFound;
  2060 	aItem.iUid = KErrNotFound;
  2058 	aItem.iName = KNullDesC;
  2061 	aItem.iName = KNullDesC;
  2059 
  2062 
  2060 	TUint32 selectedAp = 0;
  2063 	TInt err(KErrNone);
       
  2064 	TInt retVal( KErrNone );
       
  2065 	TCmSettingSelection selection;
       
  2066 	TBearerFilterArray filterArray;
       
  2067 
  2061 	TUint32 currentAp = 0;
  2068 	TUint32 currentAp = 0;
  2062 	if (aItem.iUid2 != KAskAlways && aItem.iUid2 != KDefaultConnection)
  2069 	if (aItem.iUid2 != KAskAlways && aItem.iUid2 != KDefaultConnection)
  2063 		{
  2070 		{
  2064 		//currentAp = aItem.iUid2;
  2071 		FLOG( _L("ShowApSelectDialogL aItem.iUid2 = %d"), aItem.iUid2 );        
  2065 		
       
  2066 		// convert internet ap to Wap ap (CApSettingsHandler requires this)
  2072 		// convert internet ap to Wap ap (CApSettingsHandler requires this)
  2067     	TRAP_IGNORE(currentAp = iApUtil->WapIdFromIapIdL(aItem.iUid2));
  2073 		TRAP_IGNORE(currentAp = iApUtil->WapIdFromIapIdL(aItem.iUid2));
  2068 		}
  2074 		}
  2069 	
  2075 	else
  2070 	
  2076 		{
  2071 	CApSettingsHandler* handler = NULL;
  2077 		FLOG( _L("ShowApSelectDialogL KAskAlways or KDefaultConnection"));
  2072 	handler = CApSettingsHandler::NewLC( ETrue,
  2078 		}
  2073 	                                     EApSettingsSelListIsPopUp,
  2079 
  2074 	                                     EApSettingsSelMenuSelectNormal,
  2080 	// Mark the current selection
  2075 	                                     KEApIspTypeAll,
  2081 	selection.iResult = CMManager::EConnectionMethod;
  2076 	                                     BearerFlags(),
  2082 	selection.iId = currentAp;
  2077 	    	                             KEApSortNameAscending);
  2083 	FLOG( _L("ShowApSelectDialogL selection.iId = %d"), selection.iId );        
  2078 
  2084 	
  2079 	TInt ret = handler->RunSettingsL(currentAp, selectedAp);
  2085 	// Start the connection dialog
  2080 	CleanupStack::PopAndDestroy(handler);
  2086 	CCmApplicationSettingsUi* settings = CCmApplicationSettingsUi::NewL();
  2081 	
  2087 	CleanupStack::PushL( settings );
  2082 	if (ret & KApUiEventSelected)
  2088 
       
  2089 	TRAP ( err, retVal = settings->RunApplicationSettingsL( selection, 
       
  2090 		CMManager::EShowConnectionMethods, // Show only access points
       
  2091 		filterArray ) );
       
  2092     	
       
  2093 	CleanupStack::PopAndDestroy(); // settings
       
  2094 
       
  2095 	if (err != KErrNone)
       
  2096 	{
       
  2097 		// Error showing dialogue, return
       
  2098 		FLOG( _L("ShowApSelectDialogL err = %d"), err );
       
  2099 		return EAspDialogCancel;
       
  2100 	}
       
  2101 
       
  2102 	if (retVal)
  2083 		{
  2103 		{
  2084 		TAspAccessPointItem item;
  2104 		TAspAccessPointItem item;
  2085 		item.iUid = selectedAp;
  2105 		item.iUid = selection.iId;
  2086 
  2106 		FLOG( _L("ShowApSelectDialogL Uid (%d)"), item.iUid );
  2087 	    GetApInfo(item);
  2107 
       
  2108 		GetApInfo(item);
       
  2109 
       
  2110 		// convert Wap ap to internet ap
       
  2111 		aItem.iUid = iApUtil->IapIdFromWapIdL(selection.iId);
       
  2112 		FLOG( _L("ShowApSelectDialogL Uid Conv (%d)"), item.iUid );
  2088 	    
  2113 	    
  2089 	    // convert Wap ap to internet ap
  2114 		aItem.iName = item.iName;
  2090 	    aItem.iUid = iApUtil->IapIdFromWapIdL(selectedAp);
  2115 
  2091 	    
  2116 		FLOG( _L("ShowApSelectDialogL RETURNING EAspDialogSelect") );
  2092 	    //aItem.iUid = selectedAp;
       
  2093 	    
       
  2094 	    aItem.iName = item.iName;
       
  2095 	    
       
  2096 		return EAspDialogSelect;
  2117 		return EAspDialogSelect;
  2097 		}
  2118 		}
  2098     else if (ret & KApUiEventExitRequested)
  2119 	else
  2099     	{
  2120 		{
  2100     	return EAspDialogExit;
  2121 		FLOG( _L("ShowApSelectDialogL RETURNING EAspDialogCancel") );
  2101     	}
  2122 		return EAspDialogCancel;
  2102     else
  2123 		}
  2103     	{
  2124 	FLOG( _L("CAspAccessPointHandler::ShowApSelectDialogL END") );
  2104     	return EAspDialogCancel;
       
  2105     	}
       
  2106 	}
  2125 	}
  2107 
  2126 
  2108 
  2127 
  2109 // -----------------------------------------------------------------------------
  2128 // -----------------------------------------------------------------------------
  2110 // CAspAccessPointHandler::GetApInfoL
  2129 // CAspAccessPointHandler::GetApInfoL