Nokia N97 SDK
Example Applications Guide

CSIPExAddrQueryDlg Class Reference

#include <SIPExAddrQueryDlg.h>

Inheritance diagram for CSIPExAddrQueryDlg:

List of all members.

Detailed Description

A recipient's address query dialog for game invitation.

Definition at line 30 of file SIPExAddrQueryDlg.h.


Public Member Functions

  ~CSIPExAddrQueryDlg ()

Static Public Member Functions

static CSIPExAddrQueryDlg *  NewL (TDes &aAddr)
static CSIPExAddrQueryDlg *  NewLC (TDes &aAddr)

Private Member Functions

  CSIPExAddrQueryDlg (TDes &aAddr)
TBool  OkToExitL (TInt aKeyCode)
virtual void  PreLayoutDynInitL ()
TBool  AddressValid (const TDesC8 &aSipAddr)

Private Attributes

TDes &  iAddress


Constructor & Destructor Documentation

CSIPExAddrQueryDlg::~CSIPExAddrQueryDlg (   ) 
 

Destructor

Definition at line 68 of file SIPExAddrQueryDlg.cpp.

00069     {
00070     }

CSIPExAddrQueryDlg::CSIPExAddrQueryDlg (  TDes &  aAddr  )  [private]
 

C++ default constructor

Parameters:
aAddr  On return contains the other player's address.

Definition at line 58 of file SIPExAddrQueryDlg.cpp.

Referenced by NewLC().

00058                                                     :
00059     iAddress( aAddr )
00060     {
00061     }


Member Function Documentation

CSIPExAddrQueryDlg * CSIPExAddrQueryDlg::NewL (  TDes &  aAddr  )  [static]
 

Static constructor

Parameters:
aAddr  On return contains the other player's address.

Definition at line 33 of file SIPExAddrQueryDlg.cpp.

References NewLC().

Referenced by CSIPExAppUi::HandleCommandL().

00034     {
00035     CSIPExAddrQueryDlg* self = NewLC( aAddr );
00036     CleanupStack::Pop( self );
00037     return self;
00038     }

CSIPExAddrQueryDlg * CSIPExAddrQueryDlg::NewLC (  TDes &  aAddr  )  [static]
 

Static constructor. On return the instance is left to the CleanupStack.

Parameters:
aAddr  On return contains the other player's address.

Definition at line 46 of file SIPExAddrQueryDlg.cpp.

References CSIPExAddrQueryDlg().

Referenced by NewL().

00047     {
00048     CSIPExAddrQueryDlg* self = new (ELeave) CSIPExAddrQueryDlg( aAddr );
00049     CleanupStack::PushL( self );
00050     return self;
00051     }

TBool CSIPExAddrQueryDlg::OkToExitL (  TInt  aKeyCode  )  [private]
 

From CEikDialog

Definition at line 96 of file SIPExAddrQueryDlg.cpp.

References AddressValid(), and iAddress.

00097     {
00098     TBool isOk( ETrue );
00099     
00100     if ( aKeyCode == EAknSoftkeyOk )
00101         {  
00102         static_cast< CAknQueryControl* >( 
00103                 Control( ESIPExInviteAddressId ) )->GetText( iAddress );
00104 
00105         // Check the validity of the given address
00106         HBufC8* address = HBufC8::NewLC( iAddress.Length() );
00107         TPtr8 paddress( address->Des() );
00108         CnvUtfConverter::ConvertFromUnicodeToUtf8( paddress, iAddress );
00109         
00110         if ( !AddressValid( paddress ) )
00111             {
00112             HBufC* txt = StringLoader::LoadLC( R_ERROR_IN_ADDRESS_TXT );
00113             CEikonEnv::Static()->InfoMsg( txt->Des() );
00114             CleanupStack::PopAndDestroy( txt );
00115             isOk = EFalse;
00116             }
00117         
00118         CleanupStack::PopAndDestroy( address );
00119         }
00120 
00121     return isOk;
00122     }

void CSIPExAddrQueryDlg::PreLayoutDynInitL (   )  [private, virtual]
 

From CEikDialog

Definition at line 78 of file SIPExAddrQueryDlg.cpp.

References iAddress.

00079     {
00080     // first we have to execute PreLayoutDynInitL() of the base-class
00081     CAknQueryDialog::PreLayoutDynInitL();
00082     if ( iAddress.Length() > 0 )
00083         {
00084         static_cast< CAknQueryControl* >( 
00085             Control( ESIPExInviteAddressId ) )->SetTextL( iAddress );
00086         }
00087     }

TBool CSIPExAddrQueryDlg::AddressValid (  const TDesC8 &  aSipAddr  )  [private]
 

Checks if user typed address is valid sip address.

Parameters:
aSipAddr  address which validity is checked Returns true if valid address, otherwise returns false

Definition at line 129 of file SIPExAddrQueryDlg.cpp.

Referenced by OkToExitL().

00130     {
00131     _LIT8( KTypeSIP, "sip" );
00132     
00133     TUriParser8 parser;
00134     User::LeaveIfError( parser.Parse( aSipAddr ) ); 
00135     CUri8* uri8 = CUri8::NewLC( parser );
00136     
00137     TBool valid( ETrue );
00138     
00139     if ( uri8->Uri().Extract( EUriScheme ).CompareF( KTypeSIP() ) != KErrNone )
00140         {
00141         valid = EFalse;
00142         }
00143     if ( uri8->Uri().Extract( EUriUserinfo ) == KNullDesC8 )
00144         {
00145         valid = EFalse;
00146         }
00147     if ( uri8->Uri().Extract( EUriHost ) == KNullDesC8 )
00148         {
00149         valid = EFalse;
00150         }
00151     CleanupStack::PopAndDestroy( uri8 );
00152         
00153     return valid;        
00154     }


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

© Nokia 2009

Back to top