|
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 <eikcmobs.h> |
|
25 #include "cfsccontactactionmenu.h" |
|
26 #include "mfsccontactactionserviceobserver.h" |
|
27 |
|
28 // FORWARD DECLARATIONS |
|
29 class CFscContactActionMenuModelImpl; |
|
30 class CActiveSchedulerWait; |
|
31 class CTextResolver; |
|
32 class CFscContactActionMenuItem; |
|
33 class CAknStylusPopUpMenu; |
|
34 |
|
35 |
|
36 /** |
|
37 * Contact Action Menu implementation. |
|
38 * Contains API that implements all the functionality of the Contact Action |
|
39 * Menu. |
|
40 * |
|
41 * @lib fsccontactactionmenu.lib |
|
42 * @since S60 3.1 |
|
43 */ |
|
44 |
|
45 class CFscContactActionMenuImpl |
|
46 : public CFscContactActionMenu, |
|
47 public MCoeForegroundObserver, |
|
48 public MFscContactActionServiceObserver, |
|
49 public MEikMenuObserver |
|
50 { |
|
51 |
|
52 public: // Public constructors and destructor |
|
53 |
|
54 /** |
|
55 * Two-phased constructor. |
|
56 * |
|
57 * @param aParams Pointer construction parameters |
|
58 * @return New instance of the component |
|
59 */ |
|
60 static CFscContactActionMenuImpl* NewL( TAny* aParams ); |
|
61 |
|
62 /** |
|
63 * Destructor. |
|
64 */ |
|
65 virtual ~CFscContactActionMenuImpl(); |
|
66 |
|
67 public: // From CFscContactActionMenu |
|
68 |
|
69 /** |
|
70 * Execute Action Menu |
|
71 * ExecuteL opens Action Menu with current item set. Method is |
|
72 * synchronous and it will return when Action Menu is closed. |
|
73 * |
|
74 * @param aPosition Vertical position where menu is to be openned |
|
75 * @param aIndex Index of focused/highlighted item when menu is opened |
|
76 * @return Execution result |
|
77 */ |
|
78 TFscActionMenuResult ExecuteL( |
|
79 TFscContactActionMenuPosition aPosition = EFscCenter, TInt aIndex = 0, MFsActionMenuPositionGiver* aPositionGiver = 0 ); |
|
80 |
|
81 /** |
|
82 * Dismiss menu |
|
83 * Menu gets closed if it was visible when the method was called. |
|
84 * Otherwise method call does not do anything |
|
85 * |
|
86 * @param aSlide If ETrue menu slides away from the screen. |
|
87 * Otherwise it disappears instantly |
|
88 */ |
|
89 void Dismiss( TBool aSlide ); |
|
90 |
|
91 /** |
|
92 * Return a reference to Action Menu's model |
|
93 * |
|
94 * @return Reference to menu model |
|
95 */ |
|
96 MFscContactActionMenuModel& Model(); |
|
97 |
|
98 /** |
|
99 * Return index of selected item |
|
100 * |
|
101 * @return index of selected item |
|
102 */ |
|
103 TInt FocusedItemIndex(); |
|
104 |
|
105 /** |
|
106 * Return selected menu item object. |
|
107 * |
|
108 * @return selected menu item object. |
|
109 */ |
|
110 CFscContactActionMenuItem& FocusedItem(); |
|
111 |
|
112 |
|
113 public: // From MCoeForegroundObserver |
|
114 |
|
115 /** |
|
116 * Handles the application coming to the foreground. |
|
117 */ |
|
118 void HandleGainingForeground(); |
|
119 |
|
120 /** |
|
121 * Handles the application going into the background. |
|
122 */ |
|
123 void HandleLosingForeground(); |
|
124 |
|
125 public: // From MEikCommandObserver |
|
126 |
|
127 /** |
|
128 * ProcessCommandL |
|
129 * |
|
130 * @param aCommandId Command Id |
|
131 */ |
|
132 void ProcessCommandL( TInt aCommandId ); |
|
133 |
|
134 protected: // From base class MFscContactActionServiceObserver |
|
135 |
|
136 /** |
|
137 * From MFscContactActionServiceObserver. |
|
138 * Called when QueryActionsL method is complete. |
|
139 */ |
|
140 void QueryActionsComplete(); |
|
141 |
|
142 /** |
|
143 * From MFscContactActionServiceObserver. |
|
144 * Called when QueryActionsL method failed. |
|
145 * |
|
146 * @param aError An error code of the failure. |
|
147 */ |
|
148 void QueryActionsFailed( TInt aError ); |
|
149 |
|
150 /** |
|
151 * From MFscContactActionServiceObserver. |
|
152 * Called when ExecuteL method is complete. |
|
153 */ |
|
154 void ExecuteComplete(); |
|
155 |
|
156 /** |
|
157 * From MFscContactActionServiceObserver. |
|
158 * Called when ExecuteL method failed. |
|
159 * |
|
160 * @param aError An error code of the failure. |
|
161 */ |
|
162 void ExecuteFailed( TInt aError ); |
|
163 |
|
164 |
|
165 private: // Private constructors |
|
166 |
|
167 /** |
|
168 * Constructor. |
|
169 * |
|
170 * @param aParams Construction parameters |
|
171 */ |
|
172 CFscContactActionMenuImpl( |
|
173 const TFscContactActionMenuConstructParameters& aParams ); |
|
174 |
|
175 /** |
|
176 * Second phase constructor. |
|
177 * |
|
178 * @param aParams Construction parameters |
|
179 */ |
|
180 void ConstructL( |
|
181 const TFscContactActionMenuConstructParameters& aParams ); |
|
182 |
|
183 private: // Private methods |
|
184 /** |
|
185 * Dismiss Action Menu |
|
186 */ |
|
187 void DoDismiss(); |
|
188 |
|
189 void SetEmphasis(CCoeControl* aMenuControl,TBool aEmphasis); |
|
190 |
|
191 void DoLaunchStylusPopupL( const TPoint& aPoint ); |
|
192 |
|
193 void CloseStylusPopup(); |
|
194 |
|
195 void LaunchStylusPopupMenuL( const TPoint& aPoint ); |
|
196 |
|
197 void DoExecuteL( MFsActionMenuPositionGiver* aPositionGiver ); |
|
198 |
|
199 void HandleItemClick( TInt selectedItemIndex ); |
|
200 |
|
201 void StartWait(); |
|
202 |
|
203 void StopWait(); |
|
204 |
|
205 private: // data |
|
206 |
|
207 /** |
|
208 * Menu model |
|
209 * Owned |
|
210 */ |
|
211 CFscContactActionMenuModelImpl* iModel; |
|
212 |
|
213 /** |
|
214 * ExecuteL result code |
|
215 */ |
|
216 TFscActionMenuResult iMenuResult; |
|
217 |
|
218 /** |
|
219 * Selected item index |
|
220 */ |
|
221 TInt iSelectedItemIndex; |
|
222 |
|
223 /** |
|
224 * Error status while action menu is executed |
|
225 */ |
|
226 TInt iError; |
|
227 |
|
228 /* |
|
229 * Instant exit flag |
|
230 */ |
|
231 TBool iExit; |
|
232 /** |
|
233 * Text resolver for resolving error texts |
|
234 * Owned |
|
235 */ |
|
236 CTextResolver* iTextResolver; |
|
237 |
|
238 |
|
239 /** |
|
240 * Is action execution finished? |
|
241 */ |
|
242 TBool isExecuteCompleted; |
|
243 |
|
244 /** |
|
245 * Is action executing. |
|
246 */ |
|
247 TBool iIsActionExecuting; |
|
248 |
|
249 |
|
250 /// Own: Stylus popup menu |
|
251 CAknStylusPopUpMenu* iStylusPopup; |
|
252 |
|
253 /** |
|
254 * Dummy item returned in case of error. |
|
255 */ |
|
256 CFscContactActionMenuItem* iDummyMenuItem; |
|
257 |
|
258 /** |
|
259 * Wait loop for ExecuteL |
|
260 * Owned |
|
261 */ |
|
262 CActiveSchedulerWait* iWait; |
|
263 }; |
|
264 |
|
265 #endif // C_FSCCONTACTACTIONMENUIMPL_H |
|
266 |