author | Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com> |
Wed, 15 Sep 2010 12:32:36 +0300 | |
branch | RCL_3 |
changeset 122 | 6cadd6867c17 |
parent 114 | a5a39a295112 |
child 130 | 67f2ed48ad91 |
permissions | -rw-r--r-- |
114 | 1 |
/* |
2 |
* Copyright (c) 2009 - 2010 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 <favouritesdb.h> // For RFavouritesDb |
|
25 |
#include <mcsmenu.h> // For MenuContentService |
|
26 |
#include <propertymap.h> |
|
27 |
||
28 |
struct TSettingItem; |
|
29 |
/** |
|
30 |
* @ingroup group_mcsplugin |
|
31 |
* |
|
32 |
* Bookmark list for settings listbox |
|
33 |
* |
|
34 |
* @since S60 v3.2 |
|
35 |
*/ |
|
36 |
class CMCSPluginSettingsBkmList : public CBase, public MDesCArray |
|
37 |
{ |
|
38 |
||
39 |
/** |
|
40 |
* TBookmarkType |
|
41 |
*/ |
|
42 |
enum TBookmarkType |
|
43 |
{ |
|
44 |
EFavBookmark, |
|
45 |
EMCSBookmark |
|
46 |
}; |
|
47 |
||
48 |
public: |
|
49 |
||
50 |
/** |
|
51 |
* Part of the two phased constuction |
|
52 |
*/ |
|
53 |
static CMCSPluginSettingsBkmList* NewL(); |
|
54 |
||
55 |
/** |
|
56 |
* Destructor |
|
57 |
*/ |
|
58 |
virtual ~CMCSPluginSettingsBkmList(); |
|
59 |
||
60 |
// from base class MDesCArray |
|
61 |
||
62 |
/** |
|
63 |
* From MDesCArray |
|
64 |
* Returns the number of descriptor elements in a descriptor array. |
|
65 |
* |
|
66 |
* @since S60 v3.2 |
|
67 |
* @return The number of descriptor elements in a descriptor array. |
|
68 |
*/ |
|
69 |
TInt MdcaCount() const; |
|
70 |
||
71 |
/** |
|
72 |
* From MDesCArray |
|
73 |
* Indexes into a descriptor array. |
|
74 |
* |
|
75 |
* @since S60 v3.2 |
|
76 |
* @param aIndex The position of the descriptor element within a descriptor |
|
77 |
* array. |
|
78 |
* @return A 16 bit non-modifiable pointer descriptor representing the |
|
79 |
* descriptor element located at position aIndex within a descriptor |
|
80 |
* array. |
|
81 |
*/ |
|
82 |
TPtrC MdcaPoint(TInt aIndex) const; |
|
83 |
||
84 |
/** |
|
85 |
* Gets the bookmark list. |
|
86 |
* |
|
87 |
* @since S60 v3.2 |
|
88 |
*/ |
|
89 |
void GetBookmarkListL(); |
|
90 |
||
91 |
/** |
|
92 |
* |
|
93 |
* |
|
94 |
* @since S60 |
|
95 |
* @param aIndex Setting item to find |
|
96 |
* @return MCS menu item |
|
97 |
*/ |
|
98 |
CMenuItem* ItemL( TInt aIndex ); |
|
99 |
||
100 |
/** |
|
101 |
* Returns target bookmark data from the given index |
|
102 |
* |
|
103 |
* @since S60 v3.2 |
|
104 |
* @param aIndex Index of the bookmark in the list |
|
105 |
* @param aParams On return, the bookmark parameters |
|
106 |
* @param aCaption On return, the bookmark caption |
|
107 |
* @return KErrNotFound if the bookmark cannot be found, KErrNone otherwise |
|
108 |
*/ |
|
109 |
TSettingItem FindItemL( |
|
110 |
RPointerArray<HSPluginSettingsIf::CPropertyMap>& aProperties ); |
|
111 |
||
122
6cadd6867c17
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
114
diff
changeset
|
112 |
/** |
6cadd6867c17
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
114
diff
changeset
|
113 |
* Checks with a given index if bookmark has been hidden from menulist |
6cadd6867c17
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
114
diff
changeset
|
114 |
* |
6cadd6867c17
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
114
diff
changeset
|
115 |
* @param aIndex Index of the bookmark in the list |
6cadd6867c17
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
114
diff
changeset
|
116 |
* @return ETrue if the bookmark is hidden, EFalse otherwise |
6cadd6867c17
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
114
diff
changeset
|
117 |
*/ |
6cadd6867c17
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
114
diff
changeset
|
118 |
TBool ItemHidden( TInt aIndex ); |
114 | 119 |
|
120 |
protected: |
|
121 |
||
122 |
private: |
|
123 |
||
124 |
/** |
|
125 |
* Constructor |
|
126 |
*/ |
|
127 |
CMCSPluginSettingsBkmList(); |
|
128 |
||
129 |
/** |
|
130 |
* Second-phase constructor. |
|
131 |
*/ |
|
132 |
void ConstructL(); |
|
133 |
||
134 |
/** |
|
135 |
* Adds an bookmark to the list |
|
136 |
* |
|
137 |
* @since S60 v3.2 |
|
138 |
* @param aBkmInfo Bookmark information object |
|
139 |
*/ |
|
140 |
void AddBookmarkL( const TDesC& aUid, const TDesC& aCaption, |
|
141 |
const TDesC& aUrl, TBookmarkType aType ); |
|
142 |
||
143 |
/** |
|
144 |
* Get bookmarks from favourites |
|
145 |
*/ |
|
146 |
void GetBookmarksFromFavouritesL(); |
|
147 |
||
148 |
/** |
|
149 |
* Get bookmarks from MCS |
|
150 |
*/ |
|
151 |
void GetBookmarksFromMCSL(); |
|
152 |
||
153 |
/** |
|
154 |
* Create menu item |
|
155 |
* |
|
156 |
* @param aUid |
|
157 |
* @param aName |
|
158 |
* @param aUrl |
|
159 |
* @return pointer to the created CMenuItem object |
|
160 |
*/ |
|
161 |
CMenuItem* CreateMenuItemL( const TDesC& aUid,const TDesC& aName, |
|
162 |
const TDesC& aUrl ); |
|
163 |
||
164 |
/** |
|
165 |
* MCSMenuItemL |
|
166 |
* |
|
167 |
* @param aUid |
|
168 |
* @param aName |
|
169 |
* @param aUrl |
|
170 |
* @return pointer to the CMenuItem object |
|
171 |
*/ |
|
172 |
CMenuItem* MCSMenuItemL( const TDesC& aUid,const TDesC& aName, |
|
173 |
const TDesC& aUrl ); |
|
174 |
||
175 |
private: |
|
176 |
||
177 |
/** |
|
178 |
* Nested class to store individual bookmark list items |
|
179 |
* |
|
180 |
* @since S60 v3.2 |
|
181 |
*/ |
|
182 |
class CBkmListItem : public CBase |
|
183 |
{ |
|
184 |
public: |
|
185 |
||
186 |
/** |
|
187 |
* Part of the two phased constuction |
|
188 |
* |
|
189 |
* @param aUid |
|
190 |
* @param aCaption |
|
191 |
*/ |
|
192 |
static CBkmListItem* NewLC( const TDesC& aUid, const TDesC& aCaption); |
|
193 |
||
194 |
/** |
|
195 |
* Destructor |
|
196 |
*/ |
|
197 |
~CBkmListItem(); |
|
198 |
||
199 |
/** |
|
200 |
* Compare method used to add the items to the list in sorted order |
|
201 |
* |
|
202 |
* @since S60 v3.2 |
|
203 |
* @param aFirst The first item to be compared |
|
204 |
* @param aSecond The second item to be compared |
|
205 |
* @return Negative if first comes before second, zero if equal and |
|
206 |
* positive if first comes after second |
|
207 |
*/ |
|
208 |
static TInt CompareCaption(const CBkmListItem& aFirst, |
|
209 |
const CBkmListItem& aSecond); |
|
210 |
||
211 |
/** |
|
212 |
* Returns the item target bookmark uid |
|
213 |
* |
|
214 |
* @since S60 v3.2 |
|
215 |
* @return Target bookmark uid |
|
216 |
*/ |
|
217 |
//TUid Uid() const; |
|
218 |
||
219 |
/** |
|
220 |
* Returns the item target bookmark caption |
|
221 |
* |
|
222 |
* @since S60 v3.2 |
|
223 |
* @return Target bookmark caption |
|
224 |
*/ |
|
225 |
TPtrC Caption() const; |
|
226 |
||
227 |
/** |
|
228 |
* iType |
|
229 |
*/ |
|
230 |
TBookmarkType iType; |
|
231 |
||
232 |
/** |
|
233 |
* Target bookmark uid |
|
234 |
*/ |
|
235 |
HBufC* iUid; |
|
236 |
||
237 |
/** |
|
238 |
* Target bookmark caption |
|
239 |
*/ |
|
240 |
HBufC* iCaption; |
|
241 |
||
242 |
/** |
|
243 |
* Target bookmark parameters |
|
244 |
*/ |
|
245 |
HBufC* iUrl; |
|
122
6cadd6867c17
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
114
diff
changeset
|
246 |
|
6cadd6867c17
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
114
diff
changeset
|
247 |
/** |
6cadd6867c17
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
114
diff
changeset
|
248 |
* Target bookmark hidden |
6cadd6867c17
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
114
diff
changeset
|
249 |
*/ |
6cadd6867c17
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
114
diff
changeset
|
250 |
TBool iHidden; |
114 | 251 |
|
252 |
private: |
|
253 |
||
254 |
/** |
|
255 |
* Constructor |
|
256 |
*/ |
|
257 |
CBkmListItem(); |
|
258 |
||
259 |
/** |
|
260 |
* Second-phase constructor. |
|
261 |
* |
|
262 |
* @param aUid |
|
263 |
* @param aCaption |
|
264 |
*/ |
|
265 |
void ConstructL( const TDesC& aUid, const TDesC& aCaption); |
|
266 |
||
267 |
}; |
|
268 |
||
269 |
private: // data |
|
270 |
||
271 |
/** |
|
272 |
* List of bookmark items |
|
273 |
* Own. |
|
274 |
*/ |
|
275 |
RPointerArray<CBkmListItem> iListItems; |
|
276 |
||
277 |
/** |
|
278 |
* Runtime created CMenuItems must be stored, |
|
279 |
* because those are refered later, own. |
|
280 |
*/ |
|
281 |
RPointerArray<CMenuItem> iMenuItems; |
|
282 |
||
283 |
/** |
|
284 |
* Bookmark database session. |
|
285 |
* Own. |
|
286 |
*/ |
|
287 |
RFavouritesSession iBookmarkSess; |
|
288 |
||
289 |
/** |
|
290 |
* Bookmark database. |
|
291 |
* Own. |
|
292 |
*/ |
|
293 |
RFavouritesDb iBookmarkDb; |
|
294 |
||
295 |
/** |
|
296 |
* iMenu |
|
297 |
* Own. |
|
298 |
*/ |
|
299 |
RMenu iMenu; |
|
300 |
}; |
|
301 |
||
302 |
#endif // CMCSPLUGINSETTINGSBKMLIST_H |
|
303 |
||
304 |
// End of File. |