S60 3rd Edition SDK for Symbian OS
Example Applications Guide

CIMOpenAPIExampleAppUi Class Reference

#include <IMOpenAPIExampleAppUi.h>

List of all members.

Public Member Functions

void ConstructL ()
 ~CIMOpenAPIExampleAppUi ()
void SetGameState (TGameState const aState)
TGameState GetGameState () const
void HandleMessageErrorFromModel (const TInt aIntegerInfo, const TDesC &aStringInfo)
void HandleMessageFromModel (const TInternalMsgID aMsgID, const TInt aIntegerInfo, const TDesC &aStringInfo)
void HandleChallengeRec (const TDesC &aUserID)
void HandleMessageIMConnectionFromModel (const TInternalMsgID aMsgID, const TInt aIntegerInfo)
void DisplayInfoMessage (TInt aResourceID)
void PlayedIndex (const TInt aIntegerInfo)

Private Member Functions

void DynInitMenuPaneL (TInt aResourceId, CEikMenuPane *aMenuPane)
void HandleCommandL (TInt aCommand)
virtual TKeyResponse HandleKeyEventL (const TKeyEvent &aKeyEvent, TEventCode aType)
TBool Challenge ()
void LoginSettings ()
CIMOpenAPIExampleDocument & Document () const
void SelectAccessPoint ()

Private Attributes

CIMOpenAPIExampleContainer * iAppContainer
CAknWaitDialog * iWaitDialog
TBuf< KMaxInfoMsgLength > iDisplayMessage
TBuf< KMaxChallengeIDLength > iUserID
TBuf< KMaxServerAddressLength > iServerAddress
TBuf< KMaxPasswordLength > iPassword
TUint32 iAPNumber
RGenConAgentDialogServer iDlgSrv
TRequestStatus iStatus


Detailed Description

Application UI class. Provides support for the following features:

Definition at line 44 of file IMOpenAPIExampleAppUi.h.


Constructor & Destructor Documentation

CIMOpenAPIExampleAppUi::~CIMOpenAPIExampleAppUi (   ) 
 

Destructor.

Definition at line 69 of file IMOpenAPIExampleAppUi.cpp.

References iAppContainer, iDlgSrv, and iWaitDialog.

00070     {
00071     if (iAppContainer)
00072         {
00073         RemoveFromStack( iAppContainer );
00074         delete iAppContainer;
00075         }
00076     if (iWaitDialog)
00077         {
00078         delete iWaitDialog;
00079         iWaitDialog = NULL;
00080         }
00081         
00082     iDlgSrv.Close();
00083         
00084    }


Member Function Documentation

void CIMOpenAPIExampleAppUi::ConstructL (   ) 
 

EPOC default constructor.

Definition at line 43 of file IMOpenAPIExampleAppUi.cpp.

References CIMOpenAPIExampleContainer::ConstructL(), Document(), GetGameState(), iAPNumber, iAppContainer, iDisplayMessage, CIMOpenAPIExampleContainer::SetGameView(), CIMOpenAPIExampleContainer::SetModel(), and CIMOpenAPIExampleDocument::SetPointerToUI().

00044     {
00045     BaseConstructL(CAknAppUi::EAknEnableSkin);
00046     SetLayoutAwareApp(EFalse);
00047     
00048         Document().SetPointerToUI(this);
00049     iAppContainer = new (ELeave) CIMOpenAPIExampleContainer;
00050     iAppContainer->SetMopParent( this );
00051     iAppContainer->ConstructL( ClientRect() );
00052     AddToStackL( iAppContainer );
00053     
00054         
00055     iAppContainer->SetGameView( Document().Model().GetGameState() );
00056     iAppContainer->SetModel( &(Document().Model()) );
00057     
00058     iAPNumber = 0;
00059     
00060     iDisplayMessage.Copy(KNullDesC);
00061     }

void CIMOpenAPIExampleAppUi::SetGameState (  TGameState const   aState  ) 
 

SetGameState. Set the UI according to current game state

Parameters:
aState current game state

Definition at line 511 of file IMOpenAPIExampleAppUi.cpp.

References iAppContainer, and CIMOpenAPIExampleContainer::SetGameView().

00512         {
00513         iAppContainer->SetGameView(aState);
00514         }

TGameState CIMOpenAPIExampleAppUi::GetGameState (   )  const
 

GetGameState. Get the current game state

Returns:
Current game state

Definition at line 521 of file IMOpenAPIExampleAppUi.cpp.

References Document(), CIMOpenAPIExamplemodel::GetGameState(), and CIMOpenAPIExampleDocument::Model().

00522         {
00523         return Document().Model().GetGameState();
00524         }

void CIMOpenAPIExampleAppUi::HandleMessageErrorFromModel (  const TInt  aIntegerInfo,
const TDesC &  aStringInfo
) 
 

HandleMessageErrorFromModel. handle error messages from Model. Model calls this function

Parameters:
aIntegerInfo Error information as string aStringInfo Error information in string

Definition at line 308 of file IMOpenAPIExampleAppUi.cpp.

References iDisplayMessage.

00311         {
00312         CAknInformationNote* note = new (ELeave) CAknInformationNote( EFalse );
00313         note->SetTimeout( CAknNoteDialog::ELongTimeout  );
00314         _LIT(errString, "in, %S with Error code: %d");
00315 
00316         switch (aErrorCode)
00317         {
00318         case KImApiErrNotLogged:
00319             StringLoader::Load ( iDisplayMessage, R_INFO_MSG_NOT_LOGGEDIN );
00320             break;
00321 
00322                 default:
00323             StringLoader::Load ( iDisplayMessage, R_INFO_MSG_ERROR );
00324             iDisplayMessage.AppendFormat(errString, &aStringInfo, aErrorCode);
00325                     break;
00326                 }
00327     note->ExecuteLD( iDisplayMessage );
00328     iDisplayMessage.Copy(KNullDesC); 
00329         }

void CIMOpenAPIExampleAppUi::HandleMessageFromModel (  const TInternalMsgID  aMsgID,
const TInt  aIntegerInfo,
const TDesC &  aStringInfo
) 
 

HandleMessageFromModel. handle messages from Model. Model calls this function

Parameters:
aMsgID internal message id, used inside application aIntegerInfo information as string aStringInfo Error information in string

Definition at line 369 of file IMOpenAPIExampleAppUi.cpp.

References Document(), iAppContainer, iDisplayMessage, and CIMOpenAPIExampleContainer::SetCellSign().

00373         {
00374         CAknInformationNote* note = new (ELeave) CAknInformationNote( EFalse );
00375         note->SetTimeout( CAknNoteDialog::ELongTimeout  );
00376 
00377         switch (aMsgID)
00378                 {
00379         case ChallengeSent:
00380             StringLoader::Load ( iDisplayMessage, R_INFO_MSG_CHALLENGE_SENT );
00381             break;
00382 
00383                 // handled by a seperate function
00384         case ChallengeRec:
00385                         break;
00386 
00387         case PlayedIndexRec:
00388             iAppContainer->SetCellSign(Document().Model().GetOppSign(), aIntegerInfo);
00389             break;
00390 
00391                 case StartGameRec:
00392             StringLoader::Load ( iDisplayMessage, R_INFO_MSG_GAME_STARTED );                
00393                         break;
00394 
00395 
00396                 case EndGameRec:
00397             StringLoader::Load ( iDisplayMessage, R_INFO_MSG_GAME_ENDED );
00398             break;
00399 
00400 
00401                 case ChallengeAcceptedRec:
00402             StringLoader::Load ( iDisplayMessage, R_INFO_MSG_CHALLENGE_ACCEPTED );
00403                 break;
00404 
00405 
00406                 case ChallengeRejectedRec:
00407             StringLoader::Load ( iDisplayMessage, R_INFO_MSG_CHALLENGE_REJECTED );
00408                         break;
00409 
00410                 case AlreadyInGameRec:
00411             StringLoader::Load ( iDisplayMessage, R_INFO_MSG_ALREADY_IN_GAME );
00412                 break;
00413 
00414         case YouWon:
00415             StringLoader::Load ( iDisplayMessage, R_INFO_MSG_YOU_WON );
00416             break;
00417 
00418         case YouLost:
00419             StringLoader::Load ( iDisplayMessage, R_INFO_MSG_YOU_LOST );
00420             break;
00421 
00422         case GameDraw:
00423             StringLoader::Load ( iDisplayMessage, R_INFO_MSG_GAME_DRAW );
00424             break;
00425 
00426         case StartGameWarning:
00427             StringLoader::Load ( iDisplayMessage, R_INFO_MSG_START_GAME_WARNING );
00428             break;
00429 
00430         case EndChallengeRec:
00431             StringLoader::Load ( iDisplayMessage, R_INFO_MSG_CHALLENGE_ENDED );
00432             break;
00433 
00434                 default:
00435             break;
00436                 }
00437     if ( iDisplayMessage.Compare(KNullDesC) != 0)
00438         note->ExecuteLD( iDisplayMessage );
00439     else
00440         delete note;
00441 
00442     iDisplayMessage.Copy(KNullDesC);
00443         }

void CIMOpenAPIExampleAppUi::HandleChallengeRec (  const TDesC &  aUserID  ) 
 

HandleChallengeRec. handle challenge from Model. Model calls this function when some challenge comes

Parameters:
aUserID reference to the challenger User Id

Definition at line 337 of file IMOpenAPIExampleAppUi.cpp.

References Document(), iAppContainer, iDisplayMessage, and CIMOpenAPIExampleContainer::SetMySign().

00338     {
00339     TInt err = KErrNone;
00340     _LIT(errorString,"Error:( %i )");
00341     CAknQueryDialog* query = CAknQueryDialog::NewL(CAknQueryDialog::EConfirmationTone);
00342     StringLoader::Load ( iDisplayMessage, R_INFO_MSG_CHALLENGE_RECEIVED );
00343     iDisplayMessage.Append(aUserID);
00344     if ( query->ExecuteLD( R_CHALLENGE_QUERY, iDisplayMessage ) )
00345         {
00346         TRAP( err , Document().Model().SendChallengeAccepted() );
00347         iAppContainer->SetMySign(EZeroSign);
00348         }
00349     else
00350         TRAP( err , Document().Model().SendChallengeRejected() );
00351         
00352     if (err != KErrNone )
00353                 {
00354                 CAknErrorNote* note = new(ELeave) CAknErrorNote();
00355                 TBuf<0x100> buf;
00356                 buf.Format(errorString, err );
00357                 note->ExecuteLD( buf );
00358                 }
00359     iDisplayMessage.Copy(KNullDesC);
00360     }

void CIMOpenAPIExampleAppUi::HandleMessageIMConnectionFromModel (  const TInternalMsgID  aMsgID,
const TInt  aIntegerInfo
) 
 

HandleMessageIMConnectionFromModel. handle connection related messages from Model. Model calls this function

Parameters:
aMsgID Internal message id, used inside application aIntegerInfo Information as string

Definition at line 452 of file IMOpenAPIExampleAppUi.cpp.

References iDisplayMessage, and iWaitDialog.

00456         {
00457         CAknInformationNote* note = new (ELeave) CAknInformationNote( EFalse );
00458         note->SetTimeout( CAknNoteDialog::ELongTimeout  );
00459 
00460         switch (aMsgID)
00461                 {
00462                 case Connected:
00463                         iWaitDialog->ProcessFinishedL();
00464                         if (aErrorCode != KErrNone)
00465                                 {
00466                                 StringLoader::Load ( iDisplayMessage, R_INFO_MSG_LOGIN_FAILED );
00467                                 StringLoader::Load ( iDisplayMessage, R_INFO_MSG_ERROR );
00468                                 iDisplayMessage.AppendNum(aErrorCode);
00469                                 }
00470                         else 
00471                                 {
00472                                 StringLoader::Load ( iDisplayMessage, R_INFO_MSG_LOGIN_SUCCESS );
00473                                 }
00474                         note->ExecuteLD( iDisplayMessage );
00475                         break;
00476 
00477                 case DisConnected:
00478                         if (iWaitDialog)
00479                                 iWaitDialog->ProcessFinishedL();
00480                         StringLoader::Load ( iDisplayMessage, R_INFO_MSG_DISCONNECTED );
00481                         note->ExecuteLD( iDisplayMessage );
00482                         break;
00483 
00484         default:
00485             break;
00486                 }
00487         if(note)
00488                 {
00489                 delete note;
00490                 note = NULL;
00491                 }
00492     iDisplayMessage.Copy(KNullDesC);
00493         }

void CIMOpenAPIExampleAppUi::DisplayInfoMessage (  TInt  aResourceID  ) 
 

DisplayInfoMessage. Displays the information message to user with given resource id

Parameters:
aResourceID resource id of the message

Definition at line 531 of file IMOpenAPIExampleAppUi.cpp.

References iDisplayMessage.

00532     {
00533     CAknInformationNote* note = new (ELeave) CAknInformationNote( EFalse );
00534         note->SetTimeout( CAknNoteDialog::ELongTimeout  );
00535         StringLoader::Load ( iDisplayMessage, aResourceID );
00536         note->ExecuteLD( iDisplayMessage );
00537     iDisplayMessage.Copy(KNullDesC);
00538     }

void CIMOpenAPIExampleAppUi::PlayedIndex (  const TInt  aIntegerInfo  ) 
 

PlayedIndex. This functions gets the index position in the matrix where opponent has marked cross or circle.

Parameters:
aIntegerInfo position in the 3*3 matrix, 0 to 8

void CIMOpenAPIExampleAppUi::DynInitMenuPaneL (  TInt  aResourceId,
CEikMenuPane *  aMenuPane
)  [private]
 

PlayedIndex. From MEikMenuObserver

Definition at line 94 of file IMOpenAPIExampleAppUi.cpp.

References Document(), and GetGameState().

00096     {
00097         // Here we select the game options menu according to game state
00098                 switch (aResourceId)
00099                         {
00100                         case R_IMOPENAPIEXAMPLE_MENU:
00101                                 switch ( Document().Model().GetGameState() )
00102                                 {
00103                                 case EStateNotLogin:
00104                                         aMenuPane->SetItemDimmed(EIMOpenAPIExampleCmdExitGame, ETrue);
00105                                         aMenuPane->SetItemDimmed(EIMOpenAPIExampleCmdChallenge, ETrue);
00106                                         aMenuPane->SetItemDimmed(EIMOpenAPIExampleCmdSelect, ETrue);
00107                                         aMenuPane->SetItemDimmed(EIMOpenAPIExampleCmdLogin, EFalse);
00108                     aMenuPane->SetItemDimmed(EIMOpenAPIExampleCmdStartGame, ETrue);
00109                     aMenuPane->SetItemDimmed(EIMOpenAPIExampleCmdEndChallenge, ETrue);
00110                     aMenuPane->SetItemDimmed(EIMOpenAPIExampleCmdLogout, ETrue);
00111                     aMenuPane->SetItemDimmed(EIMOpenAPIExampleCmdIMSettings, EFalse);
00112                     break;
00113 
00114                                 case EStateSending:
00115                                         aMenuPane->SetItemDimmed(EIMOpenAPIExampleCmdExitGame, ETrue);
00116                                         aMenuPane->SetItemDimmed(EIMOpenAPIExampleCmdChallenge, ETrue);
00117                                         aMenuPane->SetItemDimmed(EIMOpenAPIExampleCmdSelect, ETrue);
00118                                         aMenuPane->SetItemDimmed(EIMOpenAPIExampleCmdLogin, ETrue);
00119                     aMenuPane->SetItemDimmed(EIMOpenAPIExampleCmdStartGame, ETrue);
00120                     aMenuPane->SetItemDimmed(EIMOpenAPIExampleCmdEndChallenge, ETrue);
00121                     aMenuPane->SetItemDimmed(EIMOpenAPIExampleCmdLogout, ETrue);
00122                                         aMenuPane->SetItemDimmed(EIMOpenAPIExampleCmdIMSettings, ETrue);
00123                                         break;
00124 
00125                                 case EStateLoginIdle:
00126                                         aMenuPane->SetItemDimmed(EIMOpenAPIExampleCmdExitGame, ETrue);
00127                                         aMenuPane->SetItemDimmed(EIMOpenAPIExampleCmdLogin, ETrue);
00128                                         aMenuPane->SetItemDimmed(EIMOpenAPIExampleCmdSelect, ETrue);
00129                                         aMenuPane->SetItemDimmed(EIMOpenAPIExampleCmdChallenge, EFalse);
00130                     aMenuPane->SetItemDimmed(EIMOpenAPIExampleCmdStartGame, ETrue);
00131                     aMenuPane->SetItemDimmed(EIMOpenAPIExampleCmdEndChallenge, ETrue);
00132                     aMenuPane->SetItemDimmed(EIMOpenAPIExampleCmdLogout, EFalse);
00133                                         aMenuPane->SetItemDimmed(EIMOpenAPIExampleCmdIMSettings, ETrue);
00134                                         break;
00135 
00136                                 case EStateChallenged:
00137                                         aMenuPane->SetItemDimmed(EIMOpenAPIExampleCmdExitGame, ETrue);
00138                                         aMenuPane->SetItemDimmed(EIMOpenAPIExampleCmdSelect, ETrue);
00139                                         aMenuPane->SetItemDimmed(EIMOpenAPIExampleCmdChallenge, ETrue);
00140                                         aMenuPane->SetItemDimmed(EIMOpenAPIExampleCmdLogin, ETrue);
00141                     aMenuPane->SetItemDimmed(EIMOpenAPIExampleCmdStartGame, ETrue);
00142                     aMenuPane->SetItemDimmed(EIMOpenAPIExampleCmdEndChallenge, EFalse);
00143                     aMenuPane->SetItemDimmed(EIMOpenAPIExampleCmdLogout, ETrue);
00144                                         aMenuPane->SetItemDimmed(EIMOpenAPIExampleCmdIMSettings, ETrue);
00145                                         break;
00146                                 
00147                                 case EStateReadytoStart:
00148                                         aMenuPane->SetItemDimmed(EIMOpenAPIExampleCmdLogin, ETrue);
00149                                         aMenuPane->SetItemDimmed(EIMOpenAPIExampleCmdSelect, ETrue);
00150                                         aMenuPane->SetItemDimmed(EIMOpenAPIExampleCmdChallenge, ETrue);
00151                                         aMenuPane->SetItemDimmed(EIMOpenAPIExampleCmdExitGame, ETrue);
00152                                         aMenuPane->SetItemDimmed(EIMOpenAPIExampleCmdLogout, ETrue);
00153                     if (Document().Model().GetOppSign() == ECrossSign )
00154                         aMenuPane->SetItemDimmed(EIMOpenAPIExampleCmdStartGame, ETrue);
00155                     else
00156                         aMenuPane->SetItemDimmed(EIMOpenAPIExampleCmdStartGame, EFalse);
00157                     aMenuPane->SetItemDimmed(EIMOpenAPIExampleCmdEndChallenge, EFalse);
00158                                         aMenuPane->SetItemDimmed(EIMOpenAPIExampleCmdIMSettings, ETrue);
00159                                         break;
00160 
00161                                 case EStateWaitingForOppMove:
00162                                         aMenuPane->SetItemDimmed(EIMOpenAPIExampleCmdLogin, ETrue);
00163                                         aMenuPane->SetItemDimmed(EIMOpenAPIExampleCmdSelect, ETrue);
00164                                         aMenuPane->SetItemDimmed(EIMOpenAPIExampleCmdChallenge, ETrue);
00165                                         aMenuPane->SetItemDimmed(EIMOpenAPIExampleCmdExitGame, EFalse);
00166                     aMenuPane->SetItemDimmed(EIMOpenAPIExampleCmdStartGame, ETrue);
00167                     aMenuPane->SetItemDimmed(EIMOpenAPIExampleCmdEndChallenge, ETrue);
00168                     aMenuPane->SetItemDimmed(EIMOpenAPIExampleCmdLogout, ETrue);
00169                                         aMenuPane->SetItemDimmed(EIMOpenAPIExampleCmdIMSettings, ETrue);
00170                                         break;
00171 
00172                                 case EStateWaitingForOwnMove:
00173                                         aMenuPane->SetItemDimmed(EIMOpenAPIExampleCmdLogin, ETrue);
00174                                         aMenuPane->SetItemDimmed(EIMOpenAPIExampleCmdChallenge, ETrue);
00175                                         aMenuPane->SetItemDimmed(EIMOpenAPIExampleCmdSelect, EFalse);
00176                                         aMenuPane->SetItemDimmed(EIMOpenAPIExampleCmdExitGame, EFalse);
00177                     aMenuPane->SetItemDimmed(EIMOpenAPIExampleCmdStartGame, ETrue);
00178                     aMenuPane->SetItemDimmed(EIMOpenAPIExampleCmdEndChallenge, ETrue);
00179                     aMenuPane->SetItemDimmed(EIMOpenAPIExampleCmdLogout, ETrue);
00180                                         aMenuPane->SetItemDimmed(EIMOpenAPIExampleCmdIMSettings, ETrue);
00181                                         break;
00182 
00183                                 default:
00184                                         break;
00185                                 } // iState switch ends
00186                         default:
00187                                 break;
00188                         } // aResourceId switch ends  
00189     }

void CIMOpenAPIExampleAppUi::HandleCommandL (  TInt  aCommand  )  [private]
 

From CEikAppUi, takes care of command handling.

Parameters:
aCommand command to be handled

Definition at line 208 of file IMOpenAPIExampleAppUi.cpp.

References Challenge(), Document(), iAPNumber, iAppContainer, iDisplayMessage, iPassword, iServerAddress, iUserID, iWaitDialog, LoginSettings(), CIMOpenAPIExampleContainer::PlayMove(), and CIMOpenAPIExampleContainer::SetMySign().

00209     {
00210         TInt err = KErrNone;
00211         _LIT(errString, "Error:( %i )");
00212         TBuf<KMaxChallengeIDLength> OppnentID;
00213         TBuf<KMaxChallengeIDLength> OppnentI;
00214 
00215         switch ( aCommand )
00216                 {
00217                 case EAknSoftkeyBack:
00218             TRAP( err , Document().Model().PrepareToExit() );
00219             Exit();
00220                         break;
00221                 case EEikCmdExit:
00222             TRAP( err , Document().Model().PrepareToExit() );
00223             Exit();
00224                         break;
00225 
00226                 case EIMOpenAPIExampleCmdLogin:
00227                         TRAP(err ,Document().Model().LoginL(iServerAddress, iUserID, iPassword, iAPNumber));
00228                         if (err!=KErrNone)
00229                                 {
00230                     break;                          
00231                         }
00232                         iWaitDialog = new(ELeave)CAknWaitDialog((REINTERPRET_CAST(CEikDialog**,&iWaitDialog)), EFalse );
00233                         StringLoader::Load ( iDisplayMessage, R_INFO_MSG_LOGGING );
00234                         iWaitDialog->SetTextL  ( iDisplayMessage );  
00235                         iWaitDialog->ExecuteDlgLD(CAknNoteDialog::ENoTone,R_SINGULAR_WAIT_NOTE);
00236                         break;
00237                         
00238                 case EIMOpenAPIExampleCmdLogout:
00239                         TRAP(err ,Document().Model().LogoutL());
00240                         iWaitDialog = new(ELeave)CAknWaitDialog((REINTERPRET_CAST(CEikDialog**,&iWaitDialog)), EFalse );
00241                         StringLoader::Load ( iDisplayMessage, R_INFO_MSG_LOGGING_OUT );
00242                         iWaitDialog->SetTextL  ( iDisplayMessage );  
00243                         iWaitDialog->ExecuteDlgLD(CAknNoteDialog::ENoTone,R_SINGULAR_WAIT_NOTE);
00244                         break;
00245                         
00246                 case EIMOpenAPIExampleCmdIMSettings:
00247                         LoginSettings();
00248                         break;
00249                         
00250                 case EIMOpenAPIExampleCmdExitGame:
00251             TRAP(err ,Document().Model().SendExitGame());
00252                         break;
00253 
00254         case EIMOpenAPIExampleCmdStartGame:
00255             TRAP(err ,Document().Model().SendStartGame());
00256                         break;
00257 
00258                 case EIMOpenAPIExampleCmdChallenge:
00259             if (Challenge())
00260                 {
00261                 TRAP( err , Document().Model().SendChallenge() );
00262                 if(err!=KErrNone)
00263                     break;
00264                 iAppContainer->SetMySign(ECrossSign);
00265                 }
00266                         break;
00267 
00268         case EIMOpenAPIExampleCmdEndChallenge:
00269             TRAP( err , Document().Model().SendEndChallenge() );
00270             break;
00271 
00272         case EIMOpenAPIExampleCmdSelect:
00273             iAppContainer->PlayMove();
00274             break;
00275                 
00276                 default:
00277                         break;      
00278                 }
00279         
00280         if (err != KErrNone )
00281                         {
00282                         if(err==-5)
00283                                         {
00284                                         CAknInformationNote* note = new (ELeave) CAknInformationNote( EFalse );
00285                                         note->SetTimeout( CAknNoteDialog::ELongTimeout  );
00286                                         StringLoader::Load ( iDisplayMessage, R_INFO_MSG_NOT_SUPPORTED );
00287                                         note->ExecuteLD( iDisplayMessage );
00288                                 iDisplayMessage.Copy(KNullDesC); 
00289                                         }       
00290                         else 
00291                                         {
00292                                         CAknErrorNote* note = new(ELeave) CAknErrorNote();
00293                                         TBuf<0x100> buf;
00294                                         buf.Format(errString, err );
00295                                         note->ExecuteLD( buf );                      
00296                                         }
00297                         }
00298                         iDisplayMessage.Copy(KNullDesC);
00299         }

TKeyResponse CIMOpenAPIExampleAppUi::HandleKeyEventL (  const TKeyEvent &  aKeyEvent,
TEventCode  aType
)  [private, virtual]
 

From CEikAppUi, handles key events.

Parameters:
aKeyEvent Event to handled.
aType Type of the key event.
Returns:
Response code (EKeyWasConsumed, EKeyWasNotConsumed).

Definition at line 197 of file IMOpenAPIExampleAppUi.cpp.

00199     {
00200     return EKeyWasNotConsumed;
00201     }

TBool CIMOpenAPIExampleAppUi::Challenge (   )  [private]
 

Challenge. Display a query dialog for User ID of the opponent to be challenged

Returns:
ETrue if user accepts to send challenge

Definition at line 545 of file IMOpenAPIExampleAppUi.cpp.

References Document(), CIMOpenAPIExampleDocument::Model(), and CIMOpenAPIExamplemodel::SetOppID().

00546     {
00547     TBuf<KMaxChallengeIDLength> oppnentID;
00548         CAknTextQueryDialog* OppIDQuery = CAknTextQueryDialog::NewL(oppnentID);
00549         CleanupStack::PushL(OppIDQuery);
00550         HBufC* prompt;
00551         prompt = StringLoader::LoadLC(R_INFO_MSG_OPP_ID_PROMPT);// Pushes prompt onto the Cleanup Stack.
00552         OppIDQuery->SetPromptL(*prompt);
00553         CleanupStack::PopAndDestroy(prompt);
00554         CleanupStack::Pop(OppIDQuery);
00555         if (OppIDQuery->ExecuteLD(R_DATA_QUERY))
00556             {
00557                 Document().Model().SetOppID(oppnentID);
00558                 return ETrue;
00559                 }
00560     return EFalse;
00561     }

void CIMOpenAPIExampleAppUi::LoginSettings (   )  [private]
 

LoginSettings. Do the login settings. Displays query dialogs for user id, password server address and access points and saves to internal variables

Definition at line 568 of file IMOpenAPIExampleAppUi.cpp.

References iPassword, iServerAddress, iUserID, and SelectAccessPoint().

00569         {
00570         HBufC* prompt;
00571         
00572         // For User ID
00573         CAknTextQueryDialog* userIDQuery = CAknTextQueryDialog::NewL(iUserID);
00574         CleanupStack::PushL(userIDQuery);
00575         prompt = StringLoader::LoadLC(R_INFO_MSG_USER_ID);// Pushes prompt to Cleanup Stack.
00576         userIDQuery->SetPromptL(*prompt);
00577         CleanupStack::PopAndDestroy(prompt);
00578         CleanupStack::Pop(userIDQuery);
00579         if (!(userIDQuery->ExecuteLD(R_USER_ID_QUERY))) 
00580             return; // return if user cancels
00581         
00582         //For Password
00583         CAknTextQueryDialog* passwordQuery = CAknTextQueryDialog::NewL(iPassword);
00584         CleanupStack::PushL(passwordQuery);
00585         prompt = StringLoader::LoadLC(R_INFO_MSG_PASSWORD);// Pushes prompt to Cleanup Stack.
00586         passwordQuery->SetPromptL(*prompt);
00587         CleanupStack::PopAndDestroy(prompt);
00588         CleanupStack::Pop(passwordQuery);
00589         if(!(passwordQuery->ExecuteLD(R_PASSWORD_QUERY))) 
00590             return; // return if user cancels
00591         
00592         //For Server Address
00593         CAknTextQueryDialog* serverAddressQuery = CAknTextQueryDialog::NewL(iServerAddress);
00594         CleanupStack::PushL(serverAddressQuery);
00595         prompt = StringLoader::LoadLC(R_INFO_MSG_SERVER_ADDRESS);// Pushes prompt to Cleanup Stack.
00596         serverAddressQuery->SetPromptL(*prompt);
00597         CleanupStack::PopAndDestroy(prompt);
00598         CleanupStack::Pop(serverAddressQuery);
00599         if(!(serverAddressQuery->ExecuteLD(R_SERVER_ADDRESS_QUERY)))
00600             return; // return if user cancels
00601         
00602         SelectAccessPoint();
00603         }

CIMOpenAPIExampleDocument & CIMOpenAPIExampleAppUi::Document (   )  const [private]
 

Document. Returns a reference to the application document

Returns:
reference to CIMOpenAPIExampleDocument

Definition at line 500 of file IMOpenAPIExampleAppUi.cpp.

00501     {
00502     return *static_cast<CIMOpenAPIExampleDocument*>(CEikAppUi::Document());
00503     }

void CIMOpenAPIExampleAppUi::SelectAccessPoint (   )  [private]
 

SelectAccessPoint Display a selection list of access points to user and stores selected access point to iAPNumber

Returns:
none

Definition at line 610 of file IMOpenAPIExampleAppUi.cpp.

References iAPNumber, iDlgSrv, and iStatus.

00611     {
00612         TConnectionPrefs prefs;
00613 
00614     iDlgSrv.Connect();
00615 
00616     prefs.iRank = 1;
00617     prefs.iDirection = ECommDbConnectionDirectionOutgoing;
00618     prefs.iBearerSet = ECommDbBearerCSD | ECommDbBearerWcdma | ECommDbBearerVirtual;
00619 
00620         TRAPD( err, iDlgSrv.IapConnection( iAPNumber, prefs, iStatus ) );
00621     User::LeaveIfError( err );
00622         
00623     User::WaitForRequest( iStatus );
00624     iDlgSrv.Close();
00625     }


Member Data Documentation

CIMOpenAPIExampleContainer* CIMOpenAPIExampleAppUi::iAppContainer [private]
 

iAppContainer. Pointer to application container

Definition at line 188 of file IMOpenAPIExampleAppUi.h.

CAknWaitDialog* CIMOpenAPIExampleAppUi::iWaitDialog [private]
 

iWaitDialog. Pointer to wait dialog

Definition at line 194 of file IMOpenAPIExampleAppUi.h.

TBuf<KMaxInfoMsgLength> CIMOpenAPIExampleAppUi::iDisplayMessage [private]
 

iDisplayMessage. Buffer for holding message to be displayed to the user

Definition at line 200 of file IMOpenAPIExampleAppUi.h.

TBuf<KMaxChallengeIDLength> CIMOpenAPIExampleAppUi::iUserID [private]
 

iUserID. Buffer for holding user id for login

Definition at line 206 of file IMOpenAPIExampleAppUi.h.

TBuf<KMaxServerAddressLength> CIMOpenAPIExampleAppUi::iServerAddress [private]
 

iUserID. Buffer for holding server address for login

Definition at line 212 of file IMOpenAPIExampleAppUi.h.

TBuf<KMaxPasswordLength> CIMOpenAPIExampleAppUi::iPassword [private]
 

iPassword. Buffer for holding password for login

Definition at line 218 of file IMOpenAPIExampleAppUi.h.

TUint32 CIMOpenAPIExampleAppUi::iAPNumber [private]
 

iAPNumber. Integer for holding access point for login

Definition at line 224 of file IMOpenAPIExampleAppUi.h.

RGenConAgentDialogServer CIMOpenAPIExampleAppUi::iDlgSrv [private]
 

iDlgSrv Dialog server for access point selection

Definition at line 230 of file IMOpenAPIExampleAppUi.h.

TRequestStatus CIMOpenAPIExampleAppUi::iStatus [private]
 

iStatus Request status for requests made to RGenConAgentDialogServer

Definition at line 236 of file IMOpenAPIExampleAppUi.h.


© Nokia 2006

Back to top