S60 3rd Edition SDK for Symbian OS
Example Applications Guide

CSIPExIMDialog Class Reference

#include <SIPExIMDialog.h>

List of all members.

Public Member Functions

 ~CSIPExIMDialog ()

Static Public Member Functions

static CSIPExIMDialog * NewL (TDes &aAddress, TDes &aMsg)
static CSIPExIMDialog * NewLC (TDes &aAddress, TDes &aMsg)

Private Member Functions

 CSIPExIMDialog (TDes &aAddress, TDes &aMsg)
void ConstructL ()
TBool OkToExitL (TInt aKeyCode)
virtual void PreLayoutDynInitL ()
void HandleResourceChange (TInt aType)
TBool AddressValid (const TDesC8 &aSipAddr)

Private Attributes

TDes & iAddress
TDes & iMsg


Detailed Description

The dialog for quering the instant message recipient address and the message.

Definition at line 31 of file SIPExIMDialog.h.


Constructor & Destructor Documentation

CSIPExIMDialog::~CSIPExIMDialog (   ) 
 

Destructor

Definition at line 69 of file SIPExIMDialog.cpp.

00070     {
00071     }

CSIPExIMDialog::CSIPExIMDialog (  TDes &  aAddress,
TDes &  aMsg
)  [private]
 

C++ default constructor

Parameters:
aAddress On return contains the recipients address.
aMsg On return contains the message.

Definition at line 59 of file SIPExIMDialog.cpp.

00060 : iAddress( aAddress ), iMsg( aMsg )
00061     {
00062     }


Member Function Documentation

CSIPExIMDialog * CSIPExIMDialog::NewL (  TDes &  aAddress,
TDes &  aMsg
)  [static]
 

Static constructor

Parameters:
aAddress On return contains the recipients address.
aMsg On return contains the message.

Definition at line 33 of file SIPExIMDialog.cpp.

References NewLC().

00034     {
00035     CSIPExIMDialog* self = NewLC( aAddress, aMsg );
00036     CleanupStack::Pop(self);
00037     return self;
00038     }

CSIPExIMDialog * CSIPExIMDialog::NewLC (  TDes &  aAddress,
TDes &  aMsg
)  [static]
 

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

Parameters:
aAddress On return contains the recipients address.
aMsg On return contains the message.

Definition at line 45 of file SIPExIMDialog.cpp.

References CSIPExIMDialog().

00046     {
00047     CSIPExIMDialog* self = new (ELeave) CSIPExIMDialog( aAddress, aMsg );
00048     CleanupStack::PushL(self);
00049     self->ConstructL();
00050     return self;
00051     }

void CSIPExIMDialog::ConstructL (   )  [private]
 

Symbian 2nd phase constructor that can leave.

Definition at line 78 of file SIPExIMDialog.cpp.

00079     {
00080     }

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

From CEikDialog

Definition at line 105 of file SIPExIMDialog.cpp.

References AddressValid(), iAddress, and iMsg.

00106     {   
00107     TBool isOk( ETrue );
00108     
00109     if( aKeyCode == EAknSoftkeyOk )
00110         {
00111         static_cast< CAknQueryControl* >( 
00112                 Control( ESIPExIMMessageLineId ) )->GetText( iMsg );
00113         static_cast< CAknQueryControl* >( 
00114                 Control( ESIPExIMAddressLineId ) )->GetText( iAddress );
00115 
00116         // Check the validity of the given address
00117         HBufC8* address = HBufC8::NewLC( iAddress.Length() );
00118         TPtr8 paddress( address->Des() );
00119         CnvUtfConverter::ConvertFromUnicodeToUtf8( paddress, iAddress );
00120         
00121         if ( !AddressValid( paddress ) )
00122             {
00123             HBufC* txt = StringLoader::LoadLC( R_ERROR_IN_ADDRESS_TXT );
00124             CEikonEnv::Static()->InfoMsg( txt->Des() );
00125             CleanupStack::PopAndDestroy( txt );
00126             isOk = EFalse;
00127             }
00128                
00129         CleanupStack::PopAndDestroy( address );
00130         }
00131 
00132     return isOk;
00133     }

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

From CEikDialog

Definition at line 88 of file SIPExIMDialog.cpp.

References iAddress.

00089     {
00090     if( iAddress.Length() > 0 )
00091         {
00092         static_cast< CAknQueryControl* >( 
00093                 Control( ESIPExIMAddressLineId ) )->SetTextL( iAddress );
00094         }
00095     }

void CSIPExIMDialog::HandleResourceChange (  TInt  aType  )  [private]
 

From CEikDialog

Definition at line 140 of file SIPExIMDialog.cpp.

00141     {
00142     CAknDialog::HandleResourceChange( aType );
00143         
00144     if ( aType == KEikDynamicLayoutVariantSwitch )
00145         {
00146         TRect mainPaneRect;
00147         AknLayoutUtils::LayoutMetricsRect( AknLayoutUtils::EMainPane, 
00148                                            mainPaneRect );
00149         SetRect( mainPaneRect );
00150         
00151         DrawNow();
00152         }
00153     }

TBool CSIPExIMDialog::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 160 of file SIPExIMDialog.cpp.

00161     {
00162     _LIT8( KTypeSIP, "sip" );
00163     
00164     TUriParser8 parser;
00165     User::LeaveIfError( parser.Parse( aSipAddr ) ); 
00166     CUri8* uri8 = CUri8::NewLC( parser );
00167     
00168     TBool valid( ETrue );
00169     
00170     if ( uri8->Uri().Extract( EUriScheme ).CompareF( KTypeSIP() ) != KErrNone )
00171         {
00172         valid = EFalse;
00173         }
00174     if ( uri8->Uri().Extract( EUriUserinfo ) == KNullDesC8 )
00175         {
00176         valid = EFalse;
00177         }
00178     if ( uri8->Uri().Extract( EUriHost ) == KNullDesC8 )
00179         {
00180         valid = EFalse;
00181         }
00182     CleanupStack::PopAndDestroy( uri8 );
00183         
00184     return valid;           
00185     }


© Nokia 2006

Back to top