|
1 /* |
|
2 * Copyright (c) 2009 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: |
|
15 * |
|
16 */ |
|
17 |
|
18 #ifndef __MENUSRVOPERATION_H__ |
|
19 #define __MENUSRVOPERATION_H__ |
|
20 |
|
21 // INCLUDES |
|
22 |
|
23 #include "menusrvobject.h" |
|
24 #include "menuengoperation.h" |
|
25 #include "mcsdef.h" |
|
26 #include "menuitemattr.h" |
|
27 |
|
28 // FORWARD DECLARATION |
|
29 |
|
30 class RReadStream; |
|
31 class CMenuEng; |
|
32 class CMenuEngObject; |
|
33 |
|
34 // CLASS DECLARATION |
|
35 |
|
36 /** |
|
37 * Server side operation object base. |
|
38 */ |
|
39 NONSHARABLE_CLASS( CMenuSrvOperation ) |
|
40 : public CMenuSrvObject, public MMenuEngOperation |
|
41 { |
|
42 |
|
43 protected: // construction |
|
44 |
|
45 /** |
|
46 * Constructor. |
|
47 * @param aEng Engine. |
|
48 */ |
|
49 CMenuSrvOperation( CMenuEng& aEng ); |
|
50 |
|
51 public: // new methods |
|
52 |
|
53 /** |
|
54 * Start operation. |
|
55 * @param aMessage Message pending on this operation. |
|
56 * "Completion responsibility" taken: will be completed by this object. |
|
57 * -> No leaving after calling this! |
|
58 */ |
|
59 void StartL( const RMessage2& aMessage ); |
|
60 |
|
61 public: // from CMenuSrvObject |
|
62 |
|
63 /** |
|
64 * Cancel operation. |
|
65 */ |
|
66 void Cancel(); |
|
67 |
|
68 private: // from MMenuEngOperation |
|
69 |
|
70 /** |
|
71 * Perform operations on the menu. |
|
72 */ |
|
73 virtual void RunMenuEngOperationL() = 0; |
|
74 |
|
75 /** |
|
76 * Operation complete (changes saved). |
|
77 * @param aErr Error code. |
|
78 */ |
|
79 virtual void CompletedMenuEngOperation( TInt aErr ); |
|
80 |
|
81 protected: // data |
|
82 |
|
83 CMenuEng& iEng; ///< Engine. |
|
84 |
|
85 }; |
|
86 |
|
87 /** |
|
88 * Menu Server Remove Operation. |
|
89 */ |
|
90 NONSHARABLE_CLASS( CMenuSrvRemoveOperation ): public CMenuSrvOperation |
|
91 { |
|
92 |
|
93 public: // construction |
|
94 |
|
95 /** |
|
96 * Constructor. |
|
97 * @param aEng Engine. |
|
98 * @param aId Remove this item. |
|
99 */ |
|
100 CMenuSrvRemoveOperation( CMenuEng& aEng, TInt aId ); |
|
101 |
|
102 private: // from MMenuEngOperation |
|
103 |
|
104 /** |
|
105 * Perform operations on the menu: delete the item. |
|
106 */ |
|
107 virtual void RunMenuEngOperationL(); |
|
108 |
|
109 protected: // data |
|
110 |
|
111 TInt iId; ///< Item ID. |
|
112 |
|
113 }; |
|
114 |
|
115 /** |
|
116 * Menu Server MoveToFolder Operation. |
|
117 */ |
|
118 NONSHARABLE_CLASS( CMenuSrvMoveToFolderOperation ): public CMenuSrvOperation |
|
119 { |
|
120 |
|
121 public: // construction |
|
122 |
|
123 /** |
|
124 * Destructor. |
|
125 */ |
|
126 virtual ~CMenuSrvMoveToFolderOperation(); |
|
127 |
|
128 /** |
|
129 * Two-phased constructor. |
|
130 * @param aEng Engine. |
|
131 * @param aItems Item array streamed. |
|
132 * @param aFolder Target folder. |
|
133 * @param aMoveBefore Insertion point. |
|
134 * @return The created operation. |
|
135 */ |
|
136 static CMenuSrvMoveToFolderOperation* NewL( |
|
137 CMenuEng& aEng, |
|
138 RReadStream& aItems, |
|
139 TInt aFolder, |
|
140 TInt aMoveBefore ); |
|
141 |
|
142 protected: // construction |
|
143 |
|
144 /** |
|
145 * Constructor. |
|
146 * @param aEng Engine. |
|
147 * @param aFolder Target folder. |
|
148 * @param aMoveBefore Insertion point. |
|
149 */ |
|
150 CMenuSrvMoveToFolderOperation( |
|
151 CMenuEng& aEng, |
|
152 TInt aFolder, |
|
153 TInt aMoveBefore ); |
|
154 |
|
155 /** |
|
156 * Second phase constructor. |
|
157 * @param aItems Item array streamed. |
|
158 */ |
|
159 void ConstructL( RReadStream& aItems ); |
|
160 |
|
161 private: // from MMenuEngOperation |
|
162 |
|
163 /** |
|
164 * Perform operations on the menu: move the items. |
|
165 */ |
|
166 virtual void RunMenuEngOperationL(); |
|
167 |
|
168 protected: // data |
|
169 |
|
170 TInt iFolder; ///< Target folder. |
|
171 TInt iMoveBefore; ///< Insertion point. |
|
172 RArray<TInt> iItems; ///< Items to be moced. Own. |
|
173 }; |
|
174 |
|
175 /** |
|
176 * Menu Server Reorder Operation. |
|
177 */ |
|
178 NONSHARABLE_CLASS( CMenuSrvReorderOperation ): public CMenuSrvOperation |
|
179 { |
|
180 |
|
181 public: // construction |
|
182 |
|
183 /** |
|
184 * Constructor. |
|
185 * @param aEng Engine. |
|
186 * @param aId Item ID. |
|
187 * @param aMoveBefore Insertion point. |
|
188 */ |
|
189 CMenuSrvReorderOperation( CMenuEng& aEng, TInt aId, TInt aMoveBefore ); |
|
190 |
|
191 private: // from MMenuEngOperation |
|
192 |
|
193 /** |
|
194 * Perform operations on the menu: reorder the item. |
|
195 */ |
|
196 virtual void RunMenuEngOperationL(); |
|
197 |
|
198 protected: // data |
|
199 |
|
200 TInt iId; ///< Item ID. |
|
201 TInt iMoveBefore; ///< Insertion point. |
|
202 |
|
203 }; |
|
204 |
|
205 /** |
|
206 * Menu Server Add Item Operation. |
|
207 */ |
|
208 NONSHARABLE_CLASS( CMenuSrvAddOperation ): public CMenuSrvOperation |
|
209 { |
|
210 |
|
211 public: // construction |
|
212 |
|
213 /** |
|
214 * Destructor. |
|
215 */ |
|
216 virtual ~CMenuSrvAddOperation(); |
|
217 |
|
218 /** |
|
219 * Two-phased constructor. |
|
220 * @param aEng Engine. |
|
221 * @param aType Type. |
|
222 * @param aChanges Streamed data. |
|
223 * @return The created operation. |
|
224 */ |
|
225 static CMenuSrvAddOperation* NewL( |
|
226 CMenuEng& aEng, |
|
227 const TDesC& aType, |
|
228 RReadStream& aChanges ); |
|
229 |
|
230 protected: // construction |
|
231 |
|
232 /** |
|
233 * Constructor. |
|
234 * @param aEng Engine. |
|
235 */ |
|
236 CMenuSrvAddOperation( CMenuEng& aEng ); |
|
237 |
|
238 /** |
|
239 * Second phase constructor. |
|
240 * @param aType Type. |
|
241 * @param aChanges Streamed data. |
|
242 */ |
|
243 void ConstructL( const TDesC& aType, RReadStream& aChanges ); |
|
244 |
|
245 public: // new methods |
|
246 |
|
247 /** |
|
248 * Get object ID. The ID is generated, but the object is not yet added |
|
249 * to the engine! |
|
250 * @return Object ID. |
|
251 */ |
|
252 TInt ObjectId(); |
|
253 |
|
254 private: // from MMenuEngOperation |
|
255 |
|
256 /** |
|
257 * Perform operations on the menu: add the item. |
|
258 */ |
|
259 virtual void RunMenuEngOperationL(); |
|
260 |
|
261 protected: // data |
|
262 |
|
263 CMenuEngObject* iObject; ///< Object to be added. Own. |
|
264 TInt iParent; ///< Parent folder. |
|
265 TInt iInsertBefore; ///< Insertion point. |
|
266 |
|
267 }; |
|
268 |
|
269 /** |
|
270 * Menu Server Update Item Operation. |
|
271 */ |
|
272 NONSHARABLE_CLASS( CMenuSrvUpdateOperation ): public CMenuSrvOperation |
|
273 { |
|
274 |
|
275 public: // construction |
|
276 |
|
277 /** |
|
278 * Destructor. |
|
279 */ |
|
280 virtual ~CMenuSrvUpdateOperation(); |
|
281 |
|
282 /** |
|
283 * Two-phased constructor. |
|
284 * @param aEng Engine. |
|
285 * @param aId Item ID. |
|
286 * @param aChanges Streamed data. |
|
287 * @return The created operation. |
|
288 */ |
|
289 static CMenuSrvUpdateOperation* NewL( |
|
290 CMenuEng& aEng, |
|
291 TInt aId, |
|
292 RReadStream& aChanges ); |
|
293 |
|
294 protected: // construction |
|
295 |
|
296 /** |
|
297 * Constructor. |
|
298 * @param aEng Engine. |
|
299 * @param aId Item ID. |
|
300 */ |
|
301 CMenuSrvUpdateOperation( CMenuEng& aEng, TInt aId ); |
|
302 |
|
303 /** |
|
304 * Second phase constructor. |
|
305 * @param aChanges Streamed data. |
|
306 */ |
|
307 void ConstructL( RReadStream& aChanges ); |
|
308 |
|
309 private: // from MMenuEngOperation |
|
310 |
|
311 /** |
|
312 * Perform operations on the menu: update the item. |
|
313 */ |
|
314 virtual void RunMenuEngOperationL(); |
|
315 |
|
316 protected: // data |
|
317 |
|
318 TInt iId; ///< Item ID. |
|
319 TUint32 iFlags; ///< Flags. |
|
320 TUint32 iChangedFlags; ///< Flags change mask. |
|
321 RMenuItemAttrArray iAttrChanges; ///< Attribute changes. Own. |
|
322 |
|
323 }; |
|
324 |
|
325 #endif // __MENUSRVOPERATION_H__ |
|
326 |
|
327 // End of File |