Nokia N97 SDK
Example Applications Guide

CAIWConsumerBasicsAppUi Class Reference

#include <AIWConsumerBasicsAppUI.h>

Inheritance diagram for CAIWConsumerBasicsAppUi:

List of all members.

Detailed Description

CAIWConsumerBasicsAppUi application UI class. Interacts with the user through the UI and request message processing from the handler class

Definition at line 24 of file AIWConsumerBasicsAppUI.h.


Public Member Functions

void  ConstructL ()
  CAIWConsumerBasicsAppUi ()
virtual  ~CAIWConsumerBasicsAppUi ()
void  DynInitMenuPaneL (TInt aResourceId, CEikMenuPane *aMenuPane)
TBool  IsAttached () const
TInt  NumberOfProviders () const

Private Member Functions

void  HandleCommandL (TInt aCommand)
void  HandleStatusPaneSizeChange ()
CAiwGenericParamList &  SetupGenericParamListL () const

Private Attributes

CAIWConsumerBasicsAppView *  iAppView
CAiwServiceHandler *  iServiceHandler
TBool  iIsAttached


Constructor & Destructor Documentation

CAIWConsumerBasicsAppUi::CAIWConsumerBasicsAppUi (   ) 
 

C++ default constructor. This needs to be public due to the way the framework constructs the AppUi

Definition at line 57 of file AIWConsumerBasicsAppUi.cpp.

00058 : iIsAttached(EFalse)
00059     {
00060     // No implementation required
00061     }

CAIWConsumerBasicsAppUi::~CAIWConsumerBasicsAppUi (   )  [virtual]
 

Virtual Destructor.

Definition at line 68 of file AIWConsumerBasicsAppUi.cpp.

References iAppView, and iServiceHandler.

00069     {
00070     delete iServiceHandler;
00071     
00072     if ( iAppView )
00073         {
00074         RemoveFromStack( iAppView );
00075         delete iAppView;
00076         iAppView = NULL;
00077         }
00078     }


Member Function Documentation

void CAIWConsumerBasicsAppUi::ConstructL (   ) 
 

2nd phase constructor.

Definition at line 32 of file AIWConsumerBasicsAppUi.cpp.

References iAppView, iIsAttached, iServiceHandler, and CAIWConsumerBasicsAppView::NewL().

00033     {
00034     // Initialise app UI with standard value.
00035     BaseConstructL();
00036     
00037     // Create view object
00038     iAppView = CAIWConsumerBasicsAppView::NewL( ClientRect(), *this );
00039     AddToStackL( iAppView );    
00040 
00041     // Create service handler instance.    
00042     iServiceHandler = CAiwServiceHandler::NewL();
00043 
00044     // Attach call UI menu service interest to AIW framework.
00045     TRAPD(err, iServiceHandler->AttachMenuL(R_AIWCONSUMERBASICS_MENU, 
00046         R_AIWCONSUMERBASICS_MENUINTEREST) );
00047     if(!err)
00048         {
00049         iIsAttached = ETrue;        
00050         }
00051     }

void CAIWConsumerBasicsAppUi::DynInitMenuPaneL (  TInt  aResourceId,
CEikMenuPane *  aMenuPane
) 
 

From MEikMenuObserver Dynamically initialises a menu pane.

Parameters:
aResourceId  Menu resource id.
aMenuPane  The in-memory representation of the menu pane.

Definition at line 85 of file AIWConsumerBasicsAppUi.cpp.

References iServiceHandler.

00087     {
00088     // First, offer menu pane to AIW framework. It might be the case, that the 
00089     // user is opening an AIW submenu. In this case, the AIW handles the menu.
00090     if ( iServiceHandler->HandleSubmenuL( *aMenuPane ) )
00091         {
00092         return;
00093         }
00094         
00095     // TODO: Add your normal (non-AIW) menu initialisation code here...      
00096 
00097     // Check whether this menu contains AIW menu items.
00098     if ( iServiceHandler->IsAiwMenu(aResourceId) )
00099         {
00100         // Let AIW provider add its menu items to the menu.
00101         iServiceHandler->InitializeMenuPaneL(
00102             *aMenuPane, 
00103             aResourceId, 
00104             EAIWConsumerBasicsCmdLast, 
00105             iServiceHandler->InParamListL());    
00106         }
00107     }

TBool CAIWConsumerBasicsAppUi::IsAttached (   )  const
 

Returns whether the consumer interest is attached to ServiceHandler.

Returns:
ETrue if attached. EFalse otherwise.

Definition at line 212 of file AIWConsumerBasicsAppUi.cpp.

References iIsAttached.

Referenced by CAIWConsumerBasicsAppView::Draw().

00213     {
00214     return iIsAttached;
00215     }

TInt CAIWConsumerBasicsAppUi::NumberOfProviders (   )  const
 

Returns the number of providers attached to the consumer's interest.

Returns:
Number of providers available.

Definition at line 222 of file AIWConsumerBasicsAppUi.cpp.

References iServiceHandler.

Referenced by CAIWConsumerBasicsAppView::Draw().

00223     {
00224     TInt providerCount = 0;
00225     
00226     // Construct a criteria item object. A criteria item contains following fields:
00227     // - Criteria Id        <Value must be set>
00228     // - Service command    <Value must be set>
00229     // - Content type       <Value must be set>
00230     // - Service class      <Value must be set>
00231     // - Default provider   <Default value can be used>
00232     // - Max providers      <Default value can be used>
00233     // - Options            <Default value can be used>
00234     CAiwCriteriaItem* criteria = CAiwCriteriaItem::NewLC(
00235         EAIWConsumerBasicsHelpPlaceholder, 
00236         KAiwCmdHelp, 
00237         KContentTypeAll);
00238 
00239     criteria->SetServiceClass(TUid::Uid(KAiwClassMenu));
00240 
00241     // Query the number of providers. All fields of criteria item much match to
00242     // the criteria item defined in the resource file and used in AttachMenuL().
00243     providerCount = iServiceHandler->NbrOfProviders(criteria);
00244     
00245     CleanupStack::PopAndDestroy(criteria);
00246     return providerCount;
00247     }

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

From CEikAppUi. Takes care of command handling.

Parameters:
aCommand  Command to be handled.

Definition at line 114 of file AIWConsumerBasicsAppUi.cpp.

References iIsAttached, and iServiceHandler.

00115     {
00116     switch( aCommand )
00117         {
00118         case EEikCmdExit:
00119         case EAknSoftkeyExit:
00120             Exit();
00121             break;
00122             
00123         case EAiwAttach:        
00124                    if(!iIsAttached)
00125                         {
00126                         // Attach call UI menu service interest to AIW framework.
00127                         TRAPD(err, iServiceHandler->AttachMenuL(R_AIWCONSUMERBASICS_MENU, 
00128                             R_AIWCONSUMERBASICS_MENUINTEREST) ); 
00129                         if(!err)
00130                             {
00131                             iIsAttached = ETrue;
00132                             }
00133                         }                   
00134                     break;
00135                     
00136         case EAiwDetach:
00137                 if(iIsAttached)
00138                         {
00139                         // Detach all providers from the main menu.            
00140                         iServiceHandler->DetachMenu(R_AIWCONSUMERBASICS_MENU, NULL);
00141                         iIsAttached = EFalse;
00142                         }
00143                 break;
00144                                 
00145        default:
00146             {
00147             // Check first that we really want to execute KAiwCmdHelp. By this 
00148             // way we can set up the generic param list only if necessary.
00149             TInt aiwCmd = iServiceHandler->ServiceCmdByMenuCmd( aCommand );
00150             if ( aiwCmd == KAiwCmdHelp )
00151                 {
00152                 // First set up help context parameters.
00153                 CAiwGenericParamList& inParamList = SetupGenericParamListL();
00154             
00155                 // Execute AIW service command.
00156                 iServiceHandler->ExecuteMenuCmdL(
00157                     aCommand,
00158                     inParamList,
00159                     iServiceHandler->OutParamListL());             
00160                 }
00161             break;
00162             }
00163         }
00164     }

void CAIWConsumerBasicsAppUi::HandleStatusPaneSizeChange (   )  [private]
 

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

Definition at line 171 of file AIWConsumerBasicsAppUi.cpp.

00172     {
00173     iAppView->SetRect( ClientRect() );
00174     } 

CAiwGenericParamList & CAIWConsumerBasicsAppUi::SetupGenericParamListL (   )  const [private]
 

Sets up the Help context parameters.

Returns:
Generic param list ready to be forwarded to AIW framework.

Definition at line 181 of file AIWConsumerBasicsAppUi.cpp.

References iServiceHandler.

00182     {
00183     CArrayFix<TCoeHelpContext>* buf = iCoeEnv->AppUi()->AppHelpContextL();
00184     TCoeHelpContext& helpContext = buf->At(0);      
00185     
00186     // Set help context UID.
00187     TAiwVariant uidVariant;
00188     uidVariant.Set(helpContext.iMajor);         
00189     TAiwGenericParam uidParam(EGenericParamHelpItem, uidVariant);       
00190 
00191     // Set help context name.
00192     TAiwVariant contextVariant;         
00193     contextVariant.Set(helpContext.iContext);       
00194     TAiwGenericParam contextParam(EGenericParamHelpItem, contextVariant);   
00195     
00196     // Append parameters to input parameter list.
00197     CAiwGenericParamList& inParamList = iServiceHandler->InParamListL();
00198     inParamList.AppendL(uidParam);
00199     inParamList.AppendL(contextParam);
00200     
00201     delete buf;
00202     buf = NULL;             
00203     
00204     return inParamList;         
00205     }


Member Data Documentation

CAIWConsumerBasicsAppView* CAIWConsumerBasicsAppUi::iAppView [private]
 

The application view Owned by CAIWConsumerBasicsAppUi

Definition at line 95 of file AIWConsumerBasicsAppUI.h.

Referenced by ConstructL(), and ~CAIWConsumerBasicsAppUi().

CAiwServiceHandler* CAIWConsumerBasicsAppUi::iServiceHandler [private]
 

ServiceHandler object. This object is used for AIW command handling.

Definition at line 101 of file AIWConsumerBasicsAppUI.h.

Referenced by ConstructL(), DynInitMenuPaneL(), HandleCommandL(), NumberOfProviders(), SetupGenericParamListL(), and ~CAIWConsumerBasicsAppUi().

TBool CAIWConsumerBasicsAppUi::iIsAttached [private]
 

Indicates whether the consumer is attached its interest to ServiceHandler.

Definition at line 106 of file AIWConsumerBasicsAppUI.h.

Referenced by ConstructL(), HandleCommandL(), and IsAttached().


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

© Nokia 2009

Back to top