calendarui/customisationmanager/inc/calencustomisationmanager.h
branchRCL_3
changeset 65 12af337248b1
parent 60 96907930389d
child 66 bd7edf625bdd
equal deleted inserted replaced
60:96907930389d 65:12af337248b1
    14 * Description:  Customisation manager.
    14 * Description:  Customisation manager.
    15 *
    15 *
    16 */
    16 */
    17 
    17 
    18 
    18 
    19 
       
    20 #ifndef CALENCUSTOMISATIONMANAGER_H
    19 #ifndef CALENCUSTOMISATIONMANAGER_H
    21 #define CALENCUSTOMISATIONMANAGER_H
    20 #define CALENCUSTOMISATIONMANAGER_H
    22 
    21 
    23 #include <aknsettingitemlist.h>         // CAknSettingItem
    22 #include <qglobal.h>					// Q_DECL_EXPORT macro
    24 #include <e32base.h>                    // CBase
    23 #include <e32base.h>                    // CBase
    25 #include <calennotificationhandler.h>   // MCalenNotificationHandler
    24 #include "calennotificationhandler.h"   // MCalenNotificationHandler
    26 #include <ecom/ecom.h>                  // RImplInfoPtrArray
    25 #include <ecom/ecom.h>                  // RImplInfoPtrArray
    27 #include <calenview.h>                  // TCyclePosition
    26 
       
    27 
       
    28 #ifdef  CALENCUSTOMISATIONMANAGER_DLL
       
    29 #define CUSTOMISATIONMANAGER_EXPORT Q_DECL_EXPORT
       
    30 #else
       
    31 #define CUSTOMISATIONMANAGER_EXPORT Q_DECL_IMPORT
       
    32 #endif
    28 
    33 
    29 // forward declarations
    34 // forward declarations
    30 class CEikMenuPane;
    35 
    31 class CCalenView;
    36 
    32 class CCalenCustomisation;
    37 class CCalenCustomisation;
    33 class MCalenCommandHandler;
    38 class MCalenCommandHandler;
    34 class CCalenGlobalData;
       
    35 class CCoeControl;
       
    36 class CCalenViewInfo;
       
    37 class CAknSettingItem;
       
    38 class MCalenServicesFactory;
    39 class MCalenServicesFactory;
    39 class MCalenServices;
    40 class MCalenServices;
    40 class CCalenSetting;
    41 class HbWidget;
    41 class MCalenPreview;
    42 class HbMenu;
    42 
    43 
    43 /**
    44 /**
    44 * CCalenCustomisationManager manages customisations for calendar.
    45 * CCalenCustomisationManager manages customisations for calendar.
    45 *
    46 *
    46 */
    47 */
    47 class CCalenCustomisationManager : public CBase,
    48 class CUSTOMISATIONMANAGER_EXPORT CCalenCustomisationManager : public CBase,
    48                                    public MCalenNotificationHandler
    49                                    public MCalenNotificationHandler
    49     {
    50     {
    50 public:  // Types
    51 public:  // Types
    51     /**
    52     /**
    52      * Struct showing the uid and availaibility of known plugins.
    53      * Struct showing the uid and availaibility of known plugins.
    63 
    64 
    64 public:  // Construction and destruction
    65 public:  // Construction and destruction
    65     /**
    66     /**
    66      * Returns a new CCalenCustomisationManager object.
    67      * Returns a new CCalenCustomisationManager object.
    67      */
    68      */
    68     IMPORT_C static CCalenCustomisationManager* NewL(
    69     static CCalenCustomisationManager* NewL(
    69                                        MCalenServicesFactory& aFactory,
    70                                        MCalenServicesFactory& aFactory,                                       
    70                                        CCalenPluginStatusArray& aPluginSettingsStatus,
    71 									   									 MCalenServices& aServices );
    71 									   MCalenServices& aServices,
    72 
    72 									   RPointerArray<CCalenViewInfo>& aViewArray );
    73     static TBool PluginInfoFinder( const TUid* aUid  , 
    73 
    74 								const CImplementationInformation&  aArrayItem);
       
    75     
    74     /**
    76     /**
    75      * Destructor.
    77      * Destructor.
    76      */
    78      */
    77     ~CCalenCustomisationManager();
    79     ~CCalenCustomisationManager();
    78 
    80 
    79 public:  // New functions
    81 public:  // New functions
    80     /**
    82  
    81     * Get a command handler for a specific command
       
    82     * @param aCommand Command to find a command handler for
       
    83     */
       
    84     IMPORT_C MCalenCommandHandler* GetCommandHandlerL( TInt aCommand );
       
    85 
       
    86     /**
       
    87      * Offers the menu pane to customisations for modification.
       
    88      */
       
    89     IMPORT_C void OfferMenuPaneL( TInt aResourceId, CEikMenuPane* aMenuPane );
       
    90 
       
    91     /**
       
    92      * Gets a custom preview pane from the appropriate customisation.
       
    93      */
       
    94     IMPORT_C MCalenPreview* CustomPreviewPaneL( TRect& aRect );
       
    95     
       
    96     /**
       
    97      * Gets a preview pane from the appropriate customisation.
       
    98      */
       
    99     IMPORT_C CCoeControl* PreviewPane( TRect& aRect );
       
   100 
    83 
   101     /**
    84     /**
   102      * Gets a info bar from the appropriate customisation.
    85      * Gets a info bar from the appropriate customisation.
   103      */
    86      */
   104     IMPORT_C CCoeControl* Infobar( const TRect& aRect );
    87     HbWidget* Infobar();
   105     
    88     
   106     /**
    89     /**        
   107      * Gets a info bar from the appropriate customisation.
    90      * Returns info bar text
   108      */
    91      */
   109     IMPORT_C const TDesC& Infobar();
    92     QString* InfobarTextL();
   110 
    93     
   111     /**
    94     /**
   112      * Gets settings from the given plugin.
    95       * Offer the menu to Plugins to customisation
   113      * NOTE: The contents of the array are owned by the caller - caller
    96       * @param aMenu Where the customisation apply to
   114      * must guarantee to call ResetAndDestroy on the array in all cases.
       
   115      */
       
   116     IMPORT_C void GetPluginSettingsL( TUid aPluginUid,
       
   117                                       RPointerArray<CAknSettingItem>& aSettingArray );
       
   118 
       
   119      /**
       
   120       * Returns a reference to an array of active plugins uids
       
   121       */
    97       */
   122      IMPORT_C const RArray<TUid>& ActivePlugins() const;
    98     void OfferMenu(HbMenu* aHbMenu);
   123 
    99     
   124      /**
   100     /**
   125       * GetCustomViews returns custom views info in an array for a given
   101      * Get a command handler for a specific command
   126       * plugin.
   102      * @param aCommand Command to find a command handler for
   127       * NOTE: The contents of the array are owned by the caller - caller
   103      */
   128       * must guarantee to call ResetAndDestroy on the array in all cases.
   104     MCalenCommandHandler* GetCommandHandlerL( TInt aCommand );
   129       */
   105     
   130      IMPORT_C void GetCustomViewsL( TUid aPluginUid,
   106     /**
   131                                     RPointerArray<CCalenView>& aViews );
   107      * Returns a reference to an array of active plugins uids
       
   108      */
       
   109     const RArray<TUid>& ActivePlugins() const;
   132 
   110 
   133     /**
   111     /**
   134      * Disables the given plugin. Does nothing if the plugin can't be found.
   112      * Disables the given plugin. Does nothing if the plugin can't be found.
   135      */
   113      */
   136     IMPORT_C void SetPluginAvailabilityL( TUid aPluginUid, TBool aEnabled );
   114     void SetPluginAvailabilityL( TUid aPluginUid, TBool aEnabled );
   137 
   115 
   138     /**
   116     /**
   139      * Returns a const reference to the plugin information array.
   117      * Returns a const reference to the plugin information array.
   140      */
   118      */
   141     IMPORT_C const RImplInfoPtrArray& PluginInfoArray() const;
   119     const RImplInfoPtrArray& PluginInfoArray() const;
   142 
       
   143     /**
       
   144      * Returns a const reference to the views array.
       
   145      */
       
   146     IMPORT_C const RPointerArray<CCalenViewInfo>& Views() const;
       
   147 
   120 
   148     /**
   121     /**
   149      * When a plugin is disabled it can not be unloaded until
   122      * When a plugin is disabled it can not be unloaded until
   150      * any views etc it has provided have been deleted. This function
   123      * any views etc it has provided have been deleted. This function
   151      * is called when it is safe to unload the plugin.
   124      * is called when it is safe to unload the plugin.
   152      */
   125      */
   153     IMPORT_C void UnloadPluginsL( const RArray<TUid>& aPlugins);
   126     void UnloadPluginsL( const RArray<TUid>& aPlugins);    
   154     
   127    
   155     /**
       
   156      * Returns ETrue if a view has been hidden by a plugin, 
       
   157      */
       
   158     IMPORT_C TBool HiddenView( TUid aHiddenView) const;
       
   159     
       
   160     /**
       
   161      * Returns if a view is provided by a rom based plugin
       
   162      */ 
       
   163      IMPORT_C TBool IsViewRomBased( TUid aViewUid ) const;
       
   164 
       
   165     /**
       
   166      * Fills the list of views hidden by a particular plugin
       
   167      */ 
       
   168     IMPORT_C void GetHiddenViewIdL( TUid aPluginUid, RArray<TInt>& aHiddenViews );
       
   169      
   128      
   170     /**
       
   171      * Returns plugin view uid that is hidking the input view
       
   172      */ 
       
   173     IMPORT_C TUid GetReplacePluginViewIdL( TUid aHiddenViewId );
       
   174     /**
       
   175      * Returns if plugin can be enabled/disabled from settings
       
   176      */
       
   177     IMPORT_C TBool CanBeEnabledDisabledL(TUid aPluginUid);
       
   178 	
       
   179     /**
       
   180      * Disable all plugins 
       
   181      */
       
   182     IMPORT_C void DisableAllPluginsL();
       
   183     
       
   184     /**
       
   185      * Reload all plugins
       
   186      */
       
   187     IMPORT_C void DoPluginLoadingL();
       
   188     
       
   189 public:  // from MCalenNotificationHandler
   129 public:  // from MCalenNotificationHandler
   190     void HandleNotification(const TCalenNotification aNotification );
   130     void HandleNotification(const TCalenNotification aNotification );
   191 
   131 
   192 private: // Constructors
   132 private: // Constructors
   193     CCalenCustomisationManager( MCalenServicesFactory& aFactory,
   133     CCalenCustomisationManager( MCalenServicesFactory& aFactory,
   194                                 MCalenServices& aServices,
   134                                 MCalenServices& aServices );
   195                                 RPointerArray<CCalenViewInfo>& aViewArray,
       
   196                                 CCalenPluginStatusArray& aPluginSettingsStatus );
       
   197 
   135 
   198     void ConstructL();
   136     void ConstructL();
   199 
   137 
   200 private: // New functions
   138 private: // New functions
   201     void LoadPluginL( TUid aPluginUid );
   139     void LoadPluginL( TUid aPluginUid );
   202 
   140 
   203     void DoImmediatePluginLoadingL();   
   141     void DoImmediatePluginLoadingL();    
   204 
       
   205     void OfferMenuPaneToPluginsL( TInt aResourceId, CEikMenuPane* aMenuPane );
       
   206 
   142 
   207     CCalenCustomisation* FindPluginL( TUid aUid );
   143     CCalenCustomisation* FindPluginL( TUid aUid );
   208 
   144 
   209     static TBool PluginAvailabilityFinder( const TUid* aUid, 
   145     static TBool PluginAvailabilityFinder( const TUid* aUid, 
   210                                  const TCalenPluginAvailability& aArrayItem );
   146                                  const TCalenPluginAvailability& aArrayItem );
   211                                  
       
   212     static TBool PluginInfoFinder( const TUid* aUid , 
       
   213    															const CImplementationInformation&  aArrayItem);
       
   214                                      
   147                                      
   215     void AddPluginL( CCalenCustomisation* aPlugin, TUid aUid ); 
   148     void AddPluginL( CCalenCustomisation* aPlugin, TUid aUid );     
   216     RPointerArray<CCalenViewInfo>& ViewInfoArray();
       
   217 
   149 
   218     void CreateActivePluginListL();
   150     void CreateActivePluginListL();
       
   151     
       
   152     void LoadPluginsBasedOnVariantL();
   219 
   153 
   220     void EnablePluginL( TUid aPluginUid );
   154     void EnablePluginL( TUid aPluginUid );
   221 
   155 
   222     void DisablePluginL( TUid aPluginUid );
   156     void DisablePluginL( TUid aPluginUid );    
   223     
       
   224     void CheckHiddenViewL( TUid aViewUid, TUid aPluginUid  );
       
   225     
   157     
   226     void HandleNotificationL(TCalenNotification aNotification);
   158     void HandleNotificationL(TCalenNotification aNotification);
   227     
   159 
   228   
       
   229     
       
   230     /**
       
   231      * Disable plugin on fake exit
       
   232      */
       
   233     void DisablePluginOnFakeExitL(TUid aPluginUid);
       
   234    
       
   235     /*
       
   236      * Load custom plugins based on the variant
       
   237      */
       
   238 	void LoadPluginsBasedOnVariantL();
       
   239    
       
   240     
       
   241 private:
   160 private:
   242     /**
   161     /**
   243      * Internal class used as a wrapper around a plugin
   162      * Internal class used as a wrapper around a plugin
   244      * and its uid.
   163      * and its uid.
   245      */
   164      */
   262             TUid iUid;
   181             TUid iUid;
   263             TBool iDisabled;
   182             TBool iDisabled;
   264         };
   183         };
   265 
   184 
   266 private: // Data
   185 private: // Data
       
   186     
   267     RImplInfoPtrArray iPluginInfo;
   187     RImplInfoPtrArray iPluginInfo;
   268 
       
   269     MCalenServicesFactory& iServicesFactory;
   188     MCalenServicesFactory& iServicesFactory;
   270 
       
   271     // takes ownership of the plugins
   189     // takes ownership of the plugins
   272     RPointerArray<CPluginInfo> iPlugins;
   190     RPointerArray<CPluginInfo> iPlugins;
   273 
       
   274     // Array of views. Neither the array nor the contents are owned here at any time.
       
   275     RPointerArray<CCalenViewInfo>& iViewInfoArray;
       
   276 
       
   277     RArray<TUid> iActivePlugins;
   191     RArray<TUid> iActivePlugins;
   278     RArray<TUid> iRomBasedPlugins;
   192     RArray<TUid> iRomBasedPlugins;   
   279 
       
   280     CCalenGlobalData* iGlobalData;
       
   281 
       
   282     TLinearOrder<CCalenViewInfo> iSortOrder;
       
   283     
       
   284     MCalenServices& iServices;
   193     MCalenServices& iServices;
   285 
   194     TUid iInfoBarProviderUid;    
   286     TUid iInfoBarProviderUid;
       
   287     TUid iPreviewPaneProviderUid;
       
   288     
       
   289     RArray<TInt> iHiddenViews;
       
   290     
       
   291     CCalenPluginStatusArray& iPluginSettingsStatus;
       
   292     
       
   293     TBool iPluginsEnabledDisabled;
   195     TBool iPluginsEnabledDisabled;
   294     RArray<TUid> iDefferedUnloadPluginList; 
   196     RArray<TUid> iDefferedUnloadPluginList; 
   295     CCalenSetting* iSetting;
   197     
   296     TPtrC iInfoBarStr;
       
   297     };
   198     };
   298 
   199 
   299 #endif    // CALENCUSTOMISATIONMANAGER_H
   200 #endif    // CALENCUSTOMISATIONMANAGER_H
   300 
   201 
   301 // End of File
   202 // End of File