idlehomescreen/nativeuicontroller/inc/nativeuicontroller.h
branchRCL_3
changeset 9 f966699dea19
parent 4 4d54b72983ae
equal deleted inserted replaced
5:c743ef5928ba 9:f966699dea19
    17 
    17 
    18 
    18 
    19 #ifndef C_NATIVEUICONTROLLER_H
    19 #ifndef C_NATIVEUICONTROLLER_H
    20 #define C_NATIVEUICONTROLLER_H
    20 #define C_NATIVEUICONTROLLER_H
    21 
    21 
    22 
    22 // System includes
    23 #include <aisystemuids.hrh>
    23 #include <aisystemuids.hrh>
    24 #include "aiuicontroller.h"
    24 
    25 #include "aiuiframeworkobserver.h"
    25 // User includes
    26 #include "aicontentobserver.h"
    26 #include <aiuicontroller.h>
    27 
    27 #include <aicontentobserver.h>
    28 #include <aiutility.h>
    28 #include <aiutility.h>
    29 
    29 
    30 class MAiPropertyExtension;
    30 // Forward declarations
    31 class MAiPSPropertyObserver;
    31 class MAiPSPropertyObserver;
       
    32 class CHsContentPublisher;
       
    33 class THsPublisherInfo;
    32 
    34 
    33 namespace AiNativeUiController
    35 namespace AiNativeUiController
    34 {
    36 {
    35 
       
    36 class CAiNativeRenderer;
    37 class CAiNativeRenderer;
    37 class CAiStatusPanel;
    38 class CAiStatusPanel;
    38 class CAppUi;
    39 class CAppUi;
    39 class CAiToolbarRenderer;
       
    40 
    40 
    41 const TInt KImplementationUidNativeUiController = AI_UID_ECOM_IMPLEMENTATION_UICONTROLLER_NATIVE;
    41 const TInt KImplementationUidNativeUiController = AI_UID_ECOM_IMPLEMENTATION_UICONTROLLER_NATIVE;
    42 
    42 
    43 const TUid KUidNativeUiController = { KImplementationUidNativeUiController };
    43 const TUid KUidNativeUiController = { KImplementationUidNativeUiController };
    44 
    44 
    48 * the MAiContentObserver interface thus handling and forwarding the data coming
    48 * the MAiContentObserver interface thus handling and forwarding the data coming
    49 * from the publishers.
    49 * from the publishers.
    50 *
    50 *
    51 * @since Series 60 3.2
    51 * @since Series 60 3.2
    52 */
    52 */
    53 class CNativeUiController : public CAiUiController, 
    53 NONSHARABLE_CLASS( CNativeUiController ) : public CAiUiController, 
    54                             public MAiSecondaryUiController, 
    54     public MAiSecondaryUiController, public MAiMainUiController,                                                         
    55                             public MAiMainUiController, 
    55     public MAiContentObserver
    56                             public MAiUiFrameworkObserver,
       
    57                             public MAiContentObserver
       
    58 	{
    56 	{
    59 public:
    57 public:
    60 
    58     // Constructor and destructor
    61     static CNativeUiController* NewL();
    59     static CNativeUiController* NewL();
    62 
    60 
    63 	virtual ~CNativeUiController();
    61 	~CNativeUiController();
    64 
    62 
    65 // from base class CAiUiController
    63 public:	
    66 
    64     // from CAiUiController
    67     void PrepareToExit();
    65    
    68 
       
    69     void LoadUIDefinitionL();
    66     void LoadUIDefinitionL();
    70 
    67     
    71     void GetPluginsL(RAiPublisherInfoArray& aPlugins);
    68     void GetSettingsL( const THsPublisherInfo& aPublisherInfo, 
    72 
    69         RAiSettingsItemArray& aSettings );
    73     void GetSettingsL(const TAiPublisherInfo& aPubInfo, 
       
    74                         RAiSettingsItemArray& aSettings);
       
    75 
    70 
    76     void ActivateUI();
    71     void ActivateUI();
    77 
    72 
    78     MAiContentObserver& GetContentObserver();
    73     MAiContentObserver& GetContentObserver();
    79 
    74 
    80     void SetEventHandler(MAiFwEventHandler& aEventHandler);
    75     void SetEventHandler( MAiFwEventHandler& aEventHandler );
       
    76     
       
    77     void SetStateHandler( MAiFwStateHandler& aStateHandler );
    81 
    78 
    82     MAiFwEventHandler* FwEventHandler();
    79     MAiFwEventHandler* FwEventHandler();
    83 
    80 
    84     void RemovePluginFromUI( MAiPropertyExtension& aPlugin );
    81     MAiFwStateHandler* FwStateHandler();
    85 
    82        
    86     MAiMainUiController* MainInterface();
    83     MAiMainUiController* MainInterface();
    87 
    84 
    88     MAiSecondaryUiController* SecondaryInterface();
    85     MAiSecondaryUiController* SecondaryInterface();
    89     
    86             
    90     void HandleLoadedPlugins(const RAiPublisherInfoArray& /*aRequiredPlugins*/ ) {};
    87 public:    
    91     
    88     // from MAiMainUiController
    92 // from base class MAiMainUiController
       
    93 
    89 
    94     void RunApplicationL();
    90     void RunApplicationL();
    95 
    91 
    96     CCoeEnv& CoeEnv();
    92     CCoeEnv& CoeEnv();
    97 
       
    98     void SetUiFrameworkObserver( MAiUiFrameworkObserver& aObserver );
       
    99     
    93     
   100     TBool IsMenuOpen();
    94     TBool IsMenuOpen();
   101 
    95 
   102 // from base class CAiSecordaryUiController
    96 public:
       
    97     // from CAiSecordaryUiController
   103 
    98 
   104     void SetCoeEnv( CCoeEnv& aCoeEnv );
    99     void SetCoeEnv( CCoeEnv& aCoeEnv );
   105 
   100 
   106     MAiUiFrameworkObserver* UiFrameworkObserver(); 
   101 public:     
   107 
   102     // from MAiContentObserver       
   108 // from base class MAiUiFrameworkObserver
       
   109 
       
   110     void HandleResourceChange( TInt aType );
       
   111 
       
   112     void HandleForegroundEvent( TBool aForeground );
       
   113 
       
   114 // from base class MAiContentObserver
       
   115        
       
   116     TInt StartTransaction(TInt aTxId);
   103     TInt StartTransaction(TInt aTxId);
   117 
   104 
   118     TInt Commit(TInt aTxId);
   105     TInt Commit(TInt aTxId);
   119 
   106 
   120     TInt CancelTransaction(TInt aTxId);
   107     TInt CancelTransaction(TInt aTxId);
   121 
   108 
   122     TBool CanPublish(MAiPropertyExtension& aPlugin, TInt aContent, TInt aIndex);
   109     TBool CanPublish(CHsContentPublisher& aPlugin, TInt aContent, TInt aIndex);
   123 
   110 
   124     TInt Publish(MAiPropertyExtension& aPlugin, TInt aContent, TInt aResource, TInt aIndex );
   111     TInt Publish(CHsContentPublisher& aPlugin, TInt aContent, TInt aResource, TInt aIndex );
   125 
   112 
   126     TInt Publish(MAiPropertyExtension& aPlugin, TInt aContent, const TDesC16& aText, TInt aIndex );
   113     TInt Publish(CHsContentPublisher& aPlugin, TInt aContent, const TDesC16& aText, TInt aIndex );
   127 
   114 
   128     TInt Publish(MAiPropertyExtension& aPlugin, TInt aContent, const TDesC8& aBuf, TInt aIndex );
   115     TInt Publish(CHsContentPublisher& aPlugin, TInt aContent, const TDesC8& aBuf, TInt aIndex );
   129 
   116 
   130     TInt Publish(MAiPropertyExtension& aPlugin, TInt aContent, RFile& aFile, TInt aIndex );
   117     TInt Publish(CHsContentPublisher& aPlugin, TInt aContent, RFile& aFile, TInt aIndex );
   131 
   118 
   132     TInt Clean(MAiPropertyExtension& aPlugin, TInt aContent, TInt aIndex );
   119     TInt Clean(CHsContentPublisher& aPlugin, TInt aContent, TInt aIndex );
   133 
   120 
   134     TAny* Extension(TUid aUid);
   121     TAny* Extension(TUid aUid);
   135 
   122 
   136     TBool RequiresSubscription( const TAiPublisherInfo& aPublisherInfo ) const;
   123     TBool RequiresSubscription( const THsPublisherInfo& aPublisherInfo ) const;
   137     
   124     
   138     TInt SetProperty( MAiPropertyExtension& aPlugin,
   125     TInt SetProperty( CHsContentPublisher& aPlugin,
   139             const TDesC8& aElementId,
   126             const TDesC8& aElementId,
   140             const TDesC8& aPropertyName,
   127             const TDesC8& aPropertyName,
   141             const TDesC8& aPropertyValue );
   128             const TDesC8& aPropertyValue );
   142     
   129     
   143     TInt SetProperty( MAiPropertyExtension& aPlugin,
   130     TInt SetProperty( CHsContentPublisher& aPlugin,
   144             const TDesC8& aElementId,
   131             const TDesC8& aElementId,
   145             const TDesC8& aPropertyName,
   132             const TDesC8& aPropertyName,
   146             const TDesC8& aPropertyValue,  
   133             const TDesC8& aPropertyValue,  
   147             MAiContentObserver::TValueType aValueType);
   134             MAiContentObserver::TValueType aValueType);
   148 
   135 
   149 // new methods
   136 private:
   150 
   137     // constructors
       
   138     
       
   139     /**
       
   140      * C++ default contructor
       
   141      */
       
   142     CNativeUiController();
       
   143 
       
   144 public:    
       
   145     // new functions
       
   146        
   151     /**
   147     /**
   152      * Set app ui instance to this class.
   148      * Set app ui instance to this class.
   153      *
   149      *
   154      * @since S60 3.2
   150      * @since S60 3.2
   155      * @param aAppUi is pointer to app ui.
   151      * @param aAppUi is pointer to app ui.
   156      */
   152      */
   157     void SetAppUi( CAppUi* aAppUi )
   153     void SetAppUi( CAppUi* aAppUi );
   158         {
   154 
   159         iAppUi = aAppUi;
   155     /**
   160         }
   156      * Promotes this UI controller as main UI controller.
   161         
   157      *
       
   158      * @since S60 3.2     
       
   159      */    
   162     void VariateToMainUiController();
   160     void VariateToMainUiController();
   163 
   161 
       
   162     /**
       
   163      * Runs exit timer.
       
   164      *
       
   165      * @since S60 3.2     
       
   166      */        
   164     void Exit();
   167     void Exit();
   165 
   168 
       
   169     /**
       
   170      * Preperas to exit
       
   171      * 
       
   172      * @since S60 3.2  
       
   173      */
       
   174     void PrepareToExit();
       
   175     
   166 private:
   176 private:
   167 
   177     // new functions
   168     CNativeUiController();
   178     
   169 
       
   170     static CApaApplication* NewApplication();
       
   171 
       
   172     /**
   179     /**
   173      * Add renderer.
   180      * Add renderer.
   174      *
   181      *
   175      * Ownership transferred.
   182      * Ownership transferred.
   176      *
   183      *
   188      * @param aRenderer is pointer to the renderer to be removed
   195      * @param aRenderer is pointer to the renderer to be removed
   189      * @param aDelete is ETrue when the renderer will be deleted
   196      * @param aDelete is ETrue when the renderer will be deleted
   190      * @return ETrue upon successful removing.
   197      * @return ETrue upon successful removing.
   191      */
   198      */
   192     TBool RemoveRenderer( CAiNativeRenderer *aRenderer, TBool aDelete = EFalse );
   199     TBool RemoveRenderer( CAiNativeRenderer *aRenderer, TBool aDelete = EFalse );
   193 
       
   194     /**
       
   195      * Recreates the toolbar renderer
       
   196      */
       
   197     TBool RecreateToolbarRendererL();
       
   198 
       
   199     /**
       
   200      * Deletes and removes the toolbar renderer from
       
   201      * renderer array.
       
   202      */
       
   203     void DeleteToolbarRenderer();
       
   204     
   200     
   205     /**
   201     /**
   206      * Template function for publish.
   202      * Template function for publish.
   207      *
   203      *
   208      * @since S60 3.2
   204      * @since S60 3.2
   211      * @param aData is published data
   207      * @param aData is published data
   212      * @param aIndex is index in the control, not used by Native UI Controller.
   208      * @param aIndex is index in the control, not used by Native UI Controller.
   213      * @return KErrNone if publishing was successful.
   209      * @return KErrNone if publishing was successful.
   214      */
   210      */
   215 	template<class T>
   211 	template<class T>
   216     TInt DoPublish( MAiPropertyExtension& aPlugin, TInt aContent, T& aData, TInt aIndex );
   212     TInt DoPublish( CHsContentPublisher& aPlugin, TInt aContent, T& aData, TInt aIndex );
   217     
   213     
   218     /**
   214     /**
   219      * Handles idle state changes.
   215      * Handles idle state changes.
   220      *
   216      *
   221      * @since S60 v3.2
   217      * @since S60 v3.2
   230     static TInt HandleKeylockStateEvent( TAny* aPtr );
   226     static TInt HandleKeylockStateEvent( TAny* aPtr );
   231 
   227 
   232     static TInt HandlePluginConfChange( TAny* aPtr );
   228     static TInt HandlePluginConfChange( TAny* aPtr );
   233     
   229     
   234     static TInt ExitTimerCallBack( TAny* aSelf );
   230     static TInt ExitTimerCallBack( TAny* aSelf );
   235     void GetSettingsFromCRL( const TAiPublisherInfo& aPubInfo,
   231     void GetSettingsFromCRL( const THsPublisherInfo& aPublisherInfo,
   236                                                   RAiSettingsItemArray &aPluginSettings );
   232            RAiSettingsItemArray &aPluginSettings );
   237 
   233     
   238 private:     // Data
   234     static CApaApplication* NewApplication();
       
   235     
       
   236 private:     
       
   237     // data
   239 
   238 
   240     /**
   239     /**
   241      * Array of renderers.
   240      * Array of renderers.
   242      * Own.
   241      * Own.
   243      */
   242      */
   279     MAiPSPropertyObserver* iExtHsPluginConfChange;
   278     MAiPSPropertyObserver* iExtHsPluginConfChange;
   280 
   279 
   281     /**
   280     /**
   282      * Native UI controller plug-ins
   281      * Native UI controller plug-ins
   283      */
   282      */
   284     RAiPublisherInfoArray iPlugins;
   283     RArray< THsPublisherInfo > iPlugins;
   285     
   284     
   286     /**
   285     /**
   287       * Plug-in event handler.
   286       * Plug-in event handler.
   288       * Doesn't own.
   287       * Doesn't own.
   289       */
   288       */
   290     MAiFwEventHandler* iFwEventHandler;
   289     MAiFwEventHandler* iFwEventHandler;
       
   290 
       
   291     /**
       
   292       * Plug-in state handler.
       
   293       * Doesn't own.
       
   294       */    
       
   295     MAiFwStateHandler* iFwStateHandler;
   291     
   296     
   292     /**
   297     /**
   293      * Pointer to this, when role is main ui controller.
   298      * Pointer to this, when role is main ui controller.
   294      */
   299      */
   295     MAiMainUiController* iMain;
   300     MAiMainUiController* iMain;
   296 
   301 
   297     /**
       
   298      * Ui framework observer. Not own.
       
   299      */
       
   300     MAiUiFrameworkObserver* iUiFrameworkObserver;
       
   301     
       
   302     /**
   302     /**
   303      * Pointer to app ui.
   303      * Pointer to app ui.
   304      * Not own.
   304      * Not own.
   305      */
   305      */
   306     CAppUi* iAppUi;
   306     CAppUi* iAppUi;
   318     
   318     
   319     /**
   319     /**
   320     * To prevent double loading of the UI
   320     * To prevent double loading of the UI
   321     **/
   321     **/
   322     TBool iUiLoaded;
   322     TBool iUiLoaded;
   323     
       
   324     /**
       
   325      * Pointer to our toolbar renderer. Do not delete
       
   326      * renderer through this pointer
       
   327      */
       
   328     CAiToolbarRenderer *iToolbarRenderer;
       
   329 
       
   330     };
   323     };
   331 
   324 
   332 #include "nativeuicontroller.inl"
   325 #include "nativeuicontroller.inl"
   333 
   326 
   334 } // namespace AiNativeUiController
   327 } // namespace AiNativeUiController