S60 3rd Edition SDK for Symbian OS
Example Applications Guide

CSIPExAddrQueryDlg Class Reference

#include <SIPExAddrQueryDlg.h>

List of all members.

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 ()
virtual void HandleResourceChange (TInt aType)
TBool AddressValid (const TDesC8 &aSipAddr)

Private Attributes

TDes & iAddress


Detailed Description

A recipient's address query dialog for game invitation.

Definition at line 30 of file SIPExAddrQueryDlg.h.


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.

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().

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().

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 94 of file SIPExAddrQueryDlg.cpp.

References AddressValid(), and iAddress.

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

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

From CEikDialog

Definition at line 78 of file SIPExAddrQueryDlg.cpp.

References iAddress.

00079     {
00080     if ( iAddress.Length() > 0 )
00081         {
00082         static_cast< CAknQueryControl* >( 
00083             Control( ESIPExInviteAddressId ) )->SetTextL( iAddress );
00084         }
00085     }

void CSIPExAddrQueryDlg::HandleResourceChange (  TInt  aType  )  [private, virtual]
 

From CEikDialog

Definition at line 128 of file SIPExAddrQueryDlg.cpp.

00129     {
00130     CAknDialog::HandleResourceChange( aType );
00131 
00132     if ( aType == KEikDynamicLayoutVariantSwitch )
00133         {
00134         TRect mainPaneRect;
00135         AknLayoutUtils::LayoutMetricsRect( AknLayoutUtils::EMainPane, 
00136                                            mainPaneRect );
00137         SetRect( mainPaneRect );
00138         
00139         DrawNow();
00140         }
00141     }

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 148 of file SIPExAddrQueryDlg.cpp.

00149     {
00150     _LIT8( KTypeSIP, "sip" );
00151     
00152     TUriParser8 parser;
00153     User::LeaveIfError( parser.Parse( aSipAddr ) ); 
00154     CUri8* uri8 = CUri8::NewLC( parser );
00155     
00156     TBool valid( ETrue );
00157     
00158     if ( uri8->Uri().Extract( EUriScheme ).CompareF( KTypeSIP() ) != KErrNone )
00159         {
00160         valid = EFalse;
00161         }
00162     if ( uri8->Uri().Extract( EUriUserinfo ) == KNullDesC8 )
00163         {
00164         valid = EFalse;
00165         }
00166     if ( uri8->Uri().Extract( EUriHost ) == KNullDesC8 )
00167         {
00168         valid = EFalse;
00169         }
00170     CleanupStack::PopAndDestroy( uri8 );
00171         
00172     return valid;        
00173     }


© Nokia 2006

Back to top