menufw/hierarchynavigator/hnengine/inc/hnengine.h
branchRCL_3
changeset 102 ba63c83f4716
parent 93 b01126ce0bec
equal deleted inserted replaced
93:b01126ce0bec 102:ba63c83f4716
     9 * Initial Contributors:
     9 * Initial Contributors:
    10 * Nokia Corporation - initial contribution.
    10 * Nokia Corporation - initial contribution.
    11 *
    11 *
    12 * Contributors:
    12 * Contributors:
    13 *
    13 *
    14 * Description:
    14 * Description:   
    15 *
    15 *
    16 */
    16 */
    17 
    17 
    18 
    18 
    19 
    19 
    34 class MHnSuiteObserver;
    34 class MHnSuiteObserver;
    35 
    35 
    36 /**
    36 /**
    37  * @ingroup group_hnengine
    37  * @ingroup group_hnengine
    38  *  Hierarchy Navigator engine - used by Multimedia Menu
    38  *  Hierarchy Navigator engine - used by Multimedia Menu
    39  *  to fetch data models. The most commonly used exported method is TriggerHnEventL,
    39  *  to fetch data models. The most commonly used exported method is TriggerHnEventL, 
    40  *  which offers event execution for the framework. This functionality is implemented
    40  *  which offers event execution for the framework. This functionality is implemented
    41  *  through the MHnEventGenerator interface. The class owns the meta data model ( CHnMdModel )
    41  *  through the MHnEventGenerator interface. The class owns the meta data model ( CHnMdModel ) 
    42  *  and suite container ( CHnSuiteModelContainer ) to manage them. The engine manages
    42  *  and suite container ( CHnSuiteModelContainer ) to manage them. The engine manages 
    43  *  the model by processing model events ( HandleModelEventL ) or reseting the models
    43  *  the model by processing model events ( HandleModelEventL ) or reseting the models
    44  *  ( ResetModelsL ).
    44  *  ( ResetModelsL ).
    45  *
    45  *
    46  * @lib hnengine
    46  * @lib hnengine
    47  * @since S60 v3.2
    47  * @since S60 v3.2
    64      * Standard factory method.
    64      * Standard factory method.
    65      *
    65      *
    66      * @since S60 v5.0
    66      * @since S60 v5.0
    67      * @param aController Controller handler.
    67      * @param aController Controller handler.
    68      * @return Fully constructed object.
    68      * @return Fully constructed object.
    69      */
    69      */    
    70     IMPORT_C static CHnEngine* NewLC( MHnControllerInterface& aController );
    70     IMPORT_C static CHnEngine* NewLC( MHnControllerInterface& aController );
    71 
    71 
    72     /**
    72     /**
    73      * Standard C++ destructor.
    73      * Standard C++ destructor.
    74      *
    74      * 
    75      * @since S60 v5.0
    75      * @since S60 v5.0
    76      */
    76      */    
    77     ~CHnEngine();
    77     ~CHnEngine();
    78 
    78 
    79     // from CHnInterface
    79     // from CHnInterface
    80 
    80     
    81     /**
    81     /**
    82      * Fetches and constructs data structres, needed by Multimedia
    82      * Fetches and constructs data structres, needed by Multimedia
    83      * Menu to display suites.
    83      * Menu to display suites.
    84      *
    84      *
    85      * @since S60 v5.0
    85      * @since S60 v5.0
    86      * @return Filled suite model object from the stack.
    86      * @return Filled suite model object from the stack.
    87      */
    87      */
    88     CHnSuiteModel* GetLastSuiteModelL();
    88     CHnSuiteModel* GetLastSuiteModelL();
    89 
    89     
    90     /**
    90     /**
    91      * Fetches and constructs data structres, needed by Multimedia
    91      * Fetches and constructs data structres, needed by Multimedia
    92      * Menu to display suites.
    92      * Menu to display suites.
    93      *
    93      *
    94      * @since S60 v5.0
    94      * @since S60 v5.0
    95      * @return Filled suite model object from the stack.
    95      * @return Filled suite model object from the stack.
    96      */
    96      */
    97     CHnSuiteModel* GetParentSuiteModelL();
    97     CHnSuiteModel* GetParentSuiteModelL();
    98 
    98    
    99     /**
    99     /**
   100      * Get count of suite models on the stack.
   100      * Get count of suite models on the stack.
   101      *
   101      * 
   102      * @since S60 v5.0
   102      * @since S60 v5.0
   103      * @return Count of suite models on the stack.
   103      * @return Count of suite models on the stack.
   104      */
   104      */
   105     virtual TInt GetSuiteModelsCountL();
   105     virtual TInt GetSuiteModelsCountL();
   106 
   106     
   107     /**
   107     /**
   108      * Checks if suite model is loaded.
   108      * Checks if suite model is loaded.
   109      *
   109      * 
   110      * @since S60 v5.0
   110      * @since S60 v5.0
   111      * @return ETrue if suite model is loaded, otherwise EFalse.
   111      * @return ETrue if suite model is loaded, otherwise EFalse.
   112      */
   112      */
   113     TBool SuiteModelLoadedL( TInt aId );
   113     TBool SuiteModelLoadedL( TInt aId );
   114 
   114     
   115     /**
   115     /**
   116      * Loads suite hierarchy specified in URI.
   116      * Loads suite hierarchy specified in URI.
   117      *
   117      *
   118      * @since S60 v5.0
   118      * @since S60 v5.0
   119      * @param aUri The URI contained suite(s) to load.
   119      * @param aUri The URI contained suite(s) to load.
   120      */
   120      */
   121     IMPORT_C void LoadSuitesFromUriL( const TDesC8& aUri );
   121     IMPORT_C void LoadSuitesFromUriL( const TDesC8& aUri );
   122 
   122 
   123 public:
   123 public:
   124     // from MHnMdModelEventObserver
   124     // from MHnMdModelEventObserver
   125 
   125     
   126      /**
   126      /**
   127      * Handle model event.
   127      * Handle model event.
   128      *
   128      *
   129      * @since S60 v5.0
   129      * @since S60 v5.0
   130      * @param aEventName Event's name to perform.
   130      * @param aEventName Event's name to perform.
   131      * @param aParams Event specific parameters used to perform action.
   131      * @param aParams Event specific parameters used to perform action.
   132      */
   132      */
   133      TInt HandleModelEventL( const TDesC& aEventName, CLiwGenericParamList& aParams );
   133      TInt HandleModelEventL( const TDesC& aEventName, CLiwGenericParamList& aParams );
   134 
   134      
   135     // from CHnInterface
   135     // from CHnInterface
   136 
   136      
   137     /**
   137     /**
   138      * Handle back event.
   138      * Handle back event.
   139      *
   139      *
   140      * @since S60 v5.0
   140      * @since S60 v5.0
   141      * @param aGenre Suite given by the name genre.
   141      * @param aGenre Suite given by the name genre.
   145      TInt HandleBackEventL( const TDesC& aGenre,
   145      TInt HandleBackEventL( const TDesC& aGenre,
   146              TInt aIterations = KModelCountForRoot );
   146              TInt aIterations = KModelCountForRoot );
   147 
   147 
   148     /**
   148     /**
   149      * Loads default root suite
   149      * Loads default root suite
   150      *
   150      * 
   151      * @since S60 v5.0
   151      * @since S60 v5.0
   152      * @param aSuiteParams Suite parameters.
   152      * @param aSuiteParams Suite parameters.
   153      * @return Status error code.
   153      * @return Status error code.
   154      */
   154      */
   155     IMPORT_C TInt InitializeL( CLiwGenericParamList& aSuiteParams );
   155     IMPORT_C TInt InitializeL( CLiwGenericParamList& aSuiteParams );
   156 
   156     
   157     // from MHnEventGenerator
   157     // from MHnEventGenerator
   158 
   158     
   159     /**
   159     /**
   160      * Triggers an event inside hierarchy navigator.
   160      * Triggers an event inside hierarchy navigator.
   161      *
   161      * 
   162      * Used by UI to notify hierarchy navigator of its events,
   162      * Used by UI to notify hierarchy navigator of its events,
   163      * as well as for hierarchy navigator components to notify
   163      * as well as for hierarchy navigator components to notify
   164      * the module of certain events (such as OnSuiteLoaded etc).
   164      * the module of certain events (such as OnSuiteLoaded etc).
   165      *
   165      *
   166      * @since S60 v5.0
   166      * @since S60 v5.0
   167      * @param aHnEventId Internal id of an event (Event names are
   167      * @param aHnEventId Internal id of an event (Event names are 
   168      *                    mapped to ids).
   168      *                    mapped to ids).
   169      * @param aRecipientId The id of the recipient item.
   169      * @param aRecipientId The id of the recipient item.
   170      * @param aEventParameters Event specific parameter.
   170      * @param aEventParameters Event specific parameter.
   171      * @return Status code.
   171      * @return Status code.
   172      */
   172      */
   173      IMPORT_C TInt TriggerHnEventL( const TInt aHnEventId,
   173      IMPORT_C TInt TriggerHnEventL( const TInt aHnEventId,
   174              const TInt aRecipientId, CLiwGenericParamList* aEventParameters = NULL );
   174              const TInt aRecipientId, CLiwGenericParamList* aEventParameters = NULL );
   175 
   175      
   176      /**
   176      /**
   177       * Splits the source descriptor by a separatos
   177       * Splits the source descriptor by a separatos
   178       *
   178       * 
   179       * @since S60 v5.0
   179       * @since S60 v5.0
   180       * @param aSource Source descriptor intended to split.
   180       * @param aSource Source descriptor intended to split.
   181       * @param aSeparator Separator used to split.
   181       * @param aSeparator Separator used to split.
   182       * @return Array of descriptors.
   182       * @return Array of descriptors. 
   183       */
   183       */
   184      RPointerArray< HBufC8 > SplitL( const TDesC8& aSource,
   184      RPointerArray< HBufC8 > SplitL( const TDesC8& aSource,
   185              const TDesC8& aSeparator );
   185              const TDesC8& aSeparator );
   186 
   186      
   187      /**
   187      /**
   188       * Generate param list according to query param.
   188       * Generate param list according to query param.
   189       *
   189       * 
   190       * @param aUriQuery Descriptor consist of param(s) to split
   190       * @param aUriQuery Descriptor consist of param(s) to split
   191       * @param aUriFragment Descriptor containing an uri fragment.
   191       * @param aUriFragment Descriptor containing an uri fragment.
   192       * @param aSuiteName The suite's name.
   192       * @param aSuiteName The suite's name.  
   193       * @return Filled generic param list.
   193       * @return Filled generic param list.
   194       */
   194       */
   195      CLiwGenericParamList* UriQueryToLiwListLC( const TDesC8& aUriQuery,
   195      CLiwGenericParamList* UriQueryToLiwListLC( const TDesC8& aUriQuery,
   196              const TDesC8& aUriFragment, const TDesC8& aSuiteName );
   196              const TDesC8& aUriFragment, const TDesC8& aSuiteName );
   197 
   197      
   198      /**
   198      /**
   199       * Resets MD Model and Suite Container.
   199       * Resets MD Model and Suite Container.
   200       *
   200       *
   201       * @since S60 v5.0
   201       * @since S60 v5.0
   202       */
   202       */
   203      IMPORT_C void ResetModelsL();
   203      IMPORT_C void ResetModelsL();
   204 
   204      
   205      // from MHnEditModeInterface
   205      // from MHnEditModeInterface 
   206 
   206      
   207      /**
   207      /**
   208       * Sets edit mode.
   208       * Sets edit mode.
   209       *
   209       * 
   210       * @since S60 v5.0
   210       * @since S60 v5.0
   211       * @param aEditMode Set edit mode member to false/true.
   211       * @param aEditMode Set edit mode member to false/true.
   212       */
   212       */
   213      void SetEditModeL( TBool aEditMode );
   213      void SetEditModeL( TBool aEditMode );
   214 
   214 
   215     /**
   215     /**
   216      * Enables to issue a request to Hn engine.
   216      * Enables to issue a request to Hn engine.
   217      *
   217      * 
   218      * @since S60 v5.0
   218      * @since S60 v5.0
   219      * @param aParam Input Parameters.
   219      * @param aParam Input Parameters.
   220      * @param aOutput Target list for output.
   220      * @param aOutput Target list for output.  
   221      */
   221      */
   222      IMPORT_C void HandleRequestL( const CLiwGenericParamList& aParam,
   222      IMPORT_C void HandleRequestL( const CLiwGenericParamList& aParam, 
   223                          CLiwGenericParamList* aOutput = NULL);
   223                          CLiwGenericParamList* aOutput = NULL);
   224 
   224 
   225     //    from MHWRMLightObserver
   225     //    from MHWRMLightObserver
   226     /**
   226     /**
   227      * Called when the device light status changes.
   227      * Called when the device light status changes.
   236             CHWRMLight::TLightStatus aStatus);
   236             CHWRMLight::TLightStatus aStatus);
   237 
   237 
   238 private:
   238 private:
   239     /**
   239     /**
   240      * Default constructor.
   240      * Default constructor.
   241      *
   241      * 
   242      * @since S60 v5.0
   242      * @since S60 v5.0
   243      * @param aController Controller handler.
   243      * @param aController Controller handler.
   244      */
   244      */
   245     CHnEngine( MHnControllerInterface& aController );
   245     CHnEngine( MHnControllerInterface& aController );
   246 
   246     
   247     /**
   247     /**
   248      * Standard 2nd phase constructor.
   248      * Standard 2nd phase constructor.
   249      *
   249      * 
   250      * @since S60 v5.0
   250      * @since S60 v5.0
   251      */
   251      */
   252     void ConstructL();
   252     void ConstructL();
   253 
   253          
   254     /**
   254     /**
   255      * Handle new suite loaded event.
   255      * Handle new suite loaded event.
   256      *
   256      *
   257      * @since S60 v5.0
   257      * @since S60 v5.0
   258      * @param aParams Event specific parameters.
   258      * @param aParams Event specific parameters.
   284      * @since S60 v5.0
   284      * @since S60 v5.0
   285      * @param aParams Event specific parameters consist of target widget type.
   285      * @param aParams Event specific parameters consist of target widget type.
   286      * @return Status code.
   286      * @return Status code.
   287      */
   287      */
   288     TInt HandleSetFocusEventL( const CLiwGenericParamList& aParams );
   288     TInt HandleSetFocusEventL( const CLiwGenericParamList& aParams );
   289 
   289     
   290     /**
   290     /**
   291      * Handles MoveFocusBeforeDelete event.
   291      * Handles MoveFocusBeforeDelete event.
   292      *
   292      *
   293      * @since S60 v5.0
   293      * @since S60 v5.0
   294      * @param aParams Event specific parameters consist of target widget type.
   294      * @param aParams Event specific parameters consist of target widget type.
   295      * @return Status code.
   295      * @return Status code.
   296      */
   296      */
   297     TInt HandleMoveFocusBeforeDeleteEventL(
   297     TInt HandleMoveFocusBeforeDeleteEventL(
   298             const CLiwGenericParamList& aParams );
   298             const CLiwGenericParamList& aParams );
   299 
   299     
   300     /**
   300     /**
   301      * Handles RefreshIcons event.
   301      * Handles RefreshIcons event.
   302      *
   302      *
   303      * @since S60 v5.0
   303      * @since S60 v5.0
   304      * @param aParams Event specific parameters (ignored)
   304      * @param aParams Event specific parameters (ignored)
   306      */
   306      */
   307     TInt HandleRefreshIconsEventL( const CLiwGenericParamList& aParams );
   307     TInt HandleRefreshIconsEventL( const CLiwGenericParamList& aParams );
   308 
   308 
   309     /**
   309     /**
   310      * Handles DisableActionsForItem event.
   310      * Handles DisableActionsForItem event.
   311      *
   311      * 
   312      * @since S60 v5.0
   312      * @since S60 v5.0
   313      * @param aParams Event specific parameters - contains custom item id
   313      * @param aParams Event specific parameters - contains custom item id
   314      * @return Status code.
   314      * @return Status code.
   315      */
   315      */
   316     TInt HandleDisableActionsForItemL( const CLiwGenericParamList& aParams );
   316     TInt HandleDisableActionsForItemL( const CLiwGenericParamList& aParams );
   317 
   317 
   318      /**
   318      /**
   319       *  Store widget type to repository.
   319       *  Store widget type to repository.
   320       *
   320       *
   321       * @since S60 v5.0
   321       * @since S60 v5.0
   322       * @param aSuiteName Suite name to that set widget type.
   322       * @param aSuiteName Suite name to that set widget type. 
   323       * @param aType Widget type to store in repository.
   323       * @param aType Widget type to store in repository.
   324       * @return Status code.
   324       * @return Status code.
   325       */
   325       */    
   326     TInt HandleWidgetChangeL( const TDesC& aSuiteName,
   326     TInt HandleWidgetChangeL( const TDesC& aSuiteName,
   327             THnSuiteWidgetType aType );
   327             THnSuiteWidgetType aType );
   328 
   328      
   329 
   329          
   330      /**
   330      /**
   331       * Parse URI path component containing Suites to be loaded.
   331       * Parse URI path component containing Suites to be loaded.
   332       *
   332       *
   333       * @since S60 v5.0
   333       * @since S60 v5.0
   334       * @param aUriPath Descriptor URI path which consist of suites' names.
   334       * @param aUriPath Descriptor URI path which consist of suites' names.
   335       * @param aOutput Array on output containes parsed suite names.
   335       * @param aOutput Array on output containes parsed suite names.
   336       */
   336       */
   337      void ParseSuiteUriPathL( const TDesC8& aUriPath,
   337      void ParseSuiteUriPathL( const TDesC8& aUriPath, 
   338          CDesC8ArrayFlat& aOutput );
   338          CDesC8ArrayFlat& aOutput );
   339 
   339    
   340 
   340      
   341      /**
   341      /**
   342       * Checks if only root configuration is loaded.
   342       * Checks if only root configuration is loaded.
   343       * Used to decide if reloading models is needed.
   343       * Used to decide if reloading models is needed.
   344       *
   344       *
   345       * @since S60 v5.0
   345       * @since S60 v5.0
   346       * @return Return ETrue if only root configuration is loaded
   346       * @return Return ETrue if only root configuration is loaded
   347       *         otherwise EFalse.
   347       *         otherwise EFalse.
   348       */
   348       */
   349      TBool IsOnlyRootConfLoaded();
   349      TBool IsOnlyRootConfLoaded();
   350 
   350      
   351      /**
   351      /**
   352       * Resets loaded resources.
   352       * Resets loaded resources.
   353       *
   353       *
   354       * @since S60 5.0
   354       * @since S60 5.0
   355       */
   355       */
   356      void ResetLocalization();
   356      void ResetLocalization();
   357 
   357      
   358      /**
   358      /**
   359       * Loads suite with given suite name with parameters
   359       * Loads suite with given suite name with parameters
   360       * from uri query.
   360       * from uri query. 
   361       *
   361       *
   362       * @since S60 5.0
   362       * @since S60 5.0
   363       * @param aSuiteName Name of the suite to load.
   363       * @param aSuiteName Name of the suite to load. 
   364       * @param aUriQuery Descriptor containig parsed part of the uri.
   364       * @param aUriQuery Descriptor containig parsed part of the uri.
   365       * @param aUriFragment Descriptor containig parsed part (fragment) of the uri.
   365       * @param aUriFragment Descriptor containig parsed part (fragment) of the uri.
   366       * @return Error code when loading suite.
   366       * @return Error code when loading suite.
   367       */
   367       */
   368      TInt LoadSuiteFromUriL( const TDesC8& aSuiteName,
   368      TInt LoadSuiteFromUriL( const TDesC8& aSuiteName, 
   369          const TDesC8& aUriQuery, const TDesC8& aUriFragment );
   369          const TDesC8& aUriQuery, const TDesC8& aUriFragment );
   370 
   370      
   371      /**
   371      /**
   372       * Reads highlight position from uri fragment
   372       * Reads highlight position from uri fragment 
   373       * and sets it on the suite model.
   373       * and sets it on the suite model.
   374       *
   374       *
   375       * @since S60 5.0
   375       * @since S60 5.0
   376       * @param aUriFragment Descriptor containig parsed part of the uri.
   376       * @param aUriFragment Descriptor containig parsed part of the uri.
   377       */
   377       */
   385       */
   385       */
   386      void LoadFromCrL( const TDesC8& aUri );
   386      void LoadFromCrL( const TDesC8& aUri );
   387 
   387 
   388      /**
   388      /**
   389       * Handles loading suite from uri if suites names' are the same.
   389       * Handles loading suite from uri if suites names' are the same.
   390       *
   390       * 
   391       * @param aNextExists ETrue if the next suite's name exists in uri.
   391       * @param aNextExists ETrue if the next suite's name exists in uri.
   392       * @param aUri The URI's parameters passed to the suite.
   392       * @param aUri The URI's parameters passed to the suite. 
   393       */
   393       */
   394      void HandleTheSameSuitesL( TBool aNextExists, const TDesC8& aParams );
   394      void HandleTheSameSuitesL( TBool aNextExists, const TDesC8& aParams );
   395 
   395      
   396      /**
   396      /**
   397       * Checks if suites have the same names.
   397       * Checks if suites have the same names.
   398       *
   398       * 
   399       * @param aLastSuiteName The last suite's name on the stack.
   399       * @param aLastSuiteName The last suite's name on the stack.
   400       * @param aFirstSuiteName The first suite's name in uri.
   400       * @param aFirstSuiteName The first suite's name in uri.
   401       * @return ETrue if names are equal
   401       * @return ETrue if names are equal
   402       */
   402       */
   403      TBool SuitesAreTheSameL( const TDesC& aLastSuiteName, const TDesC8& aFirstSuiteName );
   403      TBool SuitesAreTheSameL( const TDesC& aLastSuiteName, const TDesC8& aFirstSuiteName );
   404 
   404 
   405      /**
   405      /**
   406       * Decides whether to hide menu depending on current state and uri parameters
   406       * Decides whether to hide menu depending on current state and uri parameters
   407       *
   407       * 
   408       * @param aUri The Uri to parse for exit procedure.
   408       * @param aUri The Uri to parse for exit procedure.
   409       * @return ETrue If exit was consumed.
   409       * @return ETrue If exit was consumed.
   410       */
   410       */
   411      TBool HandleActionL( const TDesC8& aUri );
   411      TBool HandleActionL( const TDesC8& aUri );
   412 
   412      
   413      /**
   413      /**
   414       * Loads suites from uri.
   414       * Loads suites from uri.
   415       *
   415       * 
   416       * @param aUri The uri to parse
   416       * @param aUri The uri to parse
   417       */
   417       */
   418      void LoadSuitesL( const TDesC8& aUri );
   418      void LoadSuitesL( const TDesC8& aUri );
   419 
   419      
   420      /**
       
   421        * Loads item through CR.
       
   422        *
       
   423        * @since S60 v5.0
       
   424        */
       
   425       void LoadItemFromCrL( const TDesC8& aUri );
       
   426 
       
   427 private: // data
   420 private: // data
   428 
   421         
   429     /**
   422     /**
   430      * Own - Meta data model.
   423      * Own - Meta data model.
   431      */
   424      */
   432     CHnMdModel* iMetaDataModel;
   425     CHnMdModel* iMetaDataModel;
   433 
   426     
   434     /**
   427     /**
   435      * Own - Suite container.
   428      * Own - Suite container.
   436      */
   429      */
   437     CHnSuiteModelContainer* iSuiteContainer;
   430     CHnSuiteModelContainer* iSuiteContainer;
   438 
   431        
   439     /**
   432     /**
   440      * Not own.
   433      * Not own.
   441      * EikonEnv for displaying popup messages.
   434      * EikonEnv for displaying popup messages. 
   442      */
   435      */
   443     CEikonEnv* iEEnv;
   436     CEikonEnv* iEEnv;
   444 
   437     
   445     /**
   438     /**
   446      * Not own - Suite observer.
   439      * Not own - Suite observer.
   447      */
   440      */
   448     MHnControllerInterface& iControllerInterface;
   441     MHnControllerInterface& iControllerInterface;
   449 
   442 
   450     /**
   443     /**
   451      * Edit mode
   444      * Edit mode
   452      */
   445      */
   453     TBool iEditMode;
   446     TBool iEditMode;
   454 
   447     
   455     /**
   448     /**
   456      * Light status observer
   449      * Light status observer
   457      */
   450      */
   458     CHWRMLight* iLight;
   451     CHWRMLight* iLight;
   459     };
   452     };