S60 3rd Edition SDK for Symbian OS
Example Applications Guide

CWebClientAppUi Class Reference

#include <WebClientAppUI.h>

List of all members.

Public Member Functions

void ConstructL ()
 CWebClientAppUi ()
 ~CWebClientAppUi ()
void RemoveWaitDialogL ()

Private Member Functions

void HandleCommandL (TInt aCommand)
void HandleUrlRequestL ()
virtual void HandleResourceChangeL (TInt aType)
void HandleStatusPaneSizeChange ()
virtual TKeyResponse HandleKeyEventL (const TKeyEvent &aKeyEvent, TEventCode aType)
void DialogDismissedL (TInt aButtonId)

Private Attributes

CWebClientContainer * iContainer
CWebClientEngine * iClient
CAknWaitDialog * iWaitDialog


Detailed Description

Application UI class. Provides support for the following features:

Definition at line 44 of file WebClientAppUI.h.


Constructor & Destructor Documentation

CWebClientAppUi::CWebClientAppUi (   ) 
 

CWebClientAppUi() First phase construction of CWebClientAppUi.

Definition at line 50 of file WebClientAppUI.cpp.

00051     {
00052     // no implementation required
00053     }

CWebClientAppUi::~CWebClientAppUi (   ) 
 

~CWebClientAppUi() Destructor for CWebClientAppUi.

Definition at line 60 of file WebClientAppUI.cpp.

References iClient, iContainer, and iWaitDialog.

00061     {
00062     if ( iContainer )
00063         {
00064         RemoveFromStack( iContainer );
00065         delete iContainer;
00066         iContainer = NULL;
00067         }
00068     if ( iClient )
00069         {
00070         delete iClient;
00071         iClient = NULL;
00072         }
00073     if ( iWaitDialog )
00074         {
00075         iWaitDialog->ProcessFinishedL();    // deletes the dialog
00076         delete iWaitDialog;
00077         iWaitDialog = NULL;
00078         }
00079     }


Member Function Documentation

void CWebClientAppUi::ConstructL (   ) 
 

ConstructL() Perform the second phase construction of a CWebClientAppUi object.

Definition at line 32 of file WebClientAppUI.cpp.

References iClient, iContainer, iWaitDialog, CWebClientEngine::NewL(), CWebClientContainer::NewL(), and CWebClientEngine::SetCallBack().

00033     {
00034     BaseConstructL( CAknAppUi::EAknEnableSkin );
00035 
00036     iContainer = CWebClientContainer::NewL( ClientRect() );
00037     iContainer->SetMopParent( this );
00038     AddToStackL( iContainer );
00039 
00040     iClient = CWebClientEngine::NewL( *iContainer );
00041     iClient->SetCallBack( this );
00042     iWaitDialog = NULL;
00043     }

void CWebClientAppUi::RemoveWaitDialogL (   ) 
 

RemoveWaiDialogL() Called by CWebClientEngine when Http transaction is finished.

Definition at line 212 of file WebClientAppUI.cpp.

References iWaitDialog.

00213     {
00214     if ( iWaitDialog )
00215         {
00216         iWaitDialog->ProcessFinishedL();    // deletes the dialog
00217         }
00218     }

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

From CEikAppUi HandleCommandL() Handles user commands.

Parameters:
aCommand,: Command ID.

Definition at line 86 of file WebClientAppUI.cpp.

References CWebClientContainer::HandleCommandL(), HandleUrlRequestL(), and iContainer.

00087     {
00088     switch( aCommand )
00089         {
00090         case EEikCmdExit:
00091         case EAknSoftkeyExit:
00092             Exit();
00093             break;
00094         case EWebClientCmdReqUrl:
00095             HandleUrlRequestL();
00096             break;
00097         case EWebClientCmdHeader:
00098         case EWebClientCmdSource:
00099         case EWebClientCmdStatus:
00100             iContainer->HandleCommandL( aCommand );
00101             break;
00102         default:
00103             Panic( EClientUi );
00104             break;
00105         }
00106     }

void CWebClientAppUi::HandleUrlRequestL (   )  [private]
 

HandleUrlRequestL() Handles user command Request URL. Called from HandleCommandL()

Definition at line 113 of file WebClientAppUI.cpp.

References CWebClientEngine::CancelTransactionL(), and iClient.

00114     {
00115     // Issue HTTP get to engine; first cancel possible existing transaction
00116     iClient->CancelTransactionL();
00117 
00118     // URL Query
00119     TBuf<KPrefixedUriNameLength> uri;
00120     CAknTextQueryDialog* dlg = new (ELeave) CAknTextQueryDialog( uri, 
00121         CAknQueryDialog::ENoTone );
00122 
00123     if ( dlg->ExecuteLD( R_WEBCLIENT_DIALOG_URL_QUERY )) 
00124         {
00125         // Insert prefix to URL (it must begin with "http://" or "https://")
00126         TBuf8<KPrefixedUriNameLength> uri8;
00127         uri.LowerCase();
00128         if(uri.Find( KHttpPrefix) == KErrNotFound
00129             && uri.Find( KHttpsPrefix ) == KErrNotFound )
00130             {
00131             // If the URL does not contain http or https, 
00132             // use the default, "http://"
00133             uri8.Append( KHttpPrefix8 );
00134             uri8.Append( uri );
00135             } else {
00136             uri8.Copy( uri );
00137             }
00138 
00139         // Set requested URL to label and clear application view
00140         uri.Copy(uri8);
00141         iContainer->ResetL( uri );
00142 
00143         // Start transaction
00144         iClient->IssueHTTPGetL( uri8 );
00145 
00146         // Create the waitdialog
00147         iWaitDialog = new ( ELeave )CAknWaitDialog(
00148             reinterpret_cast<CEikDialog**>( &iWaitDialog ), ETrue );
00149         // Set DialogDissmissed callback
00150         iWaitDialog->SetCallback( this ); 
00151         iWaitDialog->ExecuteLD( R_WEBCLIENT_DOWNLOAD_WAIT_NOTE );
00152         }
00153     } 

void CWebClientAppUi::HandleResourceChangeL (  TInt  aType  )  [private, virtual]
 

HandleResourceChangeL() Called by framework when layout is changed.

Definition at line 160 of file WebClientAppUI.cpp.

References iContainer.

00161     {
00162     CAknAppUi::HandleResourceChangeL(aType);
00163     if ( aType == KEikDynamicLayoutVariantSwitch )
00164         {               
00165         iContainer->SetRect( ClientRect() );
00166         }
00167     }

void CWebClientAppUi::HandleStatusPaneSizeChange (   )  [private]
 

HandleStatusPaneSizeChange() Called by the framework when the application status pane size is changed.

Definition at line 174 of file WebClientAppUI.cpp.

00175     {
00176     // no implementation required
00177     } 

TKeyResponse CWebClientAppUi::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 184 of file WebClientAppUI.cpp.

00186     {
00187     return EKeyWasNotConsumed;
00188     }

void CWebClientAppUi::DialogDismissedL (  TInt  aButtonId  )  [private]
 

From MProgressDialogCallBack Is called when a dialog is dismissed.

Parameters:
aButtonId,: ButtunId when a dialog is dismissed.

Definition at line 195 of file WebClientAppUI.cpp.

References CWebClientEngine::CancelTransactionL(), iClient, and CWebClientEngine::IsRunning().

00196     {
00197     if ( aButtonId == EAknSoftkeyCancel )
00198         {
00199         // Cancel current transaction
00200         if ( iClient->IsRunning() )
00201             {
00202             iClient->CancelTransactionL();
00203             }
00204         }
00205     }


© Nokia 2006

Back to top