|
1 /* |
|
2 * Copyright (c) 2007-2007 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: Implementation of comm launcher view plugin |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #ifndef C_CCAPPCOMMLAUNCHERPLUGIN_H |
|
20 #define C_CCAPPCOMMLAUNCHERPLUGIN_H |
|
21 |
|
22 #include <mccacontactobserver.h> |
|
23 |
|
24 #include "ccappcommlauncherheaders.h" |
|
25 #include <mccappviewpluginbase2.h> |
|
26 |
|
27 class CCCAppCommLauncherContactHandler; |
|
28 class CCCAppCommLauncherMenuHandler; |
|
29 class CCAContactorService; |
|
30 class TCSParameter; |
|
31 |
|
32 /** |
|
33 * A helper class to keep up the command running state correct. |
|
34 * Only one command should be able to run at a time. |
|
35 */ |
|
36 class TCCAppCommandState |
|
37 { |
|
38 public: |
|
39 /** |
|
40 * Constructor |
|
41 */ |
|
42 TCCAppCommandState(); |
|
43 /** |
|
44 * Returns ETrue if a command is running. |
|
45 * @return ETrue if a command is running. |
|
46 */ |
|
47 inline TBool IsRunning() const { return iState; } |
|
48 /** |
|
49 * Change to Running state. |
|
50 */ |
|
51 void SetRunning(); |
|
52 /** |
|
53 * Change to Not Running state. |
|
54 */ |
|
55 void SetNotRunning(); |
|
56 /** |
|
57 * Sets state to Running and pushes a cleanup item to the CleanupStack. |
|
58 * The state will be changed to 'Not Running' in case of leave. |
|
59 */ |
|
60 void SetRunningAndPushCleanupL(); |
|
61 /** |
|
62 * Change to Not Running state and pops up the cleanup item previously |
|
63 * pushed by PushCleanupL or SetRunningAndPushCleanupL. |
|
64 */ |
|
65 void SetNotRunningAndPopCleanup(); |
|
66 /** |
|
67 * Pushes a cleanup item to the CleanupStack. |
|
68 * The state will be changed to 'Not Running' in case of leave. |
|
69 */ |
|
70 void PushCleanupL(); |
|
71 /** |
|
72 * Pops up the cleanup item previously pushed by |
|
73 * PushCleanupL or SetRunningAndPushCleanupL. |
|
74 */ |
|
75 void PopCleanup(); |
|
76 private: |
|
77 TCCAppCommandState& operator=(const TCCAppCommandState&); |
|
78 TCCAppCommandState(const TCCAppCommandState&); |
|
79 static void CleanupOperation( TAny* aCommanState ); |
|
80 private: |
|
81 /// Own: ETrue if command is running, false otherwise. |
|
82 TBool iState; |
|
83 }; |
|
84 |
|
85 |
|
86 /** |
|
87 * Class implementing CCCAppViewPluginBase interface. This is |
|
88 * the main class and controlling the other classes of the plugin. |
|
89 * |
|
90 * @code |
|
91 * ?good_class_usage_example(s) |
|
92 * @endcode |
|
93 * |
|
94 * @lib ccappcommlauncherplugin.dll |
|
95 * @since S60 v3.2 |
|
96 */ |
|
97 class CCCAppCommLauncherPlugin : |
|
98 public CCCAppViewPluginBase, |
|
99 public MCCAppPluginsContactObserver, |
|
100 public MCCAppViewPluginBase2 |
|
101 { |
|
102 #ifdef __COMMLAUNCHERPLUGINUNITTESTMODE |
|
103 friend class T_CCCAppCommLauncherPlugin; |
|
104 #endif// __COMMLAUNCHERPLUGINUNITTESTMODE |
|
105 |
|
106 public: |
|
107 |
|
108 /** |
|
109 * Two-phased constructor. |
|
110 */ |
|
111 static CCCAppCommLauncherPlugin* NewL(); |
|
112 |
|
113 /** |
|
114 * Destructor. |
|
115 */ |
|
116 ~CCCAppCommLauncherPlugin(); |
|
117 |
|
118 public: //From MCCAppPluginsContactObserver |
|
119 |
|
120 void NotifyPluginOfContactEventL(); |
|
121 |
|
122 public: |
|
123 |
|
124 // from base class CCCAppViewPluginBase |
|
125 |
|
126 /** |
|
127 * From CCCAppViewPluginBase |
|
128 */ |
|
129 void PreparePluginViewL( |
|
130 MCCAppPluginParameter& aPluginParameter ); |
|
131 |
|
132 /** |
|
133 * From CCCAppViewPluginBase |
|
134 * NEW API |
|
135 */ |
|
136 void ProvideBitmapL( |
|
137 TCCAppIconType aIconType, |
|
138 CAknIcon& aIcon ); |
|
139 |
|
140 /** |
|
141 * From CCCAppViewPluginBase |
|
142 */ |
|
143 TAny* CCCAppViewPluginBaseExtension( TUid aExtensionUid ); |
|
144 |
|
145 // from base class CAknView |
|
146 |
|
147 /** |
|
148 * From CAknView |
|
149 */ |
|
150 void DynInitMenuPaneL( |
|
151 TInt aResourceId, |
|
152 CEikMenuPane* aMenuPane ); |
|
153 |
|
154 /** |
|
155 * From CAknView |
|
156 */ |
|
157 void HandleCommandL( |
|
158 TInt aCommand ); |
|
159 |
|
160 /** |
|
161 * From CAknView |
|
162 */ |
|
163 void DoActivateL( |
|
164 const TVwsViewId& aPrevViewId, |
|
165 TUid aCustomMessageId, |
|
166 const TDesC8& aCustomMessage ); |
|
167 |
|
168 /** |
|
169 * From CAknView |
|
170 */ |
|
171 void DoDeactivate(); |
|
172 |
|
173 /** |
|
174 * From CAknView |
|
175 */ |
|
176 TUid Id() const; |
|
177 |
|
178 // from base class CCCAppViewPluginAknView |
|
179 |
|
180 /** |
|
181 * From CCCAppViewPluginAknView |
|
182 */ |
|
183 void PrepareViewResourcesL(); |
|
184 |
|
185 /** |
|
186 * From CCCAppViewPluginAknView |
|
187 */ |
|
188 void NewContainerL(); |
|
189 |
|
190 public: //From MCCAppViewPluginBase2 |
|
191 |
|
192 TBool PluginBusy(); |
|
193 |
|
194 public: // From CAknView |
|
195 void HandleForegroundEventL( TBool aForeground ); |
|
196 |
|
197 public: |
|
198 |
|
199 /** |
|
200 * Returns a pointer to preferred comm methods |
|
201 * |
|
202 * @since S60 v5.0 |
|
203 * @return pointer to preferred comm method array |
|
204 */ |
|
205 RArray<VPbkFieldTypeSelectorFactory::TVPbkContactActionTypeSelector>& |
|
206 PreferredCommMethods(); |
|
207 |
|
208 /** |
|
209 * Classes enumerated, see ErrorNotifierL() below |
|
210 * |
|
211 * @since S60 v5.0 |
|
212 */ |
|
213 enum TCCAppCommLauncherPluginErrorSource |
|
214 { |
|
215 ECCAppCommLauncherContactHandler = 1 |
|
216 }; |
|
217 |
|
218 /** |
|
219 * Error handler for errors coming from differen classes |
|
220 * |
|
221 * @since S60 v5.0 |
|
222 */ |
|
223 void ErrorNotifierL( |
|
224 TCCAppCommLauncherPluginErrorSource aErrorSource, |
|
225 TInt aError ); |
|
226 |
|
227 /** |
|
228 * For getting information if the contact is Top Contact |
|
229 * |
|
230 * @since S60 v5.0 |
|
231 * @return TBool |
|
232 */ |
|
233 TBool IsTopContactL(); |
|
234 |
|
235 /** |
|
236 * For getting information if the contact is from the contacts db |
|
237 * |
|
238 * @since S60 v5.0 |
|
239 * @return TBool |
|
240 */ |
|
241 TBool IsContactL(); |
|
242 |
|
243 /** |
|
244 * For getting reference to container-class |
|
245 * |
|
246 * @since S60 v5.0 |
|
247 * @return reference to container-class |
|
248 */ |
|
249 CCCAppCommLauncherContainer& Container(); |
|
250 |
|
251 /** |
|
252 * For getting reference to contacthandler-class |
|
253 * |
|
254 * @since S60 v5.0 |
|
255 * @return reference to contacthandler-class |
|
256 */ |
|
257 CCCAppCommLauncherContactHandler& ContactHandler(); |
|
258 |
|
259 /** |
|
260 * Helper function for get the reference |
|
261 * to container data. |
|
262 * |
|
263 * return container |
|
264 */ |
|
265 CCCAppViewPluginAknContainer& GetContainer() |
|
266 { |
|
267 return *iContainer; |
|
268 } |
|
269 |
|
270 /** |
|
271 * Returns a const pointer to contactor service. |
|
272 * Use ExecuteServiceL to run contactor service. |
|
273 */ |
|
274 const CCAContactorService* ContactorService(); |
|
275 |
|
276 /** |
|
277 * Executes the service using CCAContactorService. This must |
|
278 * be used instead of direct call to CCAContactorService to keep |
|
279 * the command running/not running state correct. |
|
280 */ |
|
281 void ExecuteServiceL(const CCAContactorService::TCSParameter& aParameter); |
|
282 |
|
283 /** |
|
284 * Start timer. |
|
285 */ |
|
286 void StartTimerL(); |
|
287 |
|
288 /** |
|
289 * Cancel timer. |
|
290 */ |
|
291 void CancelTimer(); |
|
292 |
|
293 private: // new |
|
294 |
|
295 /** |
|
296 * Initialises the preferred communication methods array. |
|
297 * |
|
298 * @since S60 v5.0 |
|
299 */ |
|
300 void InitialisePreferredCommMethods(); |
|
301 |
|
302 /** |
|
303 * Loads preferred communication methods array from CenRep. |
|
304 * |
|
305 * @since S60 v5.0 |
|
306 */ |
|
307 void LoadPreferredCommMethodsL(); |
|
308 |
|
309 /** |
|
310 * Creates menuhandler if not created already. |
|
311 * |
|
312 * @since S60 v5.0 |
|
313 */ |
|
314 void EnsureMenuHandlerCreatedL(); |
|
315 |
|
316 /** |
|
317 * Exit CCA application if it is at background when the request timeout. |
|
318 * |
|
319 */ |
|
320 void CloseCCApp(); |
|
321 |
|
322 private: // constructors |
|
323 |
|
324 CCCAppCommLauncherPlugin(); |
|
325 void ConstructL(); |
|
326 |
|
327 public: |
|
328 /* |
|
329 * Sets the title to the plugin |
|
330 * @param aTitle - title to be set |
|
331 */ |
|
332 void SetTitleL( const TDesC& aTitle ); |
|
333 |
|
334 /** |
|
335 * Sets the CBA labels. |
|
336 * @param aEditable Boolean that tells if contact has communication |
|
337 * methods or not. |
|
338 */ |
|
339 void UpdateMSKinCbaL( TBool aCommMethodsAvailable ); |
|
340 |
|
341 /** |
|
342 * Returns the command running state instance. Command state must be |
|
343 * to running before executing the command and to not running after |
|
344 * the command has completed. |
|
345 */ |
|
346 inline TCCAppCommandState& CommandState() {return iCommandState;} |
|
347 |
|
348 /** |
|
349 * Notify the timeout after sent an aiw service request. |
|
350 * |
|
351 */ |
|
352 static TInt ServiceTimeOutL( TAny* aObject ); |
|
353 |
|
354 private:// data |
|
355 |
|
356 /** |
|
357 * Pointer to contact data fetcher. |
|
358 * Own. |
|
359 */ |
|
360 CCCAppCommLauncherContactHandler* iContactHandler; |
|
361 |
|
362 |
|
363 /** |
|
364 * Pointer to preferred communication methods. |
|
365 * In case of deactivation, this is not deleted for making the new opening faster. |
|
366 * Own. |
|
367 */ |
|
368 RArray<VPbkFieldTypeSelectorFactory::TVPbkContactActionTypeSelector> |
|
369 iPreferredCommMethods; |
|
370 |
|
371 /** |
|
372 * Pointer to commlauncher's menuhandler |
|
373 * Own. |
|
374 */ |
|
375 CCCAppCommLauncherMenuHandler* iMenuHandler; |
|
376 |
|
377 /** |
|
378 * Flag if contact must be refetched. |
|
379 */ |
|
380 TBool iRefetchContact; |
|
381 |
|
382 /** |
|
383 * Pointer to contactor service. |
|
384 * Own. |
|
385 */ |
|
386 CCAContactorService* iContactorService; |
|
387 |
|
388 |
|
389 /** |
|
390 * The timer notifier an aiw service request timeout. |
|
391 * Own. |
|
392 */ |
|
393 CPeriodic* iAiwRequestTimer; |
|
394 |
|
395 /** |
|
396 * Record whether the View foreground flag. |
|
397 * Own. |
|
398 */ |
|
399 TBool iIsCcaForeground; |
|
400 |
|
401 /** |
|
402 * Timer start flag. |
|
403 * Own. |
|
404 */ |
|
405 TBool iIsTimerStart; |
|
406 |
|
407 /** |
|
408 * |
|
409 */ |
|
410 TCCAppCommandState iCommandState; |
|
411 }; |
|
412 |
|
413 #endif // C_CCAPPCOMMLAUNCHERPLUGIN_H |
|
414 |
|
415 // End of File |