menufw/hierarchynavigator/hnpresentationmodel/inc/hneventhandler.h
branchv5backport
changeset 14 1abc632eb502
parent 13 6205fd287e8a
child 20 636d517f67e6
equal deleted inserted replaced
13:6205fd287e8a 14:1abc632eb502
     1 /*
       
     2 * Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies).
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description:  event handler class
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef C_HNEVENTHANDLER_H
       
    20 #define C_HNEVENTHANDLER_H
       
    21 
       
    22 #include <liwcommon.h>
       
    23 
       
    24 class CHnMetaDataModel;
       
    25 class CHnMdAction;
       
    26 class MLiwInterface;
       
    27 class CLiwServiceHandler;
       
    28 class CLiwGenericParamList;
       
    29 class CHnMdBaseKey;
       
    30 class TLiwVariant;
       
    31 class CHnMdItem;
       
    32 class CHnActionModel;
       
    33 class MHnMdModelEventObserver;
       
    34 class CHnServiceHandler;
       
    35 class MHnControllerInterface;
       
    36 
       
    37 /**
       
    38  *  Event handler class.
       
    39  * 
       
    40  *  Event Handler is designed to handle events. 
       
    41  *  It reveives an event id from the UI, 
       
    42  *  mapps this event into an appropriate action, 
       
    43  *  and runs this action.
       
    44  *
       
    45  *  @lib hnpresentationmodel
       
    46  *  @since S60 5.0
       
    47  *  @ingroup group_hnpresentationmodel
       
    48  */
       
    49 NONSHARABLE_CLASS(CHnEventHandler) : public CBase, public MLiwNotifyCallback
       
    50 {
       
    51 public: // Constructors and destructor
       
    52 
       
    53    /**
       
    54     * Two-phased constructor.
       
    55     * 
       
    56     * @since S60 5.0
       
    57     * @param aModelObserver Model event observer.
       
    58     * @param aController Interface enabling to issues request to Hn engine.    
       
    59     * @return Fully constructed object.
       
    60     */
       
    61     static CHnEventHandler* NewL( MHnMdModelEventObserver& aModelObserver,
       
    62             MHnControllerInterface& aController );
       
    63 
       
    64    /**
       
    65     * Two-phased constructor.
       
    66     * 
       
    67     * @since S60 5.0
       
    68     * @param aModelObserver Model event observer.
       
    69     * @param aController Interface enabling to issues request to Hn engine.
       
    70     * @return Fully constructed object.
       
    71     */
       
    72     static CHnEventHandler* NewLC( MHnMdModelEventObserver& aModelObserver,
       
    73             MHnControllerInterface& aController);
       
    74     
       
    75    /**
       
    76     * Destructor.
       
    77     * 
       
    78     * @since S60 5.0
       
    79     */
       
    80     ~CHnEventHandler();    
       
    81     
       
    82     /**
       
    83      * Executes the action that was found in the Model.
       
    84      * 
       
    85      * @since S60 v3.2
       
    86      * @see CHnActionModel
       
    87      * @param aActionModel A pointer to the object of the CHnActionModel class.
       
    88      * @return Error code. KErrNone in case of a correct execution (even if
       
    89                given action was not found). KErrNotFound in case of incorrect
       
    90                action parameters.
       
    91      */
       
    92     IMPORT_C TInt ExecuteActionL( CHnActionModel* aActionModel );
       
    93        
       
    94 private:
       
    95 
       
    96    /**
       
    97     * Constructor for performing 1st stage construction
       
    98     * 
       
    99     * @since S60 5.0
       
   100     * @param aModelObserver A model event observer reference.
       
   101     * @param aController A HH controller reference.
       
   102     */
       
   103     CHnEventHandler( MHnMdModelEventObserver& aModelObserver,
       
   104                      MHnControllerInterface& aController );
       
   105 
       
   106    /**
       
   107     * EPOC default constructor for performing 2nd stage construction
       
   108     * 
       
   109     * @since S60 5.0
       
   110     */
       
   111     void ConstructL();
       
   112 
       
   113     /**
       
   114      * Notifies UI about actions that can be passed back to the UI,
       
   115      * i.e. openning nested suites, widget change.
       
   116      * 
       
   117      * @since S60 5.0
       
   118      * @param aActionModel Model of the action.
       
   119      * @return Error code
       
   120      */
       
   121     TInt ExecuteInternalActionL( CHnActionModel* aActionModel );
       
   122 
       
   123     /**
       
   124      * Executes action from Extension Manager.
       
   125      * 
       
   126      * @since S60 v5.0
       
   127      * @param aActionModel Model of the action.
       
   128      * @return Error code
       
   129      */
       
   130     TInt ExecuteExtensionManagerActionL( CHnActionModel* aActionModel );
       
   131 
       
   132     /**
       
   133      * Uses default mechanism to execute an action.
       
   134      * 
       
   135      * @since S60 v5.0
       
   136      * @param aActionModel Model of the action.
       
   137      * @return Error code
       
   138      */
       
   139     TInt ExecuteStandardActionL( CHnActionModel* aActionModel );
       
   140         
       
   141     /**
       
   142      * Extracts extension uid from the action.
       
   143      * 
       
   144      * @since S60 v5.0
       
   145      * @param aInterface Interface to invoke action on.
       
   146      * @param aUid The resulting UID.
       
   147      * @return Error code
       
   148      */
       
   149     TInt ExtractUidFromActionL( const TDesC8& aInterface, TUid& aUid );
       
   150 
       
   151     
       
   152 // from MLiwNotifyCallback
       
   153 public :    
       
   154 	
       
   155     /**
       
   156      * Handles notification.
       
   157      * 
       
   158      * @param aCmdId The Id of the command triggered.
       
   159      * @param aEventId The Id of the event.
       
   160      * @param aEventParamList Parameters to event.
       
   161      * @param aInParamList Input parameter list.
       
   162      * 
       
   163      * @return Error code.
       
   164      */
       
   165     TInt HandleNotifyL( TInt aCmdId, TInt aEventId,
       
   166             CLiwGenericParamList& aEventParamList,
       
   167             const CLiwGenericParamList& aInParamList );
       
   168         
       
   169 private: // data
       
   170     
       
   171     /**
       
   172      * Not own.
       
   173      * Reference to HnEngine - Event observer.
       
   174      */
       
   175     MHnMdModelEventObserver& iEventObserver;
       
   176     
       
   177     /**
       
   178      * Own.
       
   179      */
       
   180     CHnServiceHandler* iServiceHandler;
       
   181     
       
   182     /**
       
   183      * Not own.
       
   184      * Reference to App UI - Event observer.
       
   185      */
       
   186     MHnControllerInterface& iControllerInterface;
       
   187 
       
   188 };
       
   189 
       
   190 #endif // C_HNEVENTHANDLER_H