Nokia N97 SDK
Example Applications Guide

CSIPExIMDialog Class Reference

#include <SIPExIMDialog.h>

Inheritance diagram for CSIPExIMDialog:

List of all members.

Detailed Description

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

Definition at line 31 of file SIPExIMDialog.h.


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 ()
TBool  AddressValid (const TDesC8 &aSipAddr)

Private Attributes

TDes &  iAddress
TDes &  iMsg


Constructor & Destructor Documentation

CSIPExIMDialog::~CSIPExIMDialog (   ) 
 

Destructor

Definition at line 70 of file SIPExIMDialog.cpp.

00071     {
00072     }

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.

Referenced by NewLC().

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


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

Referenced by CSIPExAppUi::HandleCommandL().

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

Referenced by NewL().

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 79 of file SIPExIMDialog.cpp.

References iAddress, and iMsg.

00080     {
00081         SetDataL( iAddress, iMsg );
00082     }

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

From CEikDialog

Definition at line 108 of file SIPExIMDialog.cpp.

References AddressValid(), iAddress, and iMsg.

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

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

From CEikDialog

Definition at line 90 of file SIPExIMDialog.cpp.

References iAddress.

00091     {
00092     // first we have to execute PreLayoutDynInitL() of the base-class
00093     CAknMultiLineDataQueryDialog::PreLayoutDynInitL();
00094     if( iAddress.Length() > 0 )
00095         {
00096         FirstControl()->SetTextL( iAddress );
00097         }
00098     }

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 142 of file SIPExIMDialog.cpp.

Referenced by OkToExitL().

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


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

© Nokia 2009

Back to top