Defining Connection Management Items

Your application should define the connection management items (destination networks, access points, default connection, and always ask) it supports and show only the supported items in the UI. In this example, the application supports default connection, always ask, and destination networks. Access points (if supported) of a certain destination network can be seen under the Options menu when the destination network is highlighted.

To define the connection management items:

  1. Request the connection settings dialog for supported items using the Connection Settings UI API.
  2. Show the items that your application supports in the UI using the Connection Settings UI API. After the user has made a selection, it is returned to the application.
  3. Store the user selection in the application's connection setup. For information on how to start the connection through a destination network, see Starting the Connection through the Destination Network. If you want to prompt the user to make this selection, see Prompting the user to select a destination network.
#include <cmapplicationsettingsui.h>TCmSettingSelection userSelection;

CCmApplicationSettingsUi* settings = CCmApplicationSettingsUi::NewL();
CleanupStack::PushL( settings );

TUint listedItems = EShowAlwaysAsk | EShowDefaultConnection |
                    EShowDestinations | EShowConnectionMethods;

TBearerFilterArray filter;

settings->RunApplicationSettingsL( userSelection,
                                   listedItems,
                                   filter );
                               CleanupStack::PopAndDestroy( settings );

switch ( userSelection.iResult )
	{
	case EDestination:
	    {
        TConnSnapPref prefs;
        prefs.SetSnap( userSelection.iId );

        iConnection.Start( prefs, iStatus );
		break;
	    }
	case EConnectionMethod:
	    {
        TCommDbConnPref prefs;
        prefs.SetIapId( userSelection.iId );
        prefs.SetDialogPreference( ECommDbDialogPrefDoNotPrompt );

        iConnection.Start( prefs, iStatus );
	    break;
	    }
	case EDefaultConnection:
	    {
iConnection.Start( iStatus );
	    break;
	    }
	default: // EAlwaysAsk
	    {
        TCommDbConnPref prefs;
        prefs.SetDialogPreference( ECommDbDialogPrefPrompt );

        iConnection.Start( prefs, iStatus );
	    }
	}
SetActive();