|
1 /* |
|
2 * Copyright (c) 2009 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: Bookmark list for settings listbox. |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #ifndef CMCSPLUGINSETTINGSBKMLIST_H |
|
20 #define CMCSPLUGINSETTINGSBKMLIST_H |
|
21 |
|
22 #include <e32base.h> |
|
23 #include <bamdesca.h> // For MDesCArray |
|
24 #include <FavouritesDbObserver.h> // For MFavouritesDbObserver |
|
25 #include <FavouritesDb.h> // For RFavouritesDb |
|
26 #include <FavouritesItemList.h> // For CFavouritesItemList |
|
27 #include <mcsmenu.h> // For MenuContentService |
|
28 |
|
29 class CActiveFavouritesDbNotifier; |
|
30 class CAiScutSettingsItem; |
|
31 class CMCSPluginSettingsModel; |
|
32 class CMCSPluginWatcher; |
|
33 struct TSettingItem; |
|
34 /** |
|
35 * @ingroup group_mcsplugin |
|
36 * |
|
37 * Bookmark list for settings listbox |
|
38 * |
|
39 * @since S60 v3.2 |
|
40 */ |
|
41 class CMCSPluginSettingsBkmList : public CBase, public MDesCArray |
|
42 { |
|
43 |
|
44 /** |
|
45 * TBookmarkType |
|
46 */ |
|
47 enum TBookmarkType |
|
48 { |
|
49 EFavBookmark, |
|
50 EMCSBookmark |
|
51 }; |
|
52 |
|
53 public: |
|
54 |
|
55 /** |
|
56 * Part of the two phased constuction |
|
57 */ |
|
58 static CMCSPluginSettingsBkmList* NewL(); |
|
59 |
|
60 /** |
|
61 * Destructor |
|
62 */ |
|
63 virtual ~CMCSPluginSettingsBkmList(); |
|
64 |
|
65 // from base class MDesCArray |
|
66 |
|
67 /** |
|
68 * From MDesCArray |
|
69 * Returns the number of descriptor elements in a descriptor array. |
|
70 * |
|
71 * @since S60 v3.2 |
|
72 * @return The number of descriptor elements in a descriptor array. |
|
73 */ |
|
74 TInt MdcaCount() const; |
|
75 |
|
76 /** |
|
77 * From MDesCArray |
|
78 * Indexes into a descriptor array. |
|
79 * |
|
80 * @since S60 v3.2 |
|
81 * @param aIndex The position of the descriptor element within a descriptor |
|
82 * array. |
|
83 * @return A 16 bit non-modifiable pointer descriptor representing the |
|
84 * descriptor element located at position aIndex within a descriptor |
|
85 * array. |
|
86 */ |
|
87 TPtrC MdcaPoint(TInt aIndex) const; |
|
88 |
|
89 /** |
|
90 * Gets the bookmark list. |
|
91 * |
|
92 * @since S60 v3.2 |
|
93 */ |
|
94 void GetBookmarkListL(); |
|
95 |
|
96 /** |
|
97 * |
|
98 * |
|
99 * @since S60 |
|
100 * @param aIndex Setting item to find |
|
101 * @return MCS menu item |
|
102 */ |
|
103 CMenuItem& ItemL( TInt aIndex ); |
|
104 |
|
105 /** |
|
106 * Returns target bookmark data from the given index |
|
107 * |
|
108 * @since S60 v3.2 |
|
109 * @param aIndex Index of the bookmark in the list |
|
110 * @param aParams On return, the bookmark parameters |
|
111 * @param aCaption On return, the bookmark caption |
|
112 * @return KErrNotFound if the bookmark cannot be found, KErrNone otherwise |
|
113 */ |
|
114 //TInt GetDataByIndex(TInt aIndex, TPtrC& aParams, TPtrC& aCaption) const; |
|
115 |
|
116 TSettingItem FindItemL( |
|
117 RPointerArray<HSPluginSettingsIf::CPropertyMap>& aProperties ); |
|
118 |
|
119 /** |
|
120 * Remove menu item |
|
121 * |
|
122 * @param aIndex |
|
123 */ |
|
124 void RemoveMenuItemL( TInt aIndex ); |
|
125 |
|
126 protected: |
|
127 |
|
128 private: |
|
129 |
|
130 /** |
|
131 * Constructor |
|
132 */ |
|
133 CMCSPluginSettingsBkmList(); |
|
134 |
|
135 /** |
|
136 * Second-phase constructor. |
|
137 */ |
|
138 void ConstructL(); |
|
139 |
|
140 /** |
|
141 * Adds an bookmark to the list |
|
142 * |
|
143 * @since S60 v3.2 |
|
144 * @param aBkmInfo Bookmark information object |
|
145 */ |
|
146 void AddBookmarkL( const TDesC& aUid, const TDesC& aCaption, |
|
147 const TDesC& aUrl, TBookmarkType aType ); |
|
148 |
|
149 /** |
|
150 * Updates the bookmark list |
|
151 * |
|
152 * @since S60 v3.2 |
|
153 */ |
|
154 void UpdateBkmListL(); |
|
155 |
|
156 /** |
|
157 * Get bookmarks from favourites |
|
158 */ |
|
159 void GetBookmarksFromFavouritesL(); |
|
160 |
|
161 /** |
|
162 * Get bookmarks from MCS |
|
163 */ |
|
164 void GetBookmarksFromMCSL(); |
|
165 |
|
166 /** |
|
167 * Create menu item |
|
168 * |
|
169 * @param aUid |
|
170 * @param aName |
|
171 * @param aUrl |
|
172 * @return pointer to the created CMenuItem object |
|
173 */ |
|
174 CMenuItem* CreateMenuItemL( const TDesC& aUid,const TDesC& aName, |
|
175 const TDesC& aUrl ); |
|
176 |
|
177 /** |
|
178 * MCSMenuItemL |
|
179 * |
|
180 * @param aUid |
|
181 * @param aName |
|
182 * @param aUrl |
|
183 * @return pointer to the CMenuItem object |
|
184 */ |
|
185 CMenuItem* MCSMenuItemL( const TDesC& aUid,const TDesC& aName, |
|
186 const TDesC& aUrl ); |
|
187 |
|
188 /** |
|
189 * GetMCSPluginFolderIdL |
|
190 * |
|
191 * @return TInt |
|
192 */ |
|
193 TInt GetMCSPluginFolderIdL(); |
|
194 |
|
195 /** |
|
196 * UpdateMenuItemsRefCountL |
|
197 * |
|
198 * @param aItem |
|
199 * @param aValueToAdd |
|
200 * @return TInt |
|
201 */ |
|
202 TInt UpdateMenuItemsRefCountL( CMenuItem* aItem, TInt aValueToAdd ); |
|
203 |
|
204 |
|
205 private: |
|
206 |
|
207 /** |
|
208 * Nested class to store individual bookmark list items |
|
209 * |
|
210 * @since S60 v3.2 |
|
211 */ |
|
212 class CBkmListItem : public CBase |
|
213 { |
|
214 public: |
|
215 |
|
216 /** |
|
217 * Part of the two phased constuction |
|
218 * |
|
219 * @param aUid |
|
220 * @param aCaption |
|
221 */ |
|
222 static CBkmListItem* NewLC( const TDesC& aUid, const TDesC& aCaption); |
|
223 |
|
224 /** |
|
225 * Destructor |
|
226 */ |
|
227 ~CBkmListItem(); |
|
228 |
|
229 /** |
|
230 * Compare method used to add the items to the list in sorted order |
|
231 * |
|
232 * @since S60 v3.2 |
|
233 * @param aFirst The first item to be compared |
|
234 * @param aSecond The second item to be compared |
|
235 * @return Negative if first comes before second, zero if equal and |
|
236 * positive if first comes after second |
|
237 */ |
|
238 static TInt CompareCaption(const CBkmListItem& aFirst, |
|
239 const CBkmListItem& aSecond); |
|
240 |
|
241 /** |
|
242 * Returns the item target bookmark uid |
|
243 * |
|
244 * @since S60 v3.2 |
|
245 * @return Target bookmark uid |
|
246 */ |
|
247 //TUid Uid() const; |
|
248 |
|
249 /** |
|
250 * Returns the item target bookmark caption |
|
251 * |
|
252 * @since S60 v3.2 |
|
253 * @return Target bookmark caption |
|
254 */ |
|
255 TPtrC Caption() const; |
|
256 |
|
257 /** |
|
258 * iType |
|
259 */ |
|
260 TBookmarkType iType; |
|
261 |
|
262 /** |
|
263 * Target bookmark uid |
|
264 */ |
|
265 HBufC* iUid; |
|
266 |
|
267 /** |
|
268 * Target bookmark caption |
|
269 */ |
|
270 HBufC* iCaption; |
|
271 |
|
272 /** |
|
273 * Target bookmark parameters |
|
274 */ |
|
275 HBufC* iUrl; |
|
276 |
|
277 private: |
|
278 |
|
279 /** |
|
280 * Constructor |
|
281 */ |
|
282 CBkmListItem(); |
|
283 |
|
284 /** |
|
285 * Second-phase constructor. |
|
286 * |
|
287 * @param aUid |
|
288 * @param aCaption |
|
289 */ |
|
290 void ConstructL( const TDesC& aUid, const TDesC& aCaption); |
|
291 |
|
292 private: // data |
|
293 |
|
294 |
|
295 }; |
|
296 |
|
297 private: // data |
|
298 |
|
299 /** |
|
300 * List of bookmark items |
|
301 * Own. |
|
302 */ |
|
303 RPointerArray<CBkmListItem> iListItems; |
|
304 |
|
305 // Runtime created CMenuItems must be stored, because those are refered |
|
306 RPointerArray<CMenuItem> iMenuItems; |
|
307 |
|
308 /** |
|
309 * A flag indicating if the bookmark list should observe changes |
|
310 */ |
|
311 TBool iObserving; |
|
312 |
|
313 /** |
|
314 * Bookmark database session. |
|
315 * Own. |
|
316 */ |
|
317 RFavouritesSession iBookmarkSess; |
|
318 |
|
319 /** |
|
320 * Bookmark database. |
|
321 * Own. |
|
322 */ |
|
323 RFavouritesDb iBookmarkDb; |
|
324 |
|
325 /** |
|
326 * iMenu |
|
327 */ |
|
328 RMenu iMenu; |
|
329 |
|
330 /** |
|
331 * Save watcher |
|
332 */ |
|
333 |
|
334 CMCSPluginWatcher* iSaveWatcher; |
|
335 |
|
336 /** |
|
337 * Update watcher |
|
338 */ |
|
339 CMCSPluginWatcher* iUpdateWatcher; |
|
340 |
|
341 /** |
|
342 * Remove watcher |
|
343 */ |
|
344 CMCSPluginWatcher* iRemoveWatcher; |
|
345 |
|
346 /** |
|
347 * MCS plugin folder ID |
|
348 */ |
|
349 TInt iMCSPluginFolderId; |
|
350 |
|
351 }; |
|
352 |
|
353 #endif // CMCSPLUGINSETTINGSBKMLIST_H |
|
354 |
|
355 // End of File. |