1 /* |
|
2 * Copyright (c) 2005 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 CPhoneTwoSinglesAndWaiting class. |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 // INCLUDES |
|
20 #include <pevirtualengine.h> |
|
21 #include <StringLoader.h> |
|
22 #include <mpeengineinfo.h> |
|
23 #include <featmgr.h> |
|
24 #include "cphonetwosinglesandwaiting.h" |
|
25 #include "tphonecmdparamboolean.h" |
|
26 #include "mphonestatemachine.h" |
|
27 #include "tphonecmdparamboolean.h" |
|
28 #include "tphonecmdparaminteger.h" |
|
29 #include "tphonecmdparamcallheaderdata.h" |
|
30 #include "tphonecmdparamglobalnote.h" |
|
31 #include "tphonecmdparamstring.h" |
|
32 #include "tphonecmdparamcallstatedata.h" |
|
33 #include "phoneviewcommanddefinitions.h" |
|
34 #include "phoneui.hrh" |
|
35 #include "cphonemainresourceresolver.h" |
|
36 #include "phonerssbase.h" |
|
37 #include "phonestatedefinitionsgsm.h" |
|
38 #include "phonelogger.h" |
|
39 #include "mphonestorage.h" |
|
40 |
|
41 // ================= MEMBER FUNCTIONS ======================= |
|
42 |
|
43 // C++ default constructor can NOT contain any code, that |
|
44 // might leave. |
|
45 // |
|
46 CPhoneTwoSinglesAndWaiting::CPhoneTwoSinglesAndWaiting( |
|
47 MPhoneStateMachine* aStateMachine, |
|
48 MPhoneViewCommandHandle* aViewCommandHandle, |
|
49 MPhoneCustomization* aPhoneCustomization ) : |
|
50 CPhoneTwoSingles( aStateMachine, aViewCommandHandle, aPhoneCustomization ) |
|
51 { |
|
52 } |
|
53 |
|
54 // ----------------------------------------------------------- |
|
55 // CPhoneTwoSinglesAndWaiting::~CPhoneTwoSinglesAndWaiting() |
|
56 // Destructor |
|
57 // (other items were commented in a header). |
|
58 // ----------------------------------------------------------- |
|
59 // |
|
60 CPhoneTwoSinglesAndWaiting::~CPhoneTwoSinglesAndWaiting() |
|
61 { |
|
62 } |
|
63 |
|
64 // ----------------------------------------------------------- |
|
65 // CPhoneTwoSinglesAndWaiting::ConstructL() |
|
66 // Constructor |
|
67 // (other items were commented in a header). |
|
68 // ----------------------------------------------------------- |
|
69 // |
|
70 void CPhoneTwoSinglesAndWaiting::ConstructL() |
|
71 { |
|
72 CPhoneTwoSingles::ConstructL(); |
|
73 |
|
74 // Fetch ringing call's id from view |
|
75 TPhoneCmdParamCallStateData callStateData; |
|
76 callStateData.SetCallState( EPEStateRinging ); |
|
77 iViewCommandHandle->HandleCommandL( |
|
78 EPhoneViewGetCallIdByState, &callStateData ); |
|
79 iRingingCallId = callStateData.CallId(); |
|
80 } |
|
81 |
|
82 // ----------------------------------------------------------- |
|
83 // CPhoneTwoSinglesAndWaiting::NewL() |
|
84 // Constructor |
|
85 // (other items were commented in a header). |
|
86 // ----------------------------------------------------------- |
|
87 // |
|
88 CPhoneTwoSinglesAndWaiting* CPhoneTwoSinglesAndWaiting::NewL( |
|
89 MPhoneStateMachine* aStateMachine, |
|
90 MPhoneViewCommandHandle* aViewCommandHandle, |
|
91 MPhoneCustomization* aPhoneCustomization ) |
|
92 { |
|
93 CPhoneTwoSinglesAndWaiting* self = new( ELeave ) CPhoneTwoSinglesAndWaiting( |
|
94 aStateMachine, aViewCommandHandle, aPhoneCustomization ); |
|
95 |
|
96 CleanupStack::PushL( self ); |
|
97 self->ConstructL(); |
|
98 CleanupStack::Pop( self ); |
|
99 |
|
100 return self; |
|
101 } |
|
102 |
|
103 // ----------------------------------------------------------- |
|
104 // CPhoneTwoSinglesAndWaiting::HandleKeyMessageL |
|
105 // ----------------------------------------------------------- |
|
106 // |
|
107 void CPhoneTwoSinglesAndWaiting::HandleKeyMessageL( |
|
108 TPhoneKeyEventMessages aMessage, |
|
109 TKeyCode aCode ) |
|
110 { |
|
111 __LOGMETHODSTARTEND( EPhoneUIStates, |
|
112 "CPhoneTwoSinglesAndWaiting::HandleKeyMessageL()"); |
|
113 switch ( aCode ) |
|
114 { |
|
115 // send-key |
|
116 case EKeyYes: |
|
117 { |
|
118 if( IsNumberEntryVisibleL() ) |
|
119 { |
|
120 CallFromNumberEntryL(); |
|
121 } |
|
122 else |
|
123 { |
|
124 // Waiting call bubble is over number entry |
|
125 // so display not allowed note because we |
|
126 // can't answer the call |
|
127 SendGlobalWarningNoteL( EPhoneNoteTextCallNotAllowed ); |
|
128 } |
|
129 break; |
|
130 } |
|
131 |
|
132 default: |
|
133 CPhoneTwoSingles::HandleKeyMessageL( aMessage, aCode ); |
|
134 break; |
|
135 } |
|
136 } |
|
137 |
|
138 // ----------------------------------------------------------- |
|
139 // CPhoneTwoSinglesAndWaiting::HandleKeyEventL |
|
140 // ----------------------------------------------------------- |
|
141 // |
|
142 void CPhoneTwoSinglesAndWaiting::HandleKeyEventL( |
|
143 const TKeyEvent& aKeyEvent, |
|
144 TEventCode /*aEventCode*/ ) |
|
145 { |
|
146 if( EKeyDeviceF == aKeyEvent.iCode ) |
|
147 { |
|
148 __PHONELOG( EBasic, EPhoneUIStates, |
|
149 "CPhoneTwoSinglesAndWaiting::HandleKeyMessageL-deviceF" ); |
|
150 HandleHoldSwitchL(); |
|
151 } |
|
152 } |
|
153 |
|
154 // ----------------------------------------------------------- |
|
155 // CPhoneTwoSinglesAndWaiting::HandlePhoneEngineMessageL |
|
156 // ----------------------------------------------------------- |
|
157 // |
|
158 void CPhoneTwoSinglesAndWaiting::HandlePhoneEngineMessageL( |
|
159 const TInt aMessage, |
|
160 TInt aCallId ) |
|
161 { |
|
162 __LOGMETHODSTARTEND( EPhoneUIStates, |
|
163 "CPhoneTwoSinglesAndWaiting::HandlePhoneEngineMessageL()"); |
|
164 switch ( aMessage ) |
|
165 { |
|
166 case MEngineMonitor::EPEMessageIdle: |
|
167 HandleIdleL( aCallId ); |
|
168 break; |
|
169 case MEngineMonitor::EPEMessageConnected: |
|
170 UpdateInCallCbaL(); |
|
171 CPhoneTwoSingles::HandlePhoneEngineMessageL( aMessage, aCallId ); |
|
172 break; |
|
173 default: |
|
174 CPhoneTwoSingles::HandlePhoneEngineMessageL( aMessage, aCallId ); |
|
175 break; |
|
176 } |
|
177 } |
|
178 |
|
179 // ----------------------------------------------------------- |
|
180 // CPhoneTwoSinglesAndWaiting::HandleErrorL |
|
181 // ----------------------------------------------------------- |
|
182 // |
|
183 EXPORT_C void CPhoneTwoSinglesAndWaiting::HandleErrorL( |
|
184 const TPEErrorInfo& aErrorInfo ) |
|
185 { |
|
186 __LOGMETHODSTARTEND( EPhoneUIStates, "CPhoneTwoSinglesAndWaiting::HandleErrorL()"); |
|
187 |
|
188 if( aErrorInfo.iErrorCode == ECCPErrorCCUserAlertingNoAnswer ) |
|
189 { |
|
190 // Should not shown "No Answer" note |
|
191 __PHONELOG1( EBasic, EPhoneUIStates, |
|
192 "PhoneUIControl: CPhoneTwoSinglesAndWaiting::HandleErrorL - aErrorInfo.iErrorCode =%d ", |
|
193 aErrorInfo.iErrorCode); |
|
194 } |
|
195 else |
|
196 { |
|
197 CPhoneState::HandleErrorL( aErrorInfo ); |
|
198 } |
|
199 } |
|
200 |
|
201 // ----------------------------------------------------------- |
|
202 // CPhoneTwoSinglesAndWaiting::OpenMenuBarL |
|
203 // ----------------------------------------------------------- |
|
204 // |
|
205 void CPhoneTwoSinglesAndWaiting::OpenMenuBarL() |
|
206 { |
|
207 __LOGMETHODSTARTEND( EPhoneUIStates, |
|
208 "CPhoneTwoSinglesAndWaiting::OpenMenuBarL()"); |
|
209 |
|
210 TInt resourceId ( EPhoneCallTwoSinglesWaitingLockMenubar ); |
|
211 |
|
212 if ( !IsAutoLockOn() ) |
|
213 { |
|
214 if ( IsNumberEntryVisibleL() ) |
|
215 { |
|
216 resourceId = EPhoneCallActiveHeldAndWaitingMenubarWithNumberEntry; |
|
217 } |
|
218 else |
|
219 { |
|
220 resourceId = EPhoneCallActiveHeldAndWaitingMenubar; |
|
221 } |
|
222 } |
|
223 |
|
224 TPhoneCmdParamInteger integerParam; |
|
225 integerParam.SetInteger( |
|
226 CPhoneMainResourceResolver::Instance()-> |
|
227 ResolveResourceID( resourceId ) ); |
|
228 iViewCommandHandle->ExecuteCommandL( EPhoneViewMenuBarOpen, |
|
229 &integerParam ); |
|
230 } |
|
231 |
|
232 // ----------------------------------------------------------- |
|
233 // CPhoneTwoSinglesAndWaiting::HandleIdleL |
|
234 // ----------------------------------------------------------- |
|
235 // |
|
236 void CPhoneTwoSinglesAndWaiting::HandleIdleL( TInt aCallId ) |
|
237 { |
|
238 __LOGMETHODSTARTEND( EPhoneUIStates, |
|
239 "CPhoneTwoSinglesAndWaiting::HandleIdleL()"); |
|
240 |
|
241 // Effect is shown when dialer exist. |
|
242 |
|
243 TBool effectStarted ( EFalse ); |
|
244 if ( !NeedToSendToBackgroundL()) |
|
245 { |
|
246 BeginTransEffectLC( ENumberEntryOpen ); |
|
247 effectStarted = ETrue; |
|
248 } |
|
249 |
|
250 BeginUiUpdateLC(); |
|
251 |
|
252 if ( !IsNumberEntryUsedL() ) |
|
253 { |
|
254 // Close menu bar, if number entry isnt open. |
|
255 iViewCommandHandle->ExecuteCommandL( EPhoneViewMenuBarClose ); |
|
256 } |
|
257 |
|
258 // Remove call |
|
259 iViewCommandHandle->ExecuteCommandL( EPhoneViewRemoveCallHeader, aCallId ); |
|
260 |
|
261 if ( iRingingCallId == aCallId ) |
|
262 { |
|
263 StateTransitionToTwoSinglesL(); |
|
264 } |
|
265 else |
|
266 { |
|
267 StateTransitionToSingleAndWaitingL(); |
|
268 } |
|
269 |
|
270 EndUiUpdate(); |
|
271 if ( effectStarted ) |
|
272 { |
|
273 EndTransEffect(); |
|
274 } |
|
275 } |
|
276 |
|
277 // ----------------------------------------------------------- |
|
278 // CPhoneTwoSinglesAndWaiting::StateTransitionToTwoSinglesL |
|
279 // ----------------------------------------------------------- |
|
280 // |
|
281 void CPhoneTwoSinglesAndWaiting::StateTransitionToTwoSinglesL() |
|
282 { |
|
283 __LOGMETHODSTARTEND( EPhoneUIStates, |
|
284 "CPhoneTwoSinglesAndWaiting::StateTransitionToTwoSinglesL()"); |
|
285 if ( IsNumberEntryUsedL() ) |
|
286 { |
|
287 // Go to background if necessary |
|
288 if ( NeedToSendToBackgroundL() ) |
|
289 { |
|
290 // Return phone to the background if send to background is needed. |
|
291 iViewCommandHandle->ExecuteCommandL( EPhoneViewSendToBackground ); |
|
292 |
|
293 iViewCommandHandle->ExecuteCommandL( EPhoneViewSetControlAndVisibility ); |
|
294 |
|
295 UpdateCbaL( EPhoneCallHandlingInCallCBA ); |
|
296 } |
|
297 else |
|
298 { |
|
299 // Show the number entry if it exists. |
|
300 SetNumberEntryVisibilityL(ETrue); |
|
301 } |
|
302 } |
|
303 else |
|
304 { |
|
305 // Set Two singles softkeys |
|
306 UpdateCbaL( EPhoneCallHandlingNewCallSwapCBA ); |
|
307 |
|
308 // If numberentry is not open just check NeedToSendToBackgroundL and |
|
309 // sendbackround if needed. |
|
310 if ( NeedToSendToBackgroundL() ) |
|
311 { |
|
312 // Return phone to the background if send to background is needed. |
|
313 iViewCommandHandle->ExecuteCommandL( EPhoneViewSendToBackground ); |
|
314 } |
|
315 } |
|
316 |
|
317 if( FeatureManager::FeatureSupported( KFeatureIdFfTouchUnlockStroke ) |
|
318 && iStateMachine->PhoneStorage()->IsScreenLocked() ) |
|
319 { |
|
320 EnableCallUIL(); |
|
321 } |
|
322 |
|
323 // Reset blocked keys list |
|
324 iStateMachine->PhoneStorage()->ResetBlockedKeysList(); |
|
325 |
|
326 // Go to two singles state |
|
327 SetTouchPaneButtonEnabled( EPhoneCallComingCmdAnswer ); |
|
328 SetTouchPaneButtons( EPhoneTwoSinglesButtons ); |
|
329 // CBA updates in above if-else conditions |
|
330 iStateMachine->ChangeState( EPhoneStateTwoSingles ); |
|
331 } |
|
332 |
|
333 // ----------------------------------------------------------- |
|
334 // CPhoneTwoSinglesAndWaiting::StateTransitionToSingleAndWaitingL |
|
335 // ----------------------------------------------------------- |
|
336 // |
|
337 void CPhoneTwoSinglesAndWaiting::StateTransitionToSingleAndWaitingL() |
|
338 { |
|
339 __LOGMETHODSTARTEND( EPhoneUIStates, |
|
340 "CPhoneTwoSinglesAndWaiting::StateTransitionToSingleAndWaitingL()"); |
|
341 // Go to two singles state |
|
342 TPhoneCmdParamInteger callIdParam; |
|
343 iViewCommandHandle->ExecuteCommandL( |
|
344 EPhoneViewGetExpandedBubbleCallId, &callIdParam ); |
|
345 |
|
346 if ( callIdParam.Integer()!=iRingingCallId ) |
|
347 { |
|
348 CPhoneGsmInCall::UpdateInCallCbaL(); |
|
349 } |
|
350 else |
|
351 { |
|
352 iCbaManager->SetCbaL( EPhoneCallHandlingCallWaitingCBA ); |
|
353 } |
|
354 |
|
355 // Set touch controls |
|
356 SetTouchPaneButtonEnabled( EPhoneCallComingCmdAnswer ); |
|
357 |
|
358 // Check if HW Keys or Call UI should be disabled |
|
359 CheckDisableHWKeysAndCallUIL(); |
|
360 |
|
361 SetTouchPaneButtons( EPhoneWaitingCallButtons ); |
|
362 |
|
363 iStateMachine->ChangeState( EPhoneStateWaitingInSingle ); |
|
364 } |
|
365 |
|
366 // ----------------------------------------------------------- |
|
367 // CPhoneTwoSinglesAndWaiting::HandleConnectedConferenceL |
|
368 // ----------------------------------------------------------- |
|
369 // |
|
370 void CPhoneTwoSinglesAndWaiting::HandleConnectedConferenceL( TInt aCallId ) |
|
371 { |
|
372 __LOGMETHODSTARTEND( EPhoneUIStates, |
|
373 "CPhoneTwoSinglesAndWaiting::HandleConnectedConferenceL()"); |
|
374 BeginUiUpdateLC(); |
|
375 // Update call state |
|
376 TPhoneCmdParamCallHeaderData callHeaderParam; |
|
377 |
|
378 TInt callLabelId; |
|
379 TBuf<KPhoneCallHeaderLabelMaxLength> conferenceText( KNullDesC ); |
|
380 callLabelId = CPhoneMainResourceResolver::Instance()-> |
|
381 ResolveResourceID( EPhoneCLIConferenceCall ); |
|
382 |
|
383 StringLoader::Load( |
|
384 conferenceText, |
|
385 callLabelId, |
|
386 CCoeEnv::Static() ); |
|
387 callHeaderParam.SetCLIText( conferenceText, TPhoneCmdParamCallHeaderData::ERight ); |
|
388 |
|
389 callHeaderParam.SetCallState(EPEStateConnectedConference); |
|
390 |
|
391 callHeaderParam.SetCiphering( |
|
392 iStateMachine->PhoneEngineInfo()->IsSecureCall( aCallId ) ); |
|
393 |
|
394 callHeaderParam.SetCipheringIndicatorAllowed( |
|
395 iStateMachine->PhoneEngineInfo()->SecureSpecified() ); |
|
396 |
|
397 // Service identifier must be given so that service specific settings |
|
398 // can be taken into account at phoneuiview. |
|
399 callHeaderParam.SetServiceId( |
|
400 iStateMachine->PhoneEngineInfo()->ServiceId( aCallId ) ); |
|
401 |
|
402 // Check if HW Keys or Call UI should be disabled |
|
403 CheckDisableHWKeysAndCallUIL(); |
|
404 |
|
405 |
|
406 iViewCommandHandle->ExecuteCommandL( EPhoneViewCreateConference, aCallId, |
|
407 &callHeaderParam ); |
|
408 |
|
409 // Clear the flag |
|
410 TPhoneCmdParamBoolean booleanParam; |
|
411 booleanParam.SetBoolean( EFalse ); |
|
412 iViewCommandHandle->ExecuteCommandL( |
|
413 EPhoneViewSetNeedToSendToBackgroundStatus, &booleanParam ); |
|
414 |
|
415 // Set touch controls |
|
416 SetTouchPaneButtonEnabled( EPhoneCallComingCmdAnswer ); |
|
417 SetTouchPaneButtons( EPhoneWaitingCallButtons ); |
|
418 |
|
419 UpdateCbaL( EPhoneCallHandlingCallWaitingCBA ); |
|
420 |
|
421 EndUiUpdate(); |
|
422 // Go to Conference And Waiting state |
|
423 // No need for CBA update |
|
424 iStateMachine->ChangeState( EPhoneStateConferenceAndWaiting ); |
|
425 } |
|
426 |
|
427 // ----------------------------------------------------------- |
|
428 // CPhoneTwoSinglesAndWaiting::UpdateInCallCbaL |
|
429 // ----------------------------------------------------------- |
|
430 // |
|
431 void CPhoneTwoSinglesAndWaiting::UpdateInCallCbaL() |
|
432 { |
|
433 __LOGMETHODSTARTEND( EPhoneUIStates, |
|
434 "CPhoneTwoSinglesAndWaiting::UpdateInCallCbaL()"); |
|
435 |
|
436 TPhoneCmdParamInteger callIdParam; |
|
437 iViewCommandHandle->ExecuteCommandL( |
|
438 EPhoneViewGetExpandedBubbleCallId, &callIdParam ); |
|
439 |
|
440 if ( callIdParam.Integer()!=iRingingCallId ) |
|
441 { |
|
442 CPhoneGsmInCall::UpdateInCallCbaL(); |
|
443 } |
|
444 else |
|
445 { |
|
446 iCbaManager->SetCbaL( EPhoneCallHandlingIncomingRejectCBA ); |
|
447 } |
|
448 } |
|
449 |
|
450 // ----------------------------------------------------------- |
|
451 // CPhoneTwoSinglesAndWaiting::HandleNumberEntryClearedL() |
|
452 // ----------------------------------------------------------- |
|
453 // |
|
454 void CPhoneTwoSinglesAndWaiting::HandleNumberEntryClearedL() |
|
455 { |
|
456 __LOGMETHODSTARTEND( EPhoneUIStates, |
|
457 "CPhoneTwoSinglesAndWaiting::HandleNumberEntryClearedL()"); |
|
458 UpdateCbaL( EPhoneCallHandlingCallWaitingCBA ); |
|
459 } |
|
460 |
|
461 // ----------------------------------------------------------- |
|
462 // CPhoneTwoSinglesAndWaiting::HandleCommandL |
|
463 // ----------------------------------------------------------- |
|
464 // |
|
465 TBool CPhoneTwoSinglesAndWaiting::HandleCommandL( TInt aCommand ) |
|
466 { |
|
467 __LOGMETHODSTARTEND( EPhoneUIStates, |
|
468 "CPhoneTwoSinglesAndWaiting::HandleCommandL() "); |
|
469 TBool commandStatus = ETrue; |
|
470 |
|
471 switch( aCommand ) |
|
472 { |
|
473 case EPhoneCmdUpdateUiControls: |
|
474 UpdateUiControlsL(); |
|
475 break; |
|
476 |
|
477 default: |
|
478 commandStatus = CPhoneGsmInCall::HandleCommandL( aCommand ); |
|
479 break; |
|
480 } |
|
481 |
|
482 return commandStatus; |
|
483 } |
|
484 |
|
485 // ----------------------------------------------------------- |
|
486 // CPhoneTwoSinglesAndWaiting::UpdateUiControlsL |
|
487 // ----------------------------------------------------------- |
|
488 // |
|
489 void CPhoneTwoSinglesAndWaiting::UpdateUiControlsL() |
|
490 { |
|
491 __LOGMETHODSTARTEND( EPhoneUIStates, "CPhoneSingleAndWaiting::UpdateUiControlsL( ) "); |
|
492 UpdateInCallCbaL(); |
|
493 } |
|
494 |
|
495 // End of File |
|