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 RPointerArray<CCalenViewInfo>& aViewArray ); |
|
73 |
72 |
74 /** |
73 /** |
75 * Destructor. |
74 * Destructor. |
76 */ |
75 */ |
77 ~CCalenCustomisationManager(); |
76 ~CCalenCustomisationManager(); |
78 |
77 |
79 public: // New functions |
78 public: // New functions |
80 /** |
79 |
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 |
80 |
101 /** |
81 /** |
102 * Gets a info bar from the appropriate customisation. |
82 * Gets a info bar from the appropriate customisation. |
103 */ |
83 */ |
104 IMPORT_C CCoeControl* Infobar( const TRect& aRect ); |
84 HbWidget* Infobar(); |
|
85 |
|
86 /** |
|
87 * Returns info bar text |
|
88 */ |
|
89 QString* InfobarTextL(); |
105 |
90 |
106 /** |
91 /** |
107 * Gets a info bar from the appropriate customisation. |
92 * Offer the menu to Plugins to customisation |
|
93 * @param aMenu Where the customisation apply to |
|
94 */ |
|
95 void OfferMenu(HbMenu* aHbMenu); |
|
96 |
|
97 /** |
|
98 * Get a command handler for a specific command |
|
99 * @param aCommand Command to find a command handler for |
108 */ |
100 */ |
109 IMPORT_C const TDesC& Infobar(); |
101 MCalenCommandHandler* GetCommandHandlerL( TInt aCommand ); |
110 |
102 |
111 /** |
103 /** |
112 * Gets settings from the given plugin. |
104 * Returns a reference to an array of active plugins uids |
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 */ |
105 */ |
116 IMPORT_C void GetPluginSettingsL( TUid aPluginUid, |
106 const RArray<TUid>& ActivePlugins() const; |
117 RPointerArray<CAknSettingItem>& aSettingArray ); |
|
118 |
|
119 /** |
|
120 * Returns a reference to an array of active plugins uids |
|
121 */ |
|
122 IMPORT_C const RArray<TUid>& ActivePlugins() const; |
|
123 |
|
124 /** |
|
125 * GetCustomViews returns custom views info in an array for a given |
|
126 * plugin. |
|
127 * NOTE: The contents of the array are owned by the caller - caller |
|
128 * must guarantee to call ResetAndDestroy on the array in all cases. |
|
129 */ |
|
130 IMPORT_C void GetCustomViewsL( TUid aPluginUid, |
|
131 RPointerArray<CCalenView>& aViews ); |
|
132 |
107 |
133 /** |
108 /** |
134 * Disables the given plugin. Does nothing if the plugin can't be found. |
109 * Disables the given plugin. Does nothing if the plugin can't be found. |
135 */ |
110 */ |
136 IMPORT_C void SetPluginAvailabilityL( TUid aPluginUid, TBool aEnabled ); |
111 void SetPluginAvailabilityL( TUid aPluginUid, TBool aEnabled ); |
137 |
112 |
138 /** |
113 /** |
139 * Returns a const reference to the plugin information array. |
114 * Returns a const reference to the plugin information array. |
140 */ |
115 */ |
141 IMPORT_C const RImplInfoPtrArray& PluginInfoArray() const; |
116 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 |
117 |
148 /** |
118 /** |
149 * When a plugin is disabled it can not be unloaded until |
119 * When a plugin is disabled it can not be unloaded until |
150 * any views etc it has provided have been deleted. This function |
120 * any views etc it has provided have been deleted. This function |
151 * is called when it is safe to unload the plugin. |
121 * is called when it is safe to unload the plugin. |
152 */ |
122 */ |
153 IMPORT_C void UnloadPluginsL( const RArray<TUid>& aPlugins); |
123 void UnloadPluginsL( const RArray<TUid>& aPlugins); |
154 |
124 |
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 |
125 |
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 |
126 public: // from MCalenNotificationHandler |
190 void HandleNotification(const TCalenNotification aNotification ); |
127 void HandleNotification(const TCalenNotification aNotification ); |
191 |
128 |
192 private: // Constructors |
129 private: // Constructors |
193 CCalenCustomisationManager( MCalenServicesFactory& aFactory, |
130 CCalenCustomisationManager( MCalenServicesFactory& aFactory, |
194 MCalenServices& aServices, |
131 MCalenServices& aServices ); |
195 RPointerArray<CCalenViewInfo>& aViewArray, |
|
196 CCalenPluginStatusArray& aPluginSettingsStatus ); |
|
197 |
132 |
198 void ConstructL(); |
133 void ConstructL(); |
199 |
134 |
200 private: // New functions |
135 private: // New functions |
201 void LoadPluginL( TUid aPluginUid ); |
136 void LoadPluginL( TUid aPluginUid ); |
202 |
137 |
203 void DoImmediatePluginLoadingL(); |
138 void DoImmediatePluginLoadingL(); |
204 |
|
205 void OfferMenuPaneToPluginsL( TInt aResourceId, CEikMenuPane* aMenuPane ); |
|
206 |
139 |
207 CCalenCustomisation* FindPluginL( TUid aUid ); |
140 CCalenCustomisation* FindPluginL( TUid aUid ); |
208 |
141 |
209 static TBool PluginAvailabilityFinder( const TUid* aUid, |
142 static TBool PluginAvailabilityFinder( const TUid* aUid, |
210 const TCalenPluginAvailability& aArrayItem ); |
143 const TCalenPluginAvailability& aArrayItem ); |
211 |
|
212 static TBool PluginInfoFinder( const TUid* aUid , |
|
213 const CImplementationInformation& aArrayItem); |
|
214 |
144 |
215 void AddPluginL( CCalenCustomisation* aPlugin, TUid aUid ); |
145 void AddPluginL( CCalenCustomisation* aPlugin, TUid aUid ); |
216 RPointerArray<CCalenViewInfo>& ViewInfoArray(); |
|
217 |
146 |
218 void CreateActivePluginListL(); |
147 void CreateActivePluginListL(); |
219 |
148 |
220 void EnablePluginL( TUid aPluginUid ); |
149 void EnablePluginL( TUid aPluginUid ); |
221 |
150 |
222 void DisablePluginL( TUid aPluginUid ); |
151 void DisablePluginL( TUid aPluginUid ); |
223 |
|
224 void CheckHiddenViewL( TUid aViewUid, TUid aPluginUid ); |
|
225 |
152 |
226 void HandleNotificationL(TCalenNotification aNotification); |
153 void HandleNotificationL(TCalenNotification aNotification); |
227 |
154 |
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: |
155 private: |
242 /** |
156 /** |
243 * Internal class used as a wrapper around a plugin |
157 * Internal class used as a wrapper around a plugin |
244 * and its uid. |
158 * and its uid. |
245 */ |
159 */ |
262 TUid iUid; |
176 TUid iUid; |
263 TBool iDisabled; |
177 TBool iDisabled; |
264 }; |
178 }; |
265 |
179 |
266 private: // Data |
180 private: // Data |
|
181 |
267 RImplInfoPtrArray iPluginInfo; |
182 RImplInfoPtrArray iPluginInfo; |
268 |
|
269 MCalenServicesFactory& iServicesFactory; |
183 MCalenServicesFactory& iServicesFactory; |
270 |
|
271 // takes ownership of the plugins |
184 // takes ownership of the plugins |
272 RPointerArray<CPluginInfo> iPlugins; |
185 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; |
186 RArray<TUid> iActivePlugins; |
278 RArray<TUid> iRomBasedPlugins; |
187 RArray<TUid> iRomBasedPlugins; |
279 |
|
280 CCalenGlobalData* iGlobalData; |
|
281 |
|
282 TLinearOrder<CCalenViewInfo> iSortOrder; |
|
283 |
|
284 MCalenServices& iServices; |
188 MCalenServices& iServices; |
285 |
189 TUid iInfoBarProviderUid; |
286 TUid iInfoBarProviderUid; |
|
287 TUid iPreviewPaneProviderUid; |
|
288 |
|
289 RArray<TInt> iHiddenViews; |
|
290 |
|
291 CCalenPluginStatusArray& iPluginSettingsStatus; |
|
292 |
|
293 TBool iPluginsEnabledDisabled; |
190 TBool iPluginsEnabledDisabled; |
294 RArray<TUid> iDefferedUnloadPluginList; |
191 RArray<TUid> iDefferedUnloadPluginList; |
295 CCalenSetting* iSetting; |
192 |
296 TPtrC iInfoBarStr; |
|
297 }; |
193 }; |
298 |
194 |
299 #endif // CALENCUSTOMISATIONMANAGER_H |
195 #endif // CALENCUSTOMISATIONMANAGER_H |
300 |
196 |
301 // End of File |
197 // End of File |