|
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 |
|
170 default: |
|
171 CPhoneTwoSingles::HandlePhoneEngineMessageL( aMessage, aCallId ); |
|
172 break; |
|
173 } |
|
174 } |
|
175 |
|
176 // ----------------------------------------------------------- |
|
177 // CPhoneTwoSinglesAndWaiting::HandleErrorL |
|
178 // ----------------------------------------------------------- |
|
179 // |
|
180 EXPORT_C void CPhoneTwoSinglesAndWaiting::HandleErrorL( |
|
181 const TPEErrorInfo& aErrorInfo ) |
|
182 { |
|
183 __LOGMETHODSTARTEND( EPhoneUIStates, "CPhoneTwoSinglesAndWaiting::HandleErrorL()"); |
|
184 |
|
185 if( aErrorInfo.iErrorCode == ECCPErrorCCUserAlertingNoAnswer ) |
|
186 { |
|
187 // Should not shown "No Answer" note |
|
188 __PHONELOG1( EBasic, EPhoneUIStates, |
|
189 "PhoneUIControl: CPhoneTwoSinglesAndWaiting::HandleErrorL - aErrorInfo.iErrorCode =%d ", |
|
190 aErrorInfo.iErrorCode); |
|
191 } |
|
192 else |
|
193 { |
|
194 CPhoneState::HandleErrorL( aErrorInfo ); |
|
195 } |
|
196 } |
|
197 |
|
198 // ----------------------------------------------------------- |
|
199 // CPhoneTwoSinglesAndWaiting::OpenMenuBarL |
|
200 // ----------------------------------------------------------- |
|
201 // |
|
202 void CPhoneTwoSinglesAndWaiting::OpenMenuBarL() |
|
203 { |
|
204 __LOGMETHODSTARTEND( EPhoneUIStates, |
|
205 "CPhoneTwoSinglesAndWaiting::OpenMenuBarL()"); |
|
206 |
|
207 TInt resourceId ( EPhoneCallTwoSinglesWaitingLockMenubar ); |
|
208 |
|
209 if ( !IsAutoLockOn() ) |
|
210 { |
|
211 if ( IsNumberEntryVisibleL() ) |
|
212 { |
|
213 resourceId = EPhoneCallActiveHeldAndWaitingMenubarWithNumberEntry; |
|
214 } |
|
215 else |
|
216 { |
|
217 resourceId = EPhoneCallActiveHeldAndWaitingMenubar; |
|
218 } |
|
219 } |
|
220 |
|
221 TPhoneCmdParamInteger integerParam; |
|
222 integerParam.SetInteger( |
|
223 CPhoneMainResourceResolver::Instance()-> |
|
224 ResolveResourceID( resourceId ) ); |
|
225 iViewCommandHandle->ExecuteCommandL( EPhoneViewMenuBarOpen, |
|
226 &integerParam ); |
|
227 } |
|
228 |
|
229 // ----------------------------------------------------------- |
|
230 // CPhoneTwoSinglesAndWaiting::HandleIdleL |
|
231 // ----------------------------------------------------------- |
|
232 // |
|
233 void CPhoneTwoSinglesAndWaiting::HandleIdleL( TInt aCallId ) |
|
234 { |
|
235 __LOGMETHODSTARTEND( EPhoneUIStates, |
|
236 "CPhoneTwoSinglesAndWaiting::HandleIdleL()"); |
|
237 |
|
238 // Effect is shown when dialer exist. |
|
239 |
|
240 TBool effectStarted ( EFalse ); |
|
241 if ( !NeedToSendToBackgroundL()) |
|
242 { |
|
243 BeginTransEffectLC( ENumberEntryOpen ); |
|
244 effectStarted = ETrue; |
|
245 } |
|
246 |
|
247 BeginUiUpdateLC(); |
|
248 |
|
249 if ( !IsNumberEntryUsedL() ) |
|
250 { |
|
251 // Close menu bar, if number entry isnt open. |
|
252 iViewCommandHandle->ExecuteCommandL( EPhoneViewMenuBarClose ); |
|
253 } |
|
254 |
|
255 // Remove call |
|
256 iViewCommandHandle->ExecuteCommandL( EPhoneViewRemoveCallHeader, aCallId ); |
|
257 |
|
258 if ( iRingingCallId == aCallId ) |
|
259 { |
|
260 StateTransitionToTwoSinglesL(); |
|
261 } |
|
262 else |
|
263 { |
|
264 StateTransitionToSingleAndWaitingL(); |
|
265 } |
|
266 |
|
267 EndUiUpdate(); |
|
268 if ( effectStarted ) |
|
269 { |
|
270 EndTransEffect(); |
|
271 } |
|
272 } |
|
273 |
|
274 // ----------------------------------------------------------- |
|
275 // CPhoneTwoSinglesAndWaiting::StateTransitionToTwoSinglesL |
|
276 // ----------------------------------------------------------- |
|
277 // |
|
278 void CPhoneTwoSinglesAndWaiting::StateTransitionToTwoSinglesL() |
|
279 { |
|
280 __LOGMETHODSTARTEND( EPhoneUIStates, |
|
281 "CPhoneTwoSinglesAndWaiting::StateTransitionToTwoSinglesL()"); |
|
282 if ( IsNumberEntryUsedL() ) |
|
283 { |
|
284 // Go to background if necessary |
|
285 if ( NeedToSendToBackgroundL() ) |
|
286 { |
|
287 // Return phone to the background if send to background is needed. |
|
288 iViewCommandHandle->ExecuteCommandL( EPhoneViewSendToBackground ); |
|
289 |
|
290 iViewCommandHandle->ExecuteCommandL( EPhoneViewSetControlAndVisibility ); |
|
291 |
|
292 UpdateCbaL( EPhoneCallHandlingInCallCBA ); |
|
293 } |
|
294 else |
|
295 { |
|
296 // Show the number entry if it exists. |
|
297 SetNumberEntryVisibilityL(ETrue); |
|
298 } |
|
299 } |
|
300 else |
|
301 { |
|
302 // Set Two singles softkeys |
|
303 UpdateCbaL( EPhoneCallHandlingNewCallSwapCBA ); |
|
304 |
|
305 // If numberentry is not open just check NeedToSendToBackgroundL and |
|
306 // sendbackround if needed. |
|
307 if ( NeedToSendToBackgroundL() ) |
|
308 { |
|
309 // Return phone to the background if send to background is needed. |
|
310 iViewCommandHandle->ExecuteCommandL( EPhoneViewSendToBackground ); |
|
311 } |
|
312 } |
|
313 |
|
314 if( FeatureManager::FeatureSupported( KFeatureIdFfTouchUnlockStroke ) |
|
315 && iStateMachine->PhoneStorage()->IsScreenLocked() ) |
|
316 { |
|
317 EnableCallUIL(); |
|
318 } |
|
319 |
|
320 // Reset blocked keys list |
|
321 iStateMachine->PhoneStorage()->ResetBlockedKeysList(); |
|
322 |
|
323 // Go to two singles state |
|
324 SetTouchPaneButtonEnabled( EPhoneCallComingCmdAnswer ); |
|
325 SetTouchPaneButtons( EPhoneTwoSinglesButtons ); |
|
326 // CBA updates in above if-else conditions |
|
327 iStateMachine->ChangeState( EPhoneStateTwoSingles ); |
|
328 } |
|
329 |
|
330 // ----------------------------------------------------------- |
|
331 // CPhoneTwoSinglesAndWaiting::StateTransitionToSingleAndWaitingL |
|
332 // ----------------------------------------------------------- |
|
333 // |
|
334 void CPhoneTwoSinglesAndWaiting::StateTransitionToSingleAndWaitingL() |
|
335 { |
|
336 __LOGMETHODSTARTEND( EPhoneUIStates, |
|
337 "CPhoneTwoSinglesAndWaiting::StateTransitionToSingleAndWaitingL()"); |
|
338 // Go to two singles state |
|
339 UpdateCbaL( EPhoneCallHandlingCallWaitingCBA ); |
|
340 |
|
341 // Set touch controls |
|
342 SetTouchPaneButtonEnabled( EPhoneCallComingCmdAnswer ); |
|
343 |
|
344 // Check if HW Keys or Call UI should be disabled |
|
345 CheckDisableHWKeysAndCallUIL(); |
|
346 |
|
347 SetTouchPaneButtons( EPhoneWaitingCallButtons ); |
|
348 |
|
349 iStateMachine->ChangeState( EPhoneStateWaitingInSingle ); |
|
350 } |
|
351 |
|
352 // ----------------------------------------------------------- |
|
353 // CPhoneTwoSinglesAndWaiting::HandleConnectedConferenceL |
|
354 // ----------------------------------------------------------- |
|
355 // |
|
356 void CPhoneTwoSinglesAndWaiting::HandleConnectedConferenceL( TInt aCallId ) |
|
357 { |
|
358 __LOGMETHODSTARTEND( EPhoneUIStates, |
|
359 "CPhoneTwoSinglesAndWaiting::HandleConnectedConferenceL()"); |
|
360 BeginUiUpdateLC(); |
|
361 // Update call state |
|
362 TPhoneCmdParamCallHeaderData callHeaderParam; |
|
363 |
|
364 TInt callLabelId; |
|
365 TBuf<KPhoneCallHeaderLabelMaxLength> conferenceText( KNullDesC ); |
|
366 callLabelId = CPhoneMainResourceResolver::Instance()-> |
|
367 ResolveResourceID( EPhoneCLIConferenceCall ); |
|
368 |
|
369 StringLoader::Load( |
|
370 conferenceText, |
|
371 callLabelId, |
|
372 CCoeEnv::Static() ); |
|
373 callHeaderParam.SetCLIText( conferenceText, CBubbleManager::ERight ); |
|
374 |
|
375 callHeaderParam.SetCiphering( |
|
376 iStateMachine->PhoneEngineInfo()->IsSecureCall( aCallId ) ); |
|
377 |
|
378 callHeaderParam.SetCipheringIndicatorAllowed( |
|
379 iStateMachine->PhoneEngineInfo()->SecureSpecified() ); |
|
380 |
|
381 // Service identifier must be given so that service specific settings |
|
382 // can be taken into account at phoneuiview. |
|
383 callHeaderParam.SetServiceId( |
|
384 iStateMachine->PhoneEngineInfo()->ServiceId( aCallId ) ); |
|
385 |
|
386 // Set touch controls |
|
387 SetTouchPaneButtonEnabled( EPhoneCallComingCmdAnswer ); |
|
388 |
|
389 // Check if HW Keys or Call UI should be disabled |
|
390 CheckDisableHWKeysAndCallUIL(); |
|
391 |
|
392 SetTouchPaneButtons( EPhoneWaitingCallButtons ); |
|
393 |
|
394 iViewCommandHandle->ExecuteCommandL( EPhoneViewCreateConference, aCallId, |
|
395 &callHeaderParam ); |
|
396 |
|
397 // Clear the flag |
|
398 TPhoneCmdParamBoolean booleanParam; |
|
399 booleanParam.SetBoolean( EFalse ); |
|
400 iViewCommandHandle->ExecuteCommandL( |
|
401 EPhoneViewSetNeedToSendToBackgroundStatus, &booleanParam ); |
|
402 |
|
403 EndUiUpdate(); |
|
404 // Go to Conference And Waiting state |
|
405 // No need for CBA update |
|
406 iStateMachine->ChangeState( EPhoneStateConferenceAndWaiting ); |
|
407 } |
|
408 |
|
409 // ----------------------------------------------------------- |
|
410 // CPhoneTwoSinglesAndWaiting::UpdateInCallCbaL |
|
411 // ----------------------------------------------------------- |
|
412 // |
|
413 void CPhoneTwoSinglesAndWaiting::UpdateInCallCbaL() |
|
414 { |
|
415 __LOGMETHODSTARTEND( EPhoneUIStates, |
|
416 "CPhoneTwoSinglesAndWaiting::UpdateInCallCbaL()"); |
|
417 UpdateCbaL ( EPhoneCallHandlingCallWaitingCBA ); |
|
418 } |
|
419 |
|
420 // ----------------------------------------------------------- |
|
421 // CPhoneTwoSinglesAndWaiting::HandleNumberEntryClearedL() |
|
422 // ----------------------------------------------------------- |
|
423 // |
|
424 void CPhoneTwoSinglesAndWaiting::HandleNumberEntryClearedL() |
|
425 { |
|
426 __LOGMETHODSTARTEND( EPhoneUIStates, |
|
427 "CPhoneTwoSinglesAndWaiting::HandleNumberEntryClearedL()"); |
|
428 UpdateCbaL( EPhoneCallHandlingCallWaitingCBA ); |
|
429 } |
|
430 |
|
431 // End of File |