author | Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com> |
Tue, 14 Sep 2010 21:55:16 +0300 | |
branch | RCL_3 |
changeset 118 | 8baec10861af |
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: MCS settings plug-in model. |
|
15 |
* |
|
16 |
*/ |
|
17 |
||
18 |
||
19 |
#ifndef CMCSPLUGINSETTINGSMODEL_H |
|
20 |
#define CMCSPLUGINSETTINGSMODEL_H |
|
21 |
||
22 |
// External includes |
|
23 |
#include <e32base.h> |
|
24 |
#include <bamdesca.h> // For MDesCArray |
|
25 |
#include <hspluginsettings.h> |
|
26 |
#include <propertymap.h> |
|
27 |
||
28 |
// Forward declaration |
|
29 |
class CCoeEnv; |
|
30 |
class CMenuItem; |
|
31 |
class CMCSPluginSettingsAppList; |
|
32 |
class CMCSPluginSettingsBkmList; |
|
33 |
class CMCSPluginSettings; |
|
34 |
class CMCSPluginSettingsContainer; |
|
35 |
class HSPluginSettingsIf::CItemMap; |
|
36 |
||
37 |
/** |
|
38 |
* TSettingType |
|
39 |
*/ |
|
40 |
enum TSettingType |
|
41 |
{ |
|
42 |
EApplication, |
|
43 |
EBookmark, |
|
44 |
EMailbox |
|
45 |
}; |
|
46 |
||
47 |
/** |
|
48 |
* TSettingItem |
|
49 |
*/ |
|
50 |
struct TSettingItem |
|
51 |
{ |
|
52 |
TInt id; |
|
53 |
TSettingType type; |
|
54 |
TBool locked; |
|
118
8baec10861af
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
114
diff
changeset
|
55 |
TBool empty; |
114 | 56 |
}; |
57 |
||
58 |
/** |
|
59 |
* @ingroup group_mcsplugin |
|
60 |
* |
|
61 |
* MCS settings plug-in model |
|
62 |
* |
|
63 |
* @lib mcspluginsettings.lib |
|
64 |
* @since S60 9.1 |
|
65 |
*/ |
|
66 |
class CMCSPluginSettingsModel : public CBase |
|
67 |
, public MDesCArray |
|
68 |
{ |
|
69 |
||
70 |
public: |
|
71 |
||
72 |
/** |
|
73 |
* Two phase constructor |
|
74 |
* |
|
75 |
* @param aPlugin |
|
76 |
* @param aEnv |
|
77 |
*/ |
|
78 |
static CMCSPluginSettingsModel* NewL( CMCSPluginSettings& aPlugin, |
|
79 |
CCoeEnv* aEnv); |
|
80 |
||
81 |
/** |
|
82 |
* Descructor |
|
83 |
*/ |
|
84 |
virtual ~CMCSPluginSettingsModel(); |
|
85 |
||
86 |
public: // from MDesCArray |
|
87 |
||
88 |
/** |
|
89 |
* Returns the number of descriptor elements in a descriptor array. |
|
90 |
* |
|
91 |
* @since S60 v3.2 |
|
92 |
* @return The number of descriptor elements in a descriptor array. |
|
93 |
*/ |
|
94 |
TInt MdcaCount() const; |
|
95 |
||
96 |
/** |
|
97 |
* Indexes into a descriptor array. |
|
98 |
* |
|
99 |
* @since S60 v3.2 |
|
100 |
* @param aIndex The position of the descriptor element within |
|
101 |
* a descriptor array. |
|
102 |
* @return A 16 bit non-modifiable pointer descriptor representing the |
|
103 |
* descriptor element located at position aIndex within a descriptor |
|
104 |
* array. |
|
105 |
*/ |
|
106 |
TPtrC MdcaPoint(TInt aIndex) const; |
|
107 |
||
108 |
public: |
|
109 |
||
110 |
/** |
|
111 |
* Returns an ID of a setting item for the given index |
|
112 |
* |
|
113 |
* @since S60 v3.2 |
|
114 |
* @param aIndex Index of the setting item |
|
115 |
* @return ID of a setting item |
|
116 |
*/ |
|
117 |
TInt ItemId( TInt aIndex ) const; |
|
118 |
||
119 |
/** |
|
120 |
* Returns a pointer to setting item for the given index |
|
121 |
* |
|
122 |
* @since S60 v9.1 |
|
123 |
* @param aIndex Index of the setting item |
|
124 |
* @return setting item |
|
125 |
*/ |
|
126 |
const TSettingItem Item( TInt aIndex ) const; |
|
127 |
||
128 |
/** |
|
129 |
* |
|
130 |
*/ |
|
131 |
TBool ReplaceItemL( const TInt& aItemIndex, TInt aValue, |
|
132 |
TSettingType aType ); |
|
133 |
||
134 |
/** |
|
135 |
* Sets pointer to settings plug-in container. |
|
136 |
* |
|
137 |
* @since S60 v3.2 |
|
138 |
* @param aContainer Pointer to settings plug-in container. |
|
139 |
*/ |
|
140 |
void SetContainer(CMCSPluginSettingsContainer* aContainer); |
|
141 |
||
142 |
||
143 |
/** |
|
144 |
* Get application list |
|
145 |
*/ |
|
146 |
CMCSPluginSettingsAppList* AppList(); |
|
147 |
||
148 |
/** |
|
149 |
* Get bookmark list |
|
150 |
*/ |
|
151 |
CMCSPluginSettingsBkmList* BkmList(); |
|
152 |
||
153 |
/** |
|
154 |
* Update application list |
|
155 |
*/ |
|
156 |
void UpdateAppListL( TBool aUpdateSettings = ETrue ); |
|
157 |
||
158 |
/** |
|
159 |
* Update bookmark list |
|
160 |
*/ |
|
161 |
void UpdateBkmListL( TBool aUpdateSettings = ETrue ); |
|
162 |
||
163 |
/** |
|
164 |
* Update settings container |
|
165 |
* |
|
166 |
* @param aPluginId |
|
167 |
*/ |
|
168 |
void SetPluginIdL( const TDesC8& aPluginId ); |
|
169 |
||
170 |
/** |
|
171 |
* Read settings from HSPS and update settings list |
|
172 |
*/ |
|
173 |
void UpdateSettingsL(); |
|
174 |
||
175 |
private: |
|
176 |
||
177 |
/** |
|
178 |
* Private constructor |
|
179 |
* |
|
180 |
* @param aPlugin |
|
181 |
* @param aEnv |
|
182 |
*/ |
|
183 |
CMCSPluginSettingsModel(CMCSPluginSettings& aPlugin, CCoeEnv* aEnv); |
|
184 |
||
185 |
/** |
|
186 |
* Leaving constructor |
|
187 |
*/ |
|
188 |
void ConstructL(); |
|
189 |
||
190 |
/** |
|
191 |
* ListBoxLine for list |
|
192 |
* |
|
193 |
* @param aCaption |
|
194 |
* @param aIndex |
|
195 |
* @return TPtrC |
|
196 |
*/ |
|
197 |
TPtrC ListBoxLineL( const TDesC& aCaption, TInt aIndex ) const; |
|
198 |
||
199 |
/** |
|
200 |
* Returns setting item based on properties. |
|
201 |
* |
|
202 |
* @param aProperties |
|
203 |
* @return TSettingItem |
|
204 |
*/ |
|
205 |
TSettingItem ItemL( |
|
206 |
RPointerArray<HSPluginSettingsIf::CPropertyMap>& aProperties ); |
|
207 |
||
208 |
/** |
|
209 |
* Setting type |
|
210 |
* |
|
211 |
* @param aProperties |
|
212 |
* @return TSettingType |
|
213 |
*/ |
|
214 |
TSettingType SettingTypeL( |
|
215 |
RPointerArray<HSPluginSettingsIf::CPropertyMap>& aProperties ); |
|
216 |
||
217 |
/** |
|
218 |
* Setting locked |
|
219 |
* |
|
220 |
* @param aProperties |
|
221 |
* @return TBool |
|
222 |
*/ |
|
223 |
TBool SettingLockedL( |
|
224 |
RPointerArray<HSPluginSettingsIf::CPropertyMap>& aProperties ); |
|
225 |
||
118
8baec10861af
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
114
diff
changeset
|
226 |
/** |
8baec10861af
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
114
diff
changeset
|
227 |
* Empty setting |
8baec10861af
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
114
diff
changeset
|
228 |
* |
8baec10861af
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
114
diff
changeset
|
229 |
* @param aProperties |
8baec10861af
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
114
diff
changeset
|
230 |
* @return TBool |
8baec10861af
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
114
diff
changeset
|
231 |
*/ |
8baec10861af
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
114
diff
changeset
|
232 |
TBool SettingEmptyL( |
8baec10861af
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
114
diff
changeset
|
233 |
RPointerArray<HSPluginSettingsIf::CPropertyMap>& aProperties ); |
114 | 234 |
|
235 |
||
236 |
/** |
|
237 |
* Save settings into HSPS |
|
238 |
* |
|
239 |
* @param aIndex |
|
240 |
* @param aMenuItem |
|
241 |
*/ |
|
242 |
void SaveSettingsL( const TInt& aIndex, CMenuItem& aMenuItem ); |
|
243 |
||
244 |
private: // data |
|
245 |
||
246 |
/** |
|
247 |
* Array of setting items. |
|
248 |
* Own. |
|
249 |
*/ |
|
250 |
RArray<TSettingItem> iSettings; |
|
251 |
||
252 |
/** |
|
253 |
* Homescreen settings API. Not owned. |
|
254 |
*/ |
|
255 |
HSPluginSettingsIf::CHomescreenSettings* iPluginSettings; |
|
256 |
||
257 |
/** |
|
258 |
* HSPS settings id. |
|
259 |
*/ |
|
260 |
HBufC8* iPluginId; |
|
261 |
||
262 |
/** |
|
263 |
* Stores the text which is drawn by listbox |
|
264 |
* Listbox takes only reference, own. |
|
265 |
*/ |
|
266 |
mutable HBufC* iListBoxLine; |
|
267 |
||
268 |
/** |
|
269 |
* Settings plugin |
|
270 |
* Not own. |
|
271 |
*/ |
|
272 |
CMCSPluginSettings& iPlugin; |
|
273 |
||
274 |
/** |
|
275 |
* Coe environment. |
|
276 |
* Not own. |
|
277 |
*/ |
|
278 |
CCoeEnv* iEnv; |
|
279 |
||
280 |
/** |
|
281 |
* Application list. |
|
282 |
* Own. |
|
283 |
*/ |
|
284 |
CMCSPluginSettingsAppList* iAppList; |
|
285 |
||
286 |
/** |
|
287 |
* Bookmark list. |
|
288 |
* Own. |
|
289 |
*/ |
|
290 |
CMCSPluginSettingsBkmList* iBkmList; |
|
291 |
||
292 |
/** |
|
293 |
* Settings plugin container. |
|
294 |
* Not own. |
|
295 |
*/ |
|
296 |
CMCSPluginSettingsContainer* iContainer; |
|
297 |
}; |
|
298 |
||
299 |
#endif // CMCSPLUGINSETTINGSMODEL_H |
|
300 |
||
301 |
// End of File. |