|
1 /* |
|
2 * Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of "Eclipse Public License v1.0" |
|
6 * which accompanies this distribution, and is available |
|
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: Class for loading and handling the view plugins |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #ifndef __CCAPPLUGINLOADER_H__ |
|
20 #define __CCAPPLUGINLOADER_H__ |
|
21 |
|
22 #include <e32base.h> |
|
23 #include <RPbk2LocalizedResourceFile.h> |
|
24 #include <MPbk2StoreConfigurationObserver.h> |
|
25 |
|
26 class CCCAppView; |
|
27 class CCCAppPluginData; |
|
28 class CCCAppViewPluginBase; |
|
29 class CImplementationInformation; |
|
30 class CEikonEnv; |
|
31 class MCCAppEngine; |
|
32 class TCCAPluginsOrderInfo; |
|
33 class CcaPluginFactoryOwner; |
|
34 class TVPbkContactStoreUriPtr; |
|
35 class CPbk2ApplicationServices; |
|
36 /** |
|
37 * Class for loading and handling the plugins |
|
38 * |
|
39 * @code |
|
40 * ?good_class_usage_example(s) |
|
41 * @endcode |
|
42 * |
|
43 * @lib ccaapp.exe |
|
44 * @since S60 v5.0 |
|
45 */ |
|
46 class CCCAppPluginLoader : |
|
47 public CBase, |
|
48 public MPbk2StoreConfigurationObserver |
|
49 { |
|
50 #ifdef __CCAPPUNITTESTMODE |
|
51 friend class T_CCCAppPluginLoader; |
|
52 #endif// __CCAPPUNITTESTMODE |
|
53 |
|
54 public: |
|
55 |
|
56 /** |
|
57 * Two phase contstructor |
|
58 */ |
|
59 static CCCAppPluginLoader* NewL( |
|
60 MCCAppEngine* aAppEngine, |
|
61 const TDesC8& aPluginProperties, |
|
62 const TDesC8& aTypeFilter = KNullDesC8 ); |
|
63 |
|
64 /** |
|
65 * Destructor. |
|
66 */ |
|
67 ~CCCAppPluginLoader(); |
|
68 |
|
69 private: |
|
70 |
|
71 CCCAppPluginLoader(MCCAppEngine* aAppEngine); |
|
72 void ConstructL(const TDesC8& aPluginProperties, const TDesC8& aTypeFilter); |
|
73 |
|
74 public: |
|
75 |
|
76 /** |
|
77 * Returns the next plug-in data relative to the one in focus |
|
78 * and changes the focus |
|
79 * |
|
80 * @since S60 v5.0 |
|
81 * @param aOnlyVisiblePlugins EFalse: includes also hidden plugins |
|
82 * @return A plug-in data if it exists, NULL otherwise. |
|
83 */ |
|
84 CCCAppPluginData* NextPlugin( TBool aOnlyVisiblePlugins ); |
|
85 |
|
86 /** |
|
87 * Returns the previous plug-in data relative to the one in focus |
|
88 * and changes the focus |
|
89 * |
|
90 * @since S60 v5.0 |
|
91 * @param aOnlyVisiblePlugins EFalse: includes also hidden plugins |
|
92 * @return A plug-in data if it exists, NULL otherwise. |
|
93 */ |
|
94 CCCAppPluginData* PreviousPlugin( TBool aOnlyVisiblePlugins ); |
|
95 |
|
96 /** |
|
97 * Tries to set certain plugin in focus. |
|
98 * |
|
99 * @since S60 v5.0 |
|
100 * @param aUid is the plugin wanted to be in focus |
|
101 * @return index of succesfully set plugin, otherwise KErrNotFound. |
|
102 */ |
|
103 TInt SetPluginInFocus( const TUid aUid ); |
|
104 |
|
105 /** |
|
106 * Returns the current plug-in data in focus |
|
107 * |
|
108 * @since S60 v5.0 |
|
109 * @return A plug-in data, NULL if first |
|
110 */ |
|
111 CCCAppPluginData* PluginInFocus(); |
|
112 |
|
113 /** |
|
114 * Returns the number of all available plug-ins |
|
115 * |
|
116 * @since S60 v5.0 |
|
117 * @return Number loaded plug-ins. |
|
118 */ |
|
119 TInt PluginsCount() const; |
|
120 |
|
121 /** |
|
122 * Returns the number of visible plug-ins |
|
123 * |
|
124 * @since S60 v5.0 |
|
125 * @return Number visible plug-ins. |
|
126 */ |
|
127 TInt VisiblePluginCount() const; |
|
128 |
|
129 /** |
|
130 * Returns the plug-in data at certain index. |
|
131 * |
|
132 * @since S60 v5.0 |
|
133 * @param aIndex is the plugin wanted |
|
134 * @param aChangefocus if the focus is needed to change also |
|
135 * @return A plug-in data if it exists, NULL otherwise. |
|
136 */ |
|
137 CCCAppPluginData* PluginAt( TInt aIndex, TBool aChangefocus = EFalse ); |
|
138 |
|
139 /** |
|
140 * Returns the plug-in data at certain index within visible plugins. |
|
141 * |
|
142 * @since S60 v5.0 |
|
143 * @param aIndex Index of the plugin within visible plugins. |
|
144 * @param aChangefocus if the focus is needed to change also |
|
145 * @return A plug-in data if it exists, NULL otherwise. |
|
146 */ |
|
147 CCCAppPluginData* VisiblePlugin( TInt aIndex, TBool aChangefocus = EFalse ); |
|
148 |
|
149 /** |
|
150 * Removes plugin from plugin loader. |
|
151 * Needed for error cases. |
|
152 * |
|
153 * @since S60 v5.0 |
|
154 * @param index of plugin in loader. |
|
155 */ |
|
156 void RemovePlugin( TUid aPlugin ); |
|
157 |
|
158 /** |
|
159 * Returns plugin. |
|
160 * |
|
161 * @since S60 v5.0 |
|
162 * @param aPlugin Uid of plugin |
|
163 * @return A plug-in data if it exists, NULL otherwise. |
|
164 */ |
|
165 CCCAppViewPluginBase* Plugin( TUid aPlugin ); |
|
166 |
|
167 /** |
|
168 * Getter for plugin visiblity. |
|
169 * |
|
170 * @since S60 v5.0 |
|
171 * @return plugin visibility, see enum CCCAppPluginData::TPluginVisibility. |
|
172 */ |
|
173 TInt PluginVisibility(TUid aPlugin, TInt& aTabNbr); |
|
174 |
|
175 /** |
|
176 * Setter for plugin visiblity. |
|
177 * |
|
178 * @since S60 v5.0 |
|
179 * @param aPluginVisibility, see enum CCCAppPluginData::TPluginVisibility. |
|
180 */ |
|
181 TBool SetPluginVisibility( |
|
182 TUid aPlugin, |
|
183 TInt aVisibility); |
|
184 |
|
185 |
|
186 private: |
|
187 |
|
188 /** |
|
189 * Observer for store configuration changes. From MPbk2StoreConfigurationObserver |
|
190 * |
|
191 * @since S60 v9.2 |
|
192 */ |
|
193 void ConfigurationChanged(); |
|
194 |
|
195 /** |
|
196 * Observer for completed store configuration changes. From MPbk2StoreConfigurationObserver |
|
197 * |
|
198 * @since S60 v9.2 |
|
199 */ |
|
200 void ConfigurationChangedComplete(); |
|
201 |
|
202 private: |
|
203 |
|
204 /** |
|
205 * Loads multiple views using factory functionality from a factory. Through this interface one |
|
206 * plugin dll can instantiate multiple views. |
|
207 * |
|
208 * @since S60 v5.0 |
|
209 */ |
|
210 void LoadOneMultiViewPluginL(CImplementationInformation* aImplementationInformation); |
|
211 |
|
212 /** |
|
213 * Goes through the iPluginInfoArray, loads all the plugins and |
|
214 * appends them to array. |
|
215 * |
|
216 * @since S60 v5.0 |
|
217 */ |
|
218 void LoadAllPlugins( const RArray<TCCAPluginsOrderInfo>& aPluginOrderInfoArray, const TDesC8& aPluginProperties ); |
|
219 |
|
220 /** |
|
221 * Loads plugin and appends it to array. |
|
222 * |
|
223 * @since S60 v5.0 |
|
224 * @param aImplementationUid Implementation UID of the plug-in to be loaded. |
|
225 */ |
|
226 void LoadPluginL( TUid aImplementationUid ); |
|
227 |
|
228 /** |
|
229 * Extract sXP plug-in names from name string and put them to name array. |
|
230 * |
|
231 * @param aPbksXPExtesionNamesArray, names are stored. |
|
232 * @param aNameString, name string contains all sXP plug-in names, each plugin |
|
233 * name is seperated be pipeline "|", e.g Google|MSN|Ovi| |
|
234 */ |
|
235 void GetPbksXPExtesionNamesL( RArray<TPtrC>& aPbksXPExtesionNamesArray, |
|
236 const TDesC& aNameString); |
|
237 |
|
238 /** |
|
239 * copy pluginInfo address from pluginInforArrays to RArray<TCCAPluginsOrderInfo> array. |
|
240 * plus opaques values. make RArray<TCCAPluginsOrderInfo> array 3 group: ECCAInHousePlugins, |
|
241 * ECCAPlugindInBothCCAAndNameList and ECCAPluginsOnlyInCCA, store group info. |
|
242 * |
|
243 * @param aOrderInfoArray, store address copy pluginInfo object from iPluginInforArray, |
|
244 * plus order and groupInfo. |
|
245 * @param aNameListPluginNameArray, phonebook mainview sXPExtension plugins name list |
|
246 * @param aOldPluginInfoArray |
|
247 * @param aNewPluginInfoArray |
|
248 */ |
|
249 void GetPluginsInfoL( RArray<TCCAPluginsOrderInfo>& aOrderInfoArray, |
|
250 const RArray<TPtrC>& aNameListPluginNameArray, |
|
251 RPointerArray<CImplementationInformation>& aOldPluginInfoArray, |
|
252 RPointerArray<CImplementationInformation>& aNewPluginInfoArray); |
|
253 |
|
254 /** |
|
255 * copy pluginInfo address from pluginInforArray to RArray<TCCAPluginsOrderInfo> array. |
|
256 * plus opaques values. make RArray<TCCAPluginsOrderInfo> array 3 group: ECCAInHousePlugins, |
|
257 * ECCAPlugindInBothCCAAndNameList and ECCAPluginsOnlyInCCA, store group info. |
|
258 * |
|
259 * @param aOrderInfoArray, store address copy pluginInfo object from iPluginInforArray, |
|
260 * plus order and groupInfo. |
|
261 * @param aNameListPluginNameArray, phonebook mainview sXPExtension plugins name list |
|
262 * @param aPluginInfoArray |
|
263 * @param aIsOldInterFaceType ETrue if old interface type plugins are processed |
|
264 */ |
|
265 void AppendOrderInfoL( RArray<TCCAPluginsOrderInfo>& aOrderInfoArray, |
|
266 const RArray<TPtrC>& aNameListPluginNameArray, |
|
267 RPointerArray<CImplementationInformation>& aPluginInfoArray, |
|
268 TBool aIsOldInterFaceType); |
|
269 |
|
270 /** |
|
271 * Find smallest opaque value from plugins only in cca. |
|
272 * |
|
273 * @param aOrderInfoArray array contains TCCAPluginsOrderInfo |
|
274 * @return smallest opaque value |
|
275 */ |
|
276 TInt SmallestOpaqueFromPluginsOnlyInCCA( RArray<TCCAPluginsOrderInfo>& aOrderInfoArray ); |
|
277 |
|
278 /** |
|
279 * Find largest opaque value from in-house plugins. |
|
280 * |
|
281 * @param aOrderInfoArray array contains TCCAPluginsOrderInfo |
|
282 * @return largest opaque value |
|
283 */ |
|
284 TInt LargestOpaqueFromInHousePlugins( RArray<TCCAPluginsOrderInfo>& aOrderInfoArray ); |
|
285 |
|
286 /** |
|
287 * Update orders for plugins only in CCA view |
|
288 * |
|
289 * @param aStartPosition used for order updating |
|
290 * @param aOrderInfoArray array of TCCAPluginsOrderInfo |
|
291 */ |
|
292 void UpdateOrdersForPluginsOnlyInCCA(const TInt aStartPosition, |
|
293 RArray<TCCAPluginsOrderInfo>& aOrderInfoArray); |
|
294 |
|
295 /** |
|
296 * Update orders for plugins in both CCA and name list |
|
297 * |
|
298 * @param aLastPosition used for order updating, itself is also updated |
|
299 * @param aOrderInfoArray array of TCCAPluginsOrderInfo |
|
300 * @param aNameListPluginNameArray array contains plugins names in Name list view |
|
301 */ |
|
302 void UpdateOrdersForPluginsInBothCCAAndNameList( TInt& aLastPosition, |
|
303 RArray<TCCAPluginsOrderInfo>& aOrderInfoArray, |
|
304 const RArray<TPtrC>& aNameListPluginNameArray); |
|
305 /** |
|
306 * changed iOrder informatin of each element in orderinfoarray. |
|
307 * then Sort sXP plug-ins orderinforarray by iOrder. |
|
308 * |
|
309 * @param aOrderInfoArray order information will be updated, the array will be sorted |
|
310 * then by order. |
|
311 * |
|
312 * @param aNameListPluginNameArray contains sXP plug-in names for Name List. |
|
313 * Used for find element in aOrderInfoArray. |
|
314 */ |
|
315 void SortPluginsOrderInfoL( RArray<TCCAPluginsOrderInfo>& aOrderInfoArray, |
|
316 const RArray<TPtrC>& aNameListPluginNameArray); |
|
317 |
|
318 /** |
|
319 * Find phonebook main view sXPExtension Plugin name from name array |
|
320 * |
|
321 * @param aCCAPluginInfo, a CImplementationInformation type object. |
|
322 * @param aNameListPluginNameArray, phonebook main view sXPExtension Plugins name array |
|
323 * |
|
324 * @return found name's position in aNameListPluginNameArray, KErrNotFound if not found. |
|
325 */ |
|
326 TInt FindPluginNameFromNameListByCCAPluginInfo(const CImplementationInformation& aCCAPluginInfo, |
|
327 const RArray<TPtrC>& aNameListPluginNameArray); |
|
328 |
|
329 /** |
|
330 * Get Opaque integer value from a refrerence of CImplementationInformation |
|
331 * |
|
332 * @param aInfo, object of CImplementationInformation |
|
333 * @return opaque integer value. |
|
334 */ |
|
335 TInt OpaqueValueFrom( const CImplementationInformation& aInfo ); |
|
336 |
|
337 /** |
|
338 * Loads a plugin. |
|
339 * |
|
340 * @param aPluginsOrderInfo ordering info |
|
341 * @param aPluginProperties properties to fulfill |
|
342 * @return opaque integer value. |
|
343 */ |
|
344 void CheckAndLoadPluginL( |
|
345 const TCCAPluginsOrderInfo& aPluginsOrderInfo, |
|
346 const TDesC8& aPluginProperties ); |
|
347 |
|
348 /** |
|
349 * Returns plugin order. |
|
350 * |
|
351 * @param aImplementationInformation ecom implementation information |
|
352 * @return order |
|
353 */ |
|
354 TInt GetOrderValueL( const CImplementationInformation& aInfo ); |
|
355 |
|
356 /** |
|
357 * Compares properties of two propertystrings. |
|
358 * |
|
359 * @param aData properties to compare |
|
360 * @param aRefData properties to compare |
|
361 * @param aMatchValuesToo ETrue if also property values need to becompared |
|
362 * @return matching properties. |
|
363 */ |
|
364 HBufC8* GetmachingPropertiesLC( |
|
365 const TDesC8& aData, const TDesC8& aRefData, TBool aMatchValuesToo); |
|
366 |
|
367 /** |
|
368 * Extracts name value pair data from property string. Extracted data |
|
369 * is removed from property string |
|
370 * |
|
371 * @param aName name extracted |
|
372 * @param aValue value extracted |
|
373 * @param aDataPtr property string |
|
374 */ |
|
375 void GetNameValue( TPtrC8& aName, TPtrC8& aValue, TPtrC8& aDataPtr ); |
|
376 |
|
377 /** |
|
378 * Determine whether a Contact Store URI is SIM Card storage. |
|
379 * |
|
380 * @param aUri, the Contact Store URI to compare. |
|
381 */ |
|
382 TBool IsSimStoreUri( const TVPbkContactStoreUriPtr& aUri ) const; |
|
383 |
|
384 /** |
|
385 * Determine whether an implementation plug-in is supported by Current Contact Store. |
|
386 * |
|
387 * @param aImplmentationUid, the plug-in's ImplmentationUid. |
|
388 */ |
|
389 TBool IsCurrentContactStoreSupportL( const TInt& aImplmentationUid ) const; |
|
390 |
|
391 /** |
|
392 * Prepare application services |
|
393 * |
|
394 */ |
|
395 void PreparePbk2ApplicationServicesL(); |
|
396 |
|
397 |
|
398 private://data |
|
399 |
|
400 |
|
401 /** |
|
402 * Pointer array of loaded plugin data structures. |
|
403 * Own. |
|
404 */ |
|
405 RPointerArray<CCCAppPluginData> iPluginDataArray; |
|
406 /** |
|
407 * Current plugin in use |
|
408 */ |
|
409 TInt iCurrentPlugin; |
|
410 |
|
411 /** |
|
412 * Reference to the cca application engine |
|
413 * not owned |
|
414 */ |
|
415 MCCAppEngine* iAppEngine; |
|
416 |
|
417 /** |
|
418 * Temporary holder for CcaPluginFactoryOwner, |
|
419 * owned unless ownership handed over. |
|
420 */ |
|
421 CcaPluginFactoryOwner* iFactoryTempPtr; |
|
422 |
|
423 /// Own: Phonebook2 application services |
|
424 CPbk2ApplicationServices* iAppServices; |
|
425 |
|
426 /// Own: Phonebook2 commands dll resource file |
|
427 RPbk2LocalizedResourceFile iCommandsResourceFile; |
|
428 |
|
429 /// Own: Phonebook2 UI controls dll resource file |
|
430 RPbk2LocalizedResourceFile iUiControlsResourceFile; |
|
431 |
|
432 /// Own: Phonebook2 common UI dll resource file |
|
433 RPbk2LocalizedResourceFile iCommonUiResourceFile; |
|
434 }; |
|
435 |
|
436 #endif // __CCAPPUNITTESTMODE |
|
437 //End of file |