Nokia N97 SDK
Example Applications Guide

CApplicationUsingUiSettings Class Reference

#include <applicationusinguisettings.h>

Inheritance diagram for CApplicationUsingUiSettings:

List of all members.

Detailed Description

CApplicationUsingUiSettings example of class using connection and connection UI settings.

Definition at line 33 of file applicationusinguisettings.h.


Public Member Functions

  ~CApplicationUsingUiSettings ()
void  RunL ()
void  DoCancel ()
void  StartL ()
TBool  ConnectionSettingL ()

Static Public Member Functions

static CApplicationUsingUiSettings *  NewL (MDataMobilityPrinter &aObserver)

Private Member Functions

  CApplicationUsingUiSettings (MDataMobilityPrinter &aObserver)
void  ConstructL ()
void  PrintL (TInt aResourceId)
void  PrintL (TInt aResourceId, TInt aInt)

Private Attributes

MDataMobilityPrinter &  iObserver
RConnection  iConnection
RSocketServ  iSocketServer
TCmSettingSelection  iUserSelection


Constructor & Destructor Documentation

CApplicationUsingUiSettings::~CApplicationUsingUiSettings (   ) 
 

Destructor of ApplicationUsingUiSettings.

Definition at line 62 of file applicationusinguisettings.cpp.

References iConnection, and iSocketServer.

00063     {
00064     Cancel();
00065 
00066     iConnection.Close();
00067 
00068     iSocketServer.Close();
00069     }

CApplicationUsingUiSettings::CApplicationUsingUiSettings (  MDataMobilityPrinter &  aObserver  )  [private]
 

C++ default constructor.

Definition at line 51 of file applicationusinguisettings.cpp.

Referenced by NewL().

00052     : CActive( CActive::EPriorityStandard ),
00053       iObserver( aObserver )
00054     {
00055     CActiveScheduler::Add( this );
00056     }


Member Function Documentation

CApplicationUsingUiSettings * CApplicationUsingUiSettings::NewL (  MDataMobilityPrinter &  aObserver  )  [static]
 

NewL is first phase of two-phased constructor.

Definition at line 28 of file applicationusinguisettings.cpp.

References CApplicationUsingUiSettings().

00029     {
00030     CApplicationUsingUiSettings* self =
00031         new ( ELeave ) CApplicationUsingUiSettings( aObserver );
00032     CleanupStack::PushL( self );
00033     self->ConstructL();
00034     CleanupStack::Pop( self );
00035     return self;
00036     }

void CApplicationUsingUiSettings::StartL (   ) 
 

Start the connection.

Definition at line 75 of file applicationusinguisettings.cpp.

References ConnectionSettingL(), iConnection, iSocketServer, iUserSelection, and PrintL().

00076     {
00077     User::LeaveIfError( iConnection.Open( iSocketServer ) );
00078 
00079     TBool selected = ConnectionSettingL();
00080 
00081     if ( !selected )
00082         {
00083         PrintL( R_OUTPUT_USER_CANCELLED_THE_SELECTION );
00084         return;
00085         }
00086 
00087     switch ( iUserSelection.iResult )
00088         {
00089         case CMManager::EDestination:
00090             {
00091             TConnSnapPref prefs;
00092             prefs.SetSnap( iUserSelection.iId );
00093 
00094             PrintL( R_OUTPUT_START_CONNECTION_WITH_PREFERENCES );
00095         
00096             PrintL( R_OUTPUT_SNAP_ID, prefs.Snap() );
00097 
00098             iConnection.Start( prefs, iStatus );
00099             break;
00100             }
00101         case CMManager::EConnectionMethod:
00102             {
00103             TCommDbConnPref prefs;
00104             prefs.SetIapId( iUserSelection.iId );
00105             prefs.SetDialogPreference( ECommDbDialogPrefDoNotPrompt );
00106 
00107             PrintL( R_OUTPUT_START_CONNECTION_WITH_PREFERENCES );
00108         
00109             PrintL( R_OUTPUT_IAP_ID, prefs.IapId() );
00110 
00111             iConnection.Start( prefs, iStatus );
00112             break;
00113             }
00114         case CMManager::EDefaultConnection:
00115             {
00116             PrintL( R_OUTPUT_ATTEMPT_TO_USE_THE_DFT_CONNECTION );
00117         
00118             iConnection.Start( iStatus );
00119             break;
00120             }
00121         default: // CMManager::EAlwaysAsk
00122             {
00123             TCommDbConnPref prefs;
00124             prefs.SetDialogPreference( ECommDbDialogPrefPrompt );
00125 
00126             PrintL( R_OUTPUT_PROMPT_CONNECTION_DIALOG );
00127         
00128             iConnection.Start( prefs, iStatus );
00129             }
00130         }
00131 
00132     SetActive();
00133     }

void CApplicationUsingUiSettings::ConstructL (   )  [private]
 

By default Symbian OS constructor is private.

Definition at line 42 of file applicationusinguisettings.cpp.

References iSocketServer.

00043     {
00044     User::LeaveIfError( iSocketServer.Connect() );
00045     }

void CApplicationUsingUiSettings::PrintL (  TInt  aResourceId  )  [private]
 

Helper method to send message to print to the observer.

Parameters:
aResourceId  Resource identifier of the string to print.

Definition at line 193 of file applicationusinguisettings.cpp.

References iObserver, and MDataMobilityPrinter::Print().

Referenced by RunL(), and StartL().

00194     {
00195     // Load a string from the resource file.
00196     HBufC* message = StringLoader::LoadL( aResourceId );
00197 
00198     iObserver.Print( *message );
00199 
00200     delete message;
00201     }

void CApplicationUsingUiSettings::PrintL (  TInt  aResourceId,
TInt  aInt
)  [private]
 

Helper method to send message to print to the observer.

Parameters:
aResourceId  Resource identifier of the string to print.
aInt  Integer value replacing N in the string.

Definition at line 207 of file applicationusinguisettings.cpp.

References iObserver, and MDataMobilityPrinter::Print().

00208     {
00209     // Load a string from the resource file.
00210     HBufC* message = StringLoader::LoadL( aResourceId, aInt );
00211 
00212     iObserver.Print( *message );
00213 
00214     delete message;
00215     }


The documentation for this class was generated from the following files:

© Nokia 2009

Back to top