14 * Description: Customisation manager. |
14 * Description: Customisation manager. |
15 * |
15 * |
16 */ |
16 */ |
17 |
17 |
18 |
18 |
|
19 |
19 #ifndef CALENCUSTOMISATIONMANAGER_H |
20 #ifndef CALENCUSTOMISATIONMANAGER_H |
20 #define CALENCUSTOMISATIONMANAGER_H |
21 #define CALENCUSTOMISATIONMANAGER_H |
21 |
22 |
22 #include <qglobal.h> // Q_DECL_EXPORT macro |
23 #include <aknsettingitemlist.h> // CAknSettingItem |
23 #include <e32base.h> // CBase |
24 #include <e32base.h> // CBase |
24 #include "calennotificationhandler.h" // MCalenNotificationHandler |
25 #include <calennotificationhandler.h> // MCalenNotificationHandler |
25 #include <ecom/ecom.h> // RImplInfoPtrArray |
26 #include <ecom/ecom.h> // RImplInfoPtrArray |
26 |
27 #include <calenview.h> // TCyclePosition |
27 |
|
28 #ifdef CALENCUSTOMISATIONMANAGER_DLL |
|
29 #define CUSTOMISATIONMANAGER_EXPORT Q_DECL_EXPORT |
|
30 #else |
|
31 #define CUSTOMISATIONMANAGER_EXPORT Q_DECL_IMPORT |
|
32 #endif |
|
33 |
28 |
34 // forward declarations |
29 // forward declarations |
35 |
30 class CEikMenuPane; |
36 |
31 class CCalenView; |
37 class CCalenCustomisation; |
32 class CCalenCustomisation; |
38 class MCalenCommandHandler; |
33 class MCalenCommandHandler; |
|
34 class CCalenGlobalData; |
|
35 class CCoeControl; |
|
36 class CCalenViewInfo; |
|
37 class CAknSettingItem; |
39 class MCalenServicesFactory; |
38 class MCalenServicesFactory; |
40 class MCalenServices; |
39 class MCalenServices; |
41 class HbWidget; |
40 class CCalenSetting; |
42 class HbMenu; |
41 class MCalenPreview; |
43 |
42 |
44 /** |
43 /** |
45 * CCalenCustomisationManager manages customisations for calendar. |
44 * CCalenCustomisationManager manages customisations for calendar. |
46 * |
45 * |
47 */ |
46 */ |
48 class CUSTOMISATIONMANAGER_EXPORT CCalenCustomisationManager : public CBase, |
47 class CCalenCustomisationManager : public CBase, |
49 public MCalenNotificationHandler |
48 public MCalenNotificationHandler |
50 { |
49 { |
51 public: // Types |
50 public: // Types |
52 /** |
51 /** |
53 * Struct showing the uid and availaibility of known plugins. |
52 * Struct showing the uid and availaibility of known plugins. |
64 |
63 |
65 public: // Construction and destruction |
64 public: // Construction and destruction |
66 /** |
65 /** |
67 * Returns a new CCalenCustomisationManager object. |
66 * Returns a new CCalenCustomisationManager object. |
68 */ |
67 */ |
69 static CCalenCustomisationManager* NewL( |
68 IMPORT_C static CCalenCustomisationManager* NewL( |
70 MCalenServicesFactory& aFactory, |
69 MCalenServicesFactory& aFactory, |
71 MCalenServices& aServices ); |
70 CCalenPluginStatusArray& aPluginSettingsStatus, |
72 |
71 MCalenServices& aServices, |
73 static TBool PluginInfoFinder( const TUid* aUid , |
72 RPointerArray<CCalenViewInfo>& aViewArray ); |
74 const CImplementationInformation& aArrayItem); |
73 |
75 |
|
76 /** |
74 /** |
77 * Destructor. |
75 * Destructor. |
78 */ |
76 */ |
79 ~CCalenCustomisationManager(); |
77 ~CCalenCustomisationManager(); |
80 |
78 |
81 public: // New functions |
79 public: // New functions |
82 |
80 /** |
|
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 ); |
83 |
100 |
84 /** |
101 /** |
85 * Gets a info bar from the appropriate customisation. |
102 * Gets a info bar from the appropriate customisation. |
86 */ |
103 */ |
87 HbWidget* Infobar(); |
104 IMPORT_C CCoeControl* Infobar( const TRect& aRect ); |
88 |
105 |
89 /** |
106 /** |
90 * Returns info bar text |
107 * Gets a info bar from the appropriate customisation. |
91 */ |
108 */ |
92 QString* InfobarTextL(); |
109 IMPORT_C const TDesC& Infobar(); |
93 |
110 |
94 /** |
111 /** |
95 * Offer the menu to Plugins to customisation |
112 * Gets settings from the given plugin. |
96 * @param aMenu Where the customisation apply to |
113 * NOTE: The contents of the array are owned by the caller - caller |
|
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 |
97 */ |
121 */ |
98 void OfferMenu(HbMenu* aHbMenu); |
122 IMPORT_C const RArray<TUid>& ActivePlugins() const; |
99 |
123 |
100 /** |
124 /** |
101 * Get a command handler for a specific command |
125 * GetCustomViews returns custom views info in an array for a given |
102 * @param aCommand Command to find a command handler for |
126 * plugin. |
103 */ |
127 * NOTE: The contents of the array are owned by the caller - caller |
104 MCalenCommandHandler* GetCommandHandlerL( TInt aCommand ); |
128 * must guarantee to call ResetAndDestroy on the array in all cases. |
105 |
129 */ |
106 /** |
130 IMPORT_C void GetCustomViewsL( TUid aPluginUid, |
107 * Returns a reference to an array of active plugins uids |
131 RPointerArray<CCalenView>& aViews ); |
108 */ |
|
109 const RArray<TUid>& ActivePlugins() const; |
|
110 |
132 |
111 /** |
133 /** |
112 * Disables the given plugin. Does nothing if the plugin can't be found. |
134 * Disables the given plugin. Does nothing if the plugin can't be found. |
113 */ |
135 */ |
114 void SetPluginAvailabilityL( TUid aPluginUid, TBool aEnabled ); |
136 IMPORT_C void SetPluginAvailabilityL( TUid aPluginUid, TBool aEnabled ); |
115 |
137 |
116 /** |
138 /** |
117 * Returns a const reference to the plugin information array. |
139 * Returns a const reference to the plugin information array. |
118 */ |
140 */ |
119 const RImplInfoPtrArray& PluginInfoArray() const; |
141 IMPORT_C const RImplInfoPtrArray& PluginInfoArray() const; |
|
142 |
|
143 /** |
|
144 * Returns a const reference to the views array. |
|
145 */ |
|
146 IMPORT_C const RPointerArray<CCalenViewInfo>& Views() const; |
120 |
147 |
121 /** |
148 /** |
122 * When a plugin is disabled it can not be unloaded until |
149 * When a plugin is disabled it can not be unloaded until |
123 * any views etc it has provided have been deleted. This function |
150 * any views etc it has provided have been deleted. This function |
124 * is called when it is safe to unload the plugin. |
151 * is called when it is safe to unload the plugin. |
125 */ |
152 */ |
126 void UnloadPluginsL( const RArray<TUid>& aPlugins); |
153 IMPORT_C void UnloadPluginsL( const RArray<TUid>& aPlugins); |
127 |
154 |
|
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 ); |
128 |
169 |
|
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 |
129 public: // from MCalenNotificationHandler |
189 public: // from MCalenNotificationHandler |
130 void HandleNotification(const TCalenNotification aNotification ); |
190 void HandleNotification(const TCalenNotification aNotification ); |
131 |
191 |
132 private: // Constructors |
192 private: // Constructors |
133 CCalenCustomisationManager( MCalenServicesFactory& aFactory, |
193 CCalenCustomisationManager( MCalenServicesFactory& aFactory, |
134 MCalenServices& aServices ); |
194 MCalenServices& aServices, |
|
195 RPointerArray<CCalenViewInfo>& aViewArray, |
|
196 CCalenPluginStatusArray& aPluginSettingsStatus ); |
135 |
197 |
136 void ConstructL(); |
198 void ConstructL(); |
137 |
199 |
138 private: // New functions |
200 private: // New functions |
139 void LoadPluginL( TUid aPluginUid ); |
201 void LoadPluginL( TUid aPluginUid ); |
140 |
202 |
141 void DoImmediatePluginLoadingL(); |
203 void DoImmediatePluginLoadingL(); |
|
204 |
|
205 void OfferMenuPaneToPluginsL( TInt aResourceId, CEikMenuPane* aMenuPane ); |
142 |
206 |
143 CCalenCustomisation* FindPluginL( TUid aUid ); |
207 CCalenCustomisation* FindPluginL( TUid aUid ); |
144 |
208 |
145 static TBool PluginAvailabilityFinder( const TUid* aUid, |
209 static TBool PluginAvailabilityFinder( const TUid* aUid, |
146 const TCalenPluginAvailability& aArrayItem ); |
210 const TCalenPluginAvailability& aArrayItem ); |
|
211 |
|
212 static TBool PluginInfoFinder( const TUid* aUid , |
|
213 const CImplementationInformation& aArrayItem); |
147 |
214 |
148 void AddPluginL( CCalenCustomisation* aPlugin, TUid aUid ); |
215 void AddPluginL( CCalenCustomisation* aPlugin, TUid aUid ); |
|
216 RPointerArray<CCalenViewInfo>& ViewInfoArray(); |
149 |
217 |
150 void CreateActivePluginListL(); |
218 void CreateActivePluginListL(); |
151 |
|
152 void LoadPluginsBasedOnVariantL(); |
|
153 |
219 |
154 void EnablePluginL( TUid aPluginUid ); |
220 void EnablePluginL( TUid aPluginUid ); |
155 |
221 |
156 void DisablePluginL( TUid aPluginUid ); |
222 void DisablePluginL( TUid aPluginUid ); |
|
223 |
|
224 void CheckHiddenViewL( TUid aViewUid, TUid aPluginUid ); |
157 |
225 |
158 void HandleNotificationL(TCalenNotification aNotification); |
226 void HandleNotificationL(TCalenNotification aNotification); |
159 |
227 |
|
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 |
160 private: |
241 private: |
161 /** |
242 /** |
162 * Internal class used as a wrapper around a plugin |
243 * Internal class used as a wrapper around a plugin |
163 * and its uid. |
244 * and its uid. |
164 */ |
245 */ |