|
1 /* |
|
2 * Copyright (c) 2008 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: Definition of the class CFscContactActionMenuImpl. |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #ifndef C_FSCCONTACTACTIONMENUIMPL_H |
|
20 #define C_FSCCONTACTACTIONMENUIMPL_H |
|
21 |
|
22 #include <e32base.h> |
|
23 #include <coemain.h> |
|
24 #include <AknPopupFader.h> |
|
25 #include <eikcmobs.h> |
|
26 //<cmail> |
|
27 #include "cfsccontactactionmenu.h" |
|
28 #include "mfsccontactactionserviceobserver.h" |
|
29 //</cmail> |
|
30 |
|
31 #include "mfsccontactactionmenulistobserver.h" |
|
32 |
|
33 // FORWARD DECLARATIONS |
|
34 class CFscContactActionService; |
|
35 class CFscContactActionMenuModelImpl; |
|
36 class CFscContactActionMenuList; |
|
37 class CActiveSchedulerWait; |
|
38 class CEikButtonGroupContainer; |
|
39 class CTextResolver; |
|
40 class CEikonEnv; |
|
41 class CFscContactActionMenuItem; |
|
42 |
|
43 /** |
|
44 * Contact Action Menu implementation. |
|
45 * Contains API that implements all the functionality of the Contact Action |
|
46 * Menu. |
|
47 * |
|
48 * @lib fsccontactactionmenu.lib |
|
49 * @since S60 3.1 |
|
50 */ |
|
51 class CFscContactActionMenuImpl |
|
52 : public CFscContactActionMenu, |
|
53 public MFscContactActionMenuListObserver, |
|
54 public MAknFadedComponent, |
|
55 public MCoeForegroundObserver, |
|
56 public MEikCommandObserver, |
|
57 public MFscContactActionServiceObserver |
|
58 { |
|
59 |
|
60 public: // Public constructors and destructor |
|
61 |
|
62 /** |
|
63 * Two-phased constructor. |
|
64 * |
|
65 * @param aParams Pointer construction parameters |
|
66 * @return New instance of the component |
|
67 */ |
|
68 static CFscContactActionMenuImpl* NewL( TAny* aParams ); |
|
69 |
|
70 /** |
|
71 * Destructor. |
|
72 */ |
|
73 virtual ~CFscContactActionMenuImpl(); |
|
74 |
|
75 public: // From CFscContactActionMenu |
|
76 |
|
77 /** |
|
78 * Execute Action Menu |
|
79 * ExecuteL opens Action Menu with current item set. Method is |
|
80 * synchronous and it will return when Action Menu is closed. |
|
81 * |
|
82 * @param aPosition Vertical position where menu is to be openned |
|
83 * @param aIndex Index of focused/highlighted item when menu is opened |
|
84 * @return Execution result |
|
85 */ |
|
86 TFscActionMenuResult ExecuteL( |
|
87 TFscContactActionMenuPosition aPosition = EFscCenter, TInt aIndex = 0, MFsActionMenuPositionGiver* aPositionGiver = 0 ); |
|
88 |
|
89 /** |
|
90 * Dismiss menu |
|
91 * Menu gets closed if it was visible when the method was called. |
|
92 * Otherwise method call does not do anything |
|
93 * |
|
94 * @param aSlide If ETrue menu slides away from the screen. |
|
95 * Otherwise it disappears instantly |
|
96 */ |
|
97 void Dismiss( TBool aSlide ); |
|
98 |
|
99 /** |
|
100 * Return a reference to Action Menu's model |
|
101 * |
|
102 * @return Reference to menu model |
|
103 */ |
|
104 MFscContactActionMenuModel& Model(); |
|
105 |
|
106 /** |
|
107 * Return index of selected item |
|
108 * |
|
109 * @return index of selected item |
|
110 */ |
|
111 TInt FocusedItemIndex(); |
|
112 |
|
113 /** |
|
114 * Return selected menu item object. |
|
115 * |
|
116 * @return selected menu item object. |
|
117 */ |
|
118 CFscContactActionMenuItem& FocusedItem(); |
|
119 |
|
120 /** |
|
121 * This method is called if the menu was opened from meeting request. |
|
122 * |
|
123 * @param aOpenedFromMR ETrue, if opened from meeting request. |
|
124 */ |
|
125 void SetOpenedFromMR( TBool aOpenedFromMR ); |
|
126 |
|
127 public: // From MFscContactActionMenuListObserver |
|
128 |
|
129 /** |
|
130 * Handle action menu list event |
|
131 * |
|
132 * @param aEvent Event code |
|
133 * @param aError Error code used with error event |
|
134 */ |
|
135 void HandleListEvent( TFscContactActionMenuListEvent aEvent, |
|
136 TInt aError = KErrNone ); |
|
137 |
|
138 /** |
|
139 * Check if executed action is completed. |
|
140 */ |
|
141 TBool IsOperationCompleted(); |
|
142 |
|
143 public: // From MAknFadedComponent |
|
144 |
|
145 /** |
|
146 * Count Faded Components |
|
147 * |
|
148 * @return count |
|
149 */ |
|
150 TInt CountFadedComponents(); |
|
151 |
|
152 /** |
|
153 * Get Faded Component |
|
154 * |
|
155 * @param component index |
|
156 * @return component |
|
157 */ |
|
158 CCoeControl* FadedComponent( TInt aIndex ); |
|
159 |
|
160 public: // From MCoeForegroundObserver |
|
161 |
|
162 /** |
|
163 * Handles the application coming to the foreground. |
|
164 */ |
|
165 void HandleGainingForeground(); |
|
166 |
|
167 /** |
|
168 * Handles the application going into the background. |
|
169 */ |
|
170 void HandleLosingForeground(); |
|
171 |
|
172 public: // From MEikCommandObserver |
|
173 |
|
174 /** |
|
175 * ProcessCommandL |
|
176 * |
|
177 * @param aCommandId Command Id |
|
178 */ |
|
179 void ProcessCommandL( TInt aCommandId ); |
|
180 |
|
181 protected: // From base class MFscContactActionServiceObserver |
|
182 |
|
183 /** |
|
184 * From MFscContactActionServiceObserver. |
|
185 * Called when QueryActionsL method is complete. |
|
186 */ |
|
187 void QueryActionsComplete(); |
|
188 |
|
189 /** |
|
190 * From MFscContactActionServiceObserver. |
|
191 * Called when QueryActionsL method failed. |
|
192 * |
|
193 * @param aError An error code of the failure. |
|
194 */ |
|
195 void QueryActionsFailed( TInt aError ); |
|
196 |
|
197 /** |
|
198 * From MFscContactActionServiceObserver. |
|
199 * Called when ExecuteL method is complete. |
|
200 */ |
|
201 void ExecuteComplete(); |
|
202 |
|
203 /** |
|
204 * From MFscContactActionServiceObserver. |
|
205 * Called when ExecuteL method failed. |
|
206 * |
|
207 * @param aError An error code of the failure. |
|
208 */ |
|
209 void ExecuteFailed( TInt aError ); |
|
210 |
|
211 |
|
212 private: // Private constructors |
|
213 |
|
214 /** |
|
215 * Constructor. |
|
216 * |
|
217 * @param aParams Construction parameters |
|
218 */ |
|
219 CFscContactActionMenuImpl( |
|
220 const TFscContactActionMenuConstructParameters& aParams ); |
|
221 |
|
222 /** |
|
223 * Second phase constructor. |
|
224 * |
|
225 * @param aParams Construction parameters |
|
226 */ |
|
227 void ConstructL( |
|
228 const TFscContactActionMenuConstructParameters& aParams ); |
|
229 |
|
230 private: // Private methods |
|
231 |
|
232 /** |
|
233 * Execute Action Menu |
|
234 * ExecuteL opens Action Menu with current item set. Method is |
|
235 * synchronous and it will return when Action Menu is closed. |
|
236 * |
|
237 * @param aPosition Vertical position where menu is to be openned |
|
238 * @param aIndex Index of focused/highlighted item when menu is opened |
|
239 */ |
|
240 void DoExecuteL( |
|
241 TFscContactActionMenuPosition aPosition, |
|
242 TInt aIndex ); |
|
243 |
|
244 /** |
|
245 * Dismiss Action Menu |
|
246 */ |
|
247 void DoDismiss(); |
|
248 |
|
249 /** |
|
250 * Start menu execution wait |
|
251 */ |
|
252 void StartWait(); |
|
253 |
|
254 /** |
|
255 * Stop menu execution wait |
|
256 */ |
|
257 void StopWait(); |
|
258 |
|
259 /** |
|
260 * Show menu's cba |
|
261 */ |
|
262 void ShowMenuCbaL(); |
|
263 |
|
264 /** |
|
265 * Hide menu's cba |
|
266 */ |
|
267 void HideMenuCba(); |
|
268 |
|
269 /** |
|
270 * Handle item click |
|
271 */ |
|
272 void HandleItemClick(); |
|
273 |
|
274 /** |
|
275 * Update fade colors |
|
276 */ |
|
277 void UpdateFadeColors(); |
|
278 |
|
279 private: // data |
|
280 |
|
281 /** |
|
282 * Menu model |
|
283 * Owned |
|
284 */ |
|
285 CFscContactActionMenuModelImpl* iModel; |
|
286 |
|
287 /** |
|
288 * Menu's UI list |
|
289 * Owned |
|
290 */ |
|
291 CFscContactActionMenuList* iList; |
|
292 |
|
293 /** |
|
294 * Menu's current mode |
|
295 */ |
|
296 TFscContactActionMenuMode iMode; |
|
297 |
|
298 /** |
|
299 * ExecuteL result code |
|
300 */ |
|
301 TFscActionMenuResult iMenuResult; |
|
302 |
|
303 /** |
|
304 * Selected item index |
|
305 */ |
|
306 TInt iSelectedItemIndex; |
|
307 |
|
308 /** |
|
309 * Error status while action menu is executed |
|
310 */ |
|
311 TInt iError; |
|
312 |
|
313 /* |
|
314 * Instant exit flag |
|
315 */ |
|
316 TBool iExit; |
|
317 |
|
318 /** |
|
319 * Button group container for menu's softkeys |
|
320 * Owned |
|
321 */ |
|
322 CEikButtonGroupContainer* iButtonGroupContainer; |
|
323 |
|
324 /** |
|
325 * Wait loop for ExecuteL |
|
326 * Owned |
|
327 */ |
|
328 CActiveSchedulerWait* iWait; |
|
329 |
|
330 /** |
|
331 * Popup fader for dialog style fading effect |
|
332 */ |
|
333 TAknPopupFader iFader; |
|
334 |
|
335 /** |
|
336 * Text resolver for resolving error texts |
|
337 * Owned |
|
338 */ |
|
339 CTextResolver* iTextResolver; |
|
340 |
|
341 /** |
|
342 * Operation observer. |
|
343 * Not own. |
|
344 */ |
|
345 MFscContactActionServiceObserver* iObserver; |
|
346 |
|
347 /** |
|
348 * Is action execution finished? |
|
349 */ |
|
350 TBool isExecuteCompleted; |
|
351 |
|
352 /** |
|
353 * Is action executing. |
|
354 */ |
|
355 TBool iIsActionExecuting; |
|
356 |
|
357 /** |
|
358 * Dummy item returned in case of error. |
|
359 */ |
|
360 CFscContactActionMenuItem* iDummyMenuItem; |
|
361 |
|
362 TBool iOpenedFromMR; |
|
363 }; |
|
364 |
|
365 #endif // C_FSCCONTACTACTIONMENUIMPL_H |
|
366 |