1 /* |
1 /* |
2 * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). |
2 * Copyright (c) 2009 - 2010 Nokia Corporation and/or its subsidiary(-ies). |
3 * All rights reserved. |
3 * All rights reserved. |
4 * This component and the accompanying materials are made available |
4 * This component and the accompanying materials are made available |
5 * under the terms of "Eclipse Public License v1.0" |
5 * under the terms of "Eclipse Public License v1.0" |
6 * which accompanies this distribution, and is available |
6 * which accompanies this distribution, and is available |
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
24 #include <badesca.h> |
24 #include <badesca.h> |
25 #include <mhomescreensettingsobserver.h> |
25 #include <mhomescreensettingsobserver.h> |
26 #include <hspluginsettings.h> |
26 #include <hspluginsettings.h> |
27 #include <propertymap.h> |
27 #include <propertymap.h> |
28 #include <mcsmenu.h> |
28 #include <mcsmenu.h> |
29 #include <msvapi.h> // For MMsvSessionObserver |
|
30 |
29 |
31 class TMenuItem; |
30 class TMenuItem; |
32 class CMCSPluginEngine; |
31 class CMCSPluginEngine; |
33 class CMCSPluginWatcher; |
|
34 |
|
35 |
32 |
36 /** |
33 /** |
37 * @ingroup group_mcsplugin |
34 * @ingroup group_mcsplugin |
38 * |
35 * |
39 * TMCData class |
36 * Stores the MCS Menu Items and keeps track whether |
|
37 * item needs to be published or not. |
40 * |
38 * |
41 * @since S60 v9.1 |
39 * @since S60 v9.1 |
42 */ |
40 */ |
43 class TMCSData |
41 NONSHARABLE_CLASS( CMCSData ) : public CBase |
44 { |
42 { |
45 public: |
43 public: |
|
44 CMCSData(); |
|
45 |
|
46 ~CMCSData(); |
|
47 |
46 /** |
48 /** |
47 * SetMenuItem |
49 * SetMenuItem |
48 * |
50 * |
49 * @param aMenuItem |
51 * @param aMenuItem |
50 */ |
52 */ |
129 * DataItem |
160 * DataItem |
130 * |
161 * |
131 * @param aIndex |
162 * @param aIndex |
132 * @return TMCSData& |
163 * @return TMCSData& |
133 */ |
164 */ |
134 TMCSData& DataItemL( TInt aIndex ); |
165 CMCSData& DataItemL( TInt aIndex ); |
135 |
166 |
136 /** |
167 /** |
137 * ReplaceMenuItemL |
168 * Saves 'Undefined' menu item into settings when mailbox is deleted |
138 * |
169 * |
139 * @param aIndex |
170 * @param aIndex |
140 * @param aMenuItem |
171 * @param aMenuItem |
141 */ |
172 */ |
142 void ReplaceMenuItemL( const TInt& aIndex, TMenuItem& aMenuItem ); |
173 void SaveUndefinedItemL( const TInt& aIndex ); |
143 |
|
144 /** |
|
145 * SaveSettingsL |
|
146 * |
|
147 * @param aIndex |
|
148 * @param aMenuItem |
|
149 */ |
|
150 void SaveSettingsL( const TInt& aIndex, CMenuItem& aMenuItem ); |
|
151 |
174 |
152 /** |
175 /** |
153 * DataCount |
176 * DataCount |
154 * |
177 * |
155 * @return TInt |
178 * @return TInt |
156 */ |
179 */ |
157 TInt DataCount(){ return iData.Count();}; |
180 TInt DataCount(){ return iData.Count();}; |
158 |
181 |
159 /** |
182 /** |
160 * UpdateDataL |
183 * Gets the instance specific settings from HSPS and creates data items |
161 */ |
184 */ |
162 void UpdateDataL(); |
185 void UpdateDataL(); |
163 |
186 |
|
187 /** |
|
188 * Removes data item from data list and saves new setting into HSPS |
|
189 */ |
|
190 void RemoveDataL( TInt aId ); |
|
191 |
164 // From MHomeScreenSettingsObserver |
192 // From MHomeScreenSettingsObserver |
165 /** |
193 /** |
166 * SettingsChangedL |
194 * SettingsChangedL |
167 * |
195 * |
168 * @param aEvent |
196 * @param aEvent |
171 * @param aPluginId |
199 * @param aPluginId |
172 */ |
200 */ |
173 void SettingsChangedL( const TDesC8& aEvent, const TDesC8& aPluginName, |
201 void SettingsChangedL( const TDesC8& aEvent, const TDesC8& aPluginName, |
174 const TDesC8& aPluginUid, const TDesC8& aPluginId ); |
202 const TDesC8& aPluginUid, const TDesC8& aPluginId ); |
175 |
203 |
176 /** |
|
177 * CreateRunTimeMenuItemsL |
|
178 * @param void |
|
179 * @return void |
|
180 */ |
|
181 void CreateRuntimeMenuItemsL(); |
|
182 |
|
183 // from base class MMsvSessionObserver |
|
184 |
|
185 /** |
|
186 * Handles an event from the message server. |
|
187 * Not used, but must be defined to be able to use the messaging server. |
|
188 * |
|
189 * @since S60 v3.2 |
|
190 * @param aEvent Indicates the event type. |
|
191 * @param aArg1 Event type-specific argument value |
|
192 * @param aArg2 Event type-specific argument value |
|
193 * @param aArg3 Event type-specific argument value |
|
194 */ |
|
195 void HandleSessionEventL( TMsvSessionEvent aEvent, TAny* aArg1, TAny* aArg2, |
|
196 TAny* aArg3 ); |
|
197 |
|
198 private: |
204 private: |
199 |
205 |
200 /** |
206 /** |
201 * Part of the two phased construction |
207 * Part of the two phased construction |
202 * |
208 * |
204 * @return void |
210 * @return void |
205 */ |
211 */ |
206 void ConstructL(); |
212 void ConstructL(); |
207 |
213 |
208 /** |
214 /** |
209 * CreateMenuItemL |
215 * GetMenuDataL |
210 * @param aProperties |
216 * @param aProperties |
211 * @return TMenuItem |
217 * @return TMenuItem |
212 */ |
218 */ |
213 TMenuItem CreateMenuItemL( |
219 CMCSData* GetMenuDataL( |
214 RPointerArray<HSPluginSettingsIf::CPropertyMap>& aProperties ); |
220 RPointerArray<HSPluginSettingsIf::CPropertyMap>& aProperties ); |
215 |
221 |
216 /** |
222 /** |
217 * GetMCSPluginFolderIdL |
223 * Get bookmark data item |
218 * |
224 * @param aView, used for bookmark url |
219 * @return TInt |
225 * @param aParam, used for bookmark name |
220 */ |
226 * @param aData, is filled with appropriate values |
221 TInt GetMCSPluginFolderIdL(); |
227 */ |
|
228 void GetBkmDataL( const TDesC8& aView, const TDesC8& aParam, CMCSData& aData ); |
|
229 |
|
230 /** |
|
231 * Get folder data item |
|
232 * @param aParam, is used for folder id (in MCS) |
|
233 * @param aData, is filled with appropriate values |
|
234 */ |
|
235 void GetFolderData( const TDesC8& aParam, CMCSData& aData ); |
|
236 |
|
237 /** |
|
238 * Get mailbox data item |
|
239 * @param aUid, uid of the mailbox in messaging application |
|
240 * @param aParam, name of the mailbox |
|
241 * @param aData, is filled with appropriate values |
|
242 */ |
|
243 void GetMailboxDataL( const TDesC8& aUid, const TDesC8& aParam, CMCSData& aData ); |
|
244 |
|
245 /** |
|
246 * Get MCS data item |
|
247 * @param aProperties, Properties are used to filter correct item from MCS. |
|
248 * @param aData, is filled with appropriate values |
|
249 */ |
|
250 void GetMCSDataL( |
|
251 RPointerArray<HSPluginSettingsIf::CPropertyMap>& aProperties, CMCSData& aData ); |
|
252 |
222 private: // data |
253 private: // data |
223 |
254 |
224 // Menu items, which are defined in settings |
255 // Menu items, which are defined in settings |
225 // Own |
256 // Own |
226 RArray<TMCSData> iData; |
257 RPointerArray<CMCSData> iData; |
227 |
258 |
228 // Plugin settings. NOT OWNED! |
259 // Plugin settings. NOT OWNED! |
229 HSPluginSettingsIf::CHomescreenSettings* iPluginSettings; |
260 HSPluginSettingsIf::CHomescreenSettings* iPluginSettings; |
230 |
261 |
231 // Reference to MCS plug-in engine |
262 // Reference to MCS plug-in engine |
232 CMCSPluginEngine& iEngine; |
263 CMCSPluginEngine& iEngine; |
233 |
264 |
234 // Reference to instance uid of HSPS widget |
265 // Reference to instance uid of HSPS widget |
235 const TDesC8& iInstanceUid; |
266 const TDesC8& iInstanceUid; |
236 |
267 |
237 // MCS asynchronous operation watcher, owned |
|
238 CMCSPluginWatcher* iSaveWatcher; |
|
239 |
|
240 // MCS resource handle, owned |
268 // MCS resource handle, owned |
241 RMenu iMenu; |
269 RMenu iMenu; |
242 |
270 |
243 /** |
|
244 * Message server session |
|
245 * Own. |
|
246 */ |
|
247 CMsvSession* iMsvSession; |
|
248 }; |
271 }; |
249 |
272 |
250 #endif // CMCSPLUGINDATA_H |
273 #endif // CMCSPLUGINDATA_H |