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