|
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: Plug-in data class |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #ifndef CMCSPLUGINDATA_H |
|
20 #define CMCSPLUGINDATA_H |
|
21 |
|
22 // INCLUDE FILES |
|
23 #include <e32base.h> |
|
24 #include <badesca.h> |
|
25 #include <mhomescreensettingsobserver.h> |
|
26 #include <hspluginsettings.h> |
|
27 #include <propertymap.h> |
|
28 #include <mcsmenu.h> |
|
29 |
|
30 class TMenuItem; |
|
31 class CCarouselPluginEngine; |
|
32 |
|
33 /** |
|
34 * @ingroup group_mcsplugin |
|
35 * |
|
36 * Stores the MCS Menu Items and keeps track whether |
|
37 * item needs to be published or not. |
|
38 * |
|
39 * @since S60 v9.1 |
|
40 */ |
|
41 NONSHARABLE_CLASS( CCarouselData ) : public CBase |
|
42 { |
|
43 public: |
|
44 CCarouselData(); |
|
45 |
|
46 ~CCarouselData(); |
|
47 |
|
48 /** |
|
49 * SetMenuItem |
|
50 * |
|
51 * @param aMenuItem |
|
52 */ |
|
53 void SetMenuItem( TMenuItem& aMenuItem ); |
|
54 |
|
55 /** |
|
56 * MenuItem |
|
57 * |
|
58 * @return TMenuItem |
|
59 */ |
|
60 TMenuItem& MenuItem(); |
|
61 |
|
62 /** |
|
63 * Name of the item. |
|
64 */ |
|
65 TDesC& Name(); |
|
66 |
|
67 /** |
|
68 * Set name of the item, |
|
69 */ |
|
70 void SetNameL( const TDesC& aName ); |
|
71 |
|
72 /** |
|
73 * Value of the item. Used for bookmark url. |
|
74 */ |
|
75 TDesC& Value(); |
|
76 |
|
77 /* |
|
78 * Set value of the item. |
|
79 */ |
|
80 void SetValueL( const TDesC& aValue ); |
|
81 |
|
82 /** |
|
83 * SetDirty |
|
84 * |
|
85 * @param aDirty |
|
86 * @return TBool |
|
87 */ |
|
88 void SetDirty( TBool aDirty ); |
|
89 |
|
90 /** |
|
91 * IsDirty |
|
92 * |
|
93 * @return TBool |
|
94 */ |
|
95 TBool IsDirty() const; |
|
96 |
|
97 private: |
|
98 /** |
|
99 * iMenuItem |
|
100 */ |
|
101 TMenuItem iMenuItem; |
|
102 |
|
103 /** |
|
104 * Item name, own |
|
105 */ |
|
106 HBufC* iName; |
|
107 |
|
108 /** |
|
109 * Item value, own |
|
110 */ |
|
111 HBufC* iValue; |
|
112 |
|
113 /** |
|
114 * iDirty |
|
115 */ |
|
116 TBool iDirty; |
|
117 }; |
|
118 |
|
119 /** |
|
120 * @ingroup group_mcsplugin |
|
121 * |
|
122 * Plug-in data class |
|
123 * |
|
124 * @since |
|
125 */ |
|
126 NONSHARABLE_CLASS( CCarouselPluginData ) : public CBase, |
|
127 public HSPluginSettingsIf::MHomeScreenSettingsObserver |
|
128 { |
|
129 |
|
130 public: |
|
131 |
|
132 /** |
|
133 * Part of the two phased constuction |
|
134 * |
|
135 * @param aEngine |
|
136 * @param aInstanceUid |
|
137 * @return Pointer to the created CMCSPluginData object |
|
138 */ |
|
139 static CCarouselPluginData* NewL( CCarouselPluginEngine& aEngine, |
|
140 const TDesC8& aInstanceUid ); |
|
141 |
|
142 /** |
|
143 * Constructor |
|
144 * |
|
145 * @param aEngine |
|
146 * @param aInstanceUid |
|
147 * @return none |
|
148 */ |
|
149 CCarouselPluginData( CCarouselPluginEngine& aEngine, const TDesC8& aInstanceUid ); |
|
150 |
|
151 /** |
|
152 * Destructor |
|
153 * |
|
154 * @param none |
|
155 * @return none |
|
156 */ |
|
157 ~CCarouselPluginData(); |
|
158 |
|
159 /** |
|
160 * DataItem |
|
161 * |
|
162 * @param aIndex |
|
163 * @return TMCSData& |
|
164 */ |
|
165 CCarouselData& DataItemL( TInt aIndex ); |
|
166 |
|
167 /** |
|
168 * Saves 'Undefined' menu item into settings when mailbox is deleted |
|
169 * |
|
170 * @param aIndex |
|
171 * @param aMenuItem |
|
172 */ |
|
173 void SaveUndefinedItemL( const TInt& aIndex ); |
|
174 |
|
175 /** |
|
176 * DataCount |
|
177 * |
|
178 * @return TInt |
|
179 */ |
|
180 TInt DataCount(){ return iData.Count();}; |
|
181 |
|
182 /** |
|
183 * Gets the instance specific settings from HSPS and creates data items |
|
184 */ |
|
185 void UpdateDataL(); |
|
186 |
|
187 /** |
|
188 * Removes data item from data list and saves new setting into HSPS |
|
189 */ |
|
190 void RemoveDataL( TInt aId ); |
|
191 |
|
192 // From MHomeScreenSettingsObserver |
|
193 /** |
|
194 * SettingsChangedL |
|
195 * |
|
196 * @param aEvent |
|
197 * @param aPluginName |
|
198 * @param aPluginUid |
|
199 * @param aPluginId |
|
200 */ |
|
201 void SettingsChangedL( const TDesC8& aEvent, const TDesC8& aPluginName, |
|
202 const TDesC8& aPluginUid, const TDesC8& aPluginId ); |
|
203 |
|
204 private: |
|
205 |
|
206 /** |
|
207 * Part of the two phased construction |
|
208 * |
|
209 * @param void |
|
210 * @return void |
|
211 */ |
|
212 void ConstructL(); |
|
213 |
|
214 /** |
|
215 * GetMenuDataL |
|
216 * @param aProperties |
|
217 * @return TMenuItem |
|
218 */ |
|
219 CCarouselData* GetMenuDataL( |
|
220 RPointerArray<HSPluginSettingsIf::CPropertyMap>& aProperties ); |
|
221 |
|
222 /** |
|
223 * Get bookmark data item |
|
224 * @param aUid, used for bookmark uid |
|
225 * @param aView, used for bookmark url |
|
226 * @param aParam, used for bookmark name |
|
227 * @param aData, is filled with appropriate values |
|
228 */ |
|
229 void GetBkmDataL( const TDesC8& aUid, const TDesC8& aView, const TDesC8& aParam, CCarouselData& aData ); |
|
230 |
|
231 /** |
|
232 * Get folder data item |
|
233 * @param aParam, is used for folder id (in MCS) |
|
234 * @param aData, is filled with appropriate values |
|
235 */ |
|
236 void GetFolderData( const TDesC8& aParam, CCarouselData& aData ); |
|
237 |
|
238 /** |
|
239 * Get mailbox data item |
|
240 * @param aUid, uid of the mailbox in messaging application |
|
241 * @param aParam, name of the mailbox |
|
242 * @param aData, is filled with appropriate values |
|
243 */ |
|
244 void GetMailboxDataL( const TDesC8& aUid, const TDesC8& aParam, CCarouselData& aData ); |
|
245 |
|
246 /** |
|
247 * Get MCS data item |
|
248 * @param aProperties, Properties are used to filter correct item from MCS. |
|
249 * @param aData, is filled with appropriate values |
|
250 */ |
|
251 void GetMCSDataL( |
|
252 RPointerArray<HSPluginSettingsIf::CPropertyMap>& aProperties, CCarouselData& aData ); |
|
253 |
|
254 private: // data |
|
255 |
|
256 // Menu items, which are defined in settings |
|
257 // Own |
|
258 RPointerArray<CCarouselData> iData; |
|
259 |
|
260 // Plugin settings. NOT OWNED! |
|
261 HSPluginSettingsIf::CHomescreenSettings* iPluginSettings; |
|
262 |
|
263 // Reference to MCS plug-in engine |
|
264 CCarouselPluginEngine& iEngine; |
|
265 |
|
266 // Reference to instance uid of HSPS widget |
|
267 const TDesC8& iInstanceUid; |
|
268 |
|
269 // MCS resource handle, owned |
|
270 RMenu iMenu; |
|
271 |
|
272 }; |
|
273 |
|
274 #endif // CMCSPLUGINDATA_H |