Nokia N97 SDK
Example Applications Guide

CWebClientAppUi Class Reference

#include <WebClientAppUI.h>

Inheritance diagram for CWebClientAppUi:

List of all members.

Detailed Description

Application UI class. Provides support for the following features:

Definition at line 44 of file WebClientAppUI.h.


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


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 211 of file WebClientAppUI.cpp.

References iWaitDialog.

Referenced by CWebClientEngine::HandleRunErrorL(), and CWebClientEngine::MHFRunL().

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

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             break;
00104         }
00105     }

void CWebClientAppUi::HandleUrlRequestL (   )  [private]
 

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

Definition at line 112 of file WebClientAppUI.cpp.

References CWebClientEngine::CancelTransactionL(), and iClient.

Referenced by HandleCommandL().

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

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

HandleResourceChangeL() Called by framework when layout is changed.

Definition at line 159 of file WebClientAppUI.cpp.

References iContainer.

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

void CWebClientAppUi::HandleStatusPaneSizeChange (   )  [private]
 

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

Definition at line 173 of file WebClientAppUI.cpp.

00174     {
00175     // no implementation required
00176     } 

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 183 of file WebClientAppUI.cpp.

00185     {
00186     return EKeyWasNotConsumed;
00187     }

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 194 of file WebClientAppUI.cpp.

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

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


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

© Nokia 2009

Back to top