|
1 /* |
|
2 * Copyright (c) 2008-2009 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 CPhoneCustomizationVoip class. |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 // INCLUDES |
|
20 #include <eikmenup.h> |
|
21 #include <spsettings.h> |
|
22 #include <spentry.h> |
|
23 #include <spproperty.h> |
|
24 #include <mpeengineinfo.h> |
|
25 #include <bmbubblemanager.h> |
|
26 #include <phoneui.rsg> |
|
27 #include <avkon.rsg> |
|
28 #include <phoneuivoip.rsg> |
|
29 #include <StringLoader.h> |
|
30 #include <featmgr.h> |
|
31 |
|
32 #include "cphonecustomizationvoip.h" |
|
33 #include "tphonecmdparaminteger.h" |
|
34 #include "tphonecmdparamboolean.h" |
|
35 #include "tphonecmdparamstring.h" |
|
36 #include "cphonemainresourceresolver.h" |
|
37 #include "mphonestatemachine.h" |
|
38 #include "cphonelogger.h" |
|
39 #include "cphonecenrepproxy.h" |
|
40 #include "phoneui.pan" |
|
41 #include "mphoneviewcommandhandle.h" |
|
42 #include "tphonecmdparamdynmenu.h" |
|
43 #include "phoneappvoipcommands.hrh" |
|
44 #include "phonerssvoip.h" |
|
45 #include "tphonecmdparamcallstatedata.h" |
|
46 #include "tphonecmdparamquery.h" |
|
47 #include "tphonecmdparamcallheaderdata.h" |
|
48 #include "cphoneextensionhandler.h" |
|
49 #include "cphonestate.h" |
|
50 #include "tphonecmdparamglobalnote.h" |
|
51 #include "cphonestatemachinevoip.h" |
|
52 #include "cphonevoiperrormessageshandler.h" |
|
53 #include "cphoneviewcustomizationvoip.h" |
|
54 #include "cphonestateutilsvoip.h" |
|
55 #include "cphoneunattendedtransfercmdhandler.h" |
|
56 #include "tphonecmdparampointer.h" |
|
57 #include "cphonenewcallcmdhandler.h" |
|
58 #include "cphonevcchandler.h" |
|
59 #include "cphonecallforwardqueryhandler.h" |
|
60 #include "cphonekeys.h" |
|
61 |
|
62 // CONSTANTS |
|
63 const TInt KMaxLengthForSIPURIFirstLine = 15; |
|
64 const TInt KMaxLengthForSIPURITwoLines = 30; |
|
65 const TInt KMaxLengthForSIPURI = 256; |
|
66 |
|
67 _LIT( KVoipAt, "@" ); |
|
68 |
|
69 // ================= MEMBER FUNCTIONS ======================= |
|
70 |
|
71 // C++ default constructor can NOT contain any code, that |
|
72 // might leave. |
|
73 // |
|
74 CPhoneCustomizationVoip::CPhoneCustomizationVoip( |
|
75 MPhoneStateMachine& aStateMachine, |
|
76 MPhoneViewCommandHandle& aViewCommandHandle ) : |
|
77 iCoeEnv( *CCoeEnv::Static() ), |
|
78 iStateMachine( aStateMachine ), |
|
79 iViewCommandHandle( aViewCommandHandle ) |
|
80 { |
|
81 } |
|
82 |
|
83 |
|
84 // ----------------------------------------------------------- |
|
85 // CPhoneCustomizationVoip::~CPhoneCustomizationVoip() |
|
86 // Destructor |
|
87 // ----------------------------------------------------------- |
|
88 // |
|
89 CPhoneCustomizationVoip::~CPhoneCustomizationVoip() |
|
90 { |
|
91 delete iCallForwardHandler; |
|
92 delete iExtensionHandler; |
|
93 delete iPhoneViewCustomization; |
|
94 delete iTransferCmdHandler; |
|
95 delete iNewCallCmdHandler; |
|
96 delete iVccHandler; |
|
97 } |
|
98 |
|
99 |
|
100 // ----------------------------------------------------------- |
|
101 // CPhoneCustomizationVoip::ConstructL() |
|
102 // Constructor |
|
103 // ----------------------------------------------------------- |
|
104 // |
|
105 void CPhoneCustomizationVoip::ConstructL() |
|
106 { |
|
107 // Set view customization |
|
108 iPhoneViewCustomization = CPhoneViewCustomizationVoip::NewL( *this ); |
|
109 TPhoneCmdParamPointer pointerParam; |
|
110 pointerParam.SetPointer( |
|
111 static_cast<MPhoneViewCustomization*>( iPhoneViewCustomization ) ); |
|
112 iViewCommandHandle.ExecuteCommand( EPhoneViewSetViewCustomization, |
|
113 &pointerParam ); |
|
114 // Set touch button customization |
|
115 pointerParam.SetPointer( |
|
116 static_cast<MPhoneButtonCustomization*>( this ) ); |
|
117 iViewCommandHandle.ExecuteCommand( EPhoneViewSetButtonCustomization, |
|
118 &pointerParam ); |
|
119 |
|
120 // Set phone customization |
|
121 pointerParam.SetPointer( static_cast<MPhoneCustomization*>( this ) ); |
|
122 iViewCommandHandle.ExecuteCommand( EPhoneViewSetPhoneCustomization, |
|
123 &pointerParam ); |
|
124 |
|
125 iExtensionHandler = CPhoneExtensionHandler::NewL(); |
|
126 iTransferCmdHandler = CPhoneUnattendedTransferCmdHandler::NewL( |
|
127 iStateMachine, iViewCommandHandle ); |
|
128 |
|
129 iNewCallCmdHandler = CPhoneNewCallCmdHandler::NewL( |
|
130 iStateMachine, iViewCommandHandle ); |
|
131 |
|
132 if ( FeatureManager::FeatureSupported( KFeatureIdFfVoiceCallContinuity ) ) |
|
133 { |
|
134 iVccHandler = CPhoneVccHandler::NewL( iStateMachine, iViewCommandHandle ); |
|
135 } |
|
136 |
|
137 iCallForwardHandler = CPhoneCallForwardQueryHandler::NewL( |
|
138 iStateMachine, iViewCommandHandle ); |
|
139 } |
|
140 |
|
141 |
|
142 // ----------------------------------------------------------- |
|
143 // CPhoneCustomizationVoip::NewL() |
|
144 // Constructor |
|
145 // ----------------------------------------------------------- |
|
146 // |
|
147 CPhoneCustomizationVoip* CPhoneCustomizationVoip::NewL( |
|
148 MPhoneStateMachine& aStateMachine, |
|
149 MPhoneViewCommandHandle& aViewCommandHandle ) |
|
150 { |
|
151 CPhoneCustomizationVoip* self = new (ELeave) CPhoneCustomizationVoip( |
|
152 aStateMachine, |
|
153 aViewCommandHandle ); |
|
154 |
|
155 CleanupStack::PushL( self ); |
|
156 self->ConstructL(); |
|
157 CleanupStack::Pop( self ); |
|
158 |
|
159 return self; |
|
160 } |
|
161 |
|
162 |
|
163 // ----------------------------------------------------------- |
|
164 // From class MPhoneCustomization. |
|
165 // CPhoneCustomizationVoip::CustomizeMenuBarL |
|
166 // ----------------------------------------------------------- |
|
167 // |
|
168 void CPhoneCustomizationVoip::CustomizeMenuBarL( |
|
169 TInt aResourceId, CEikMenuBar* aMenuBar ) |
|
170 { |
|
171 __LOGMETHODSTARTEND( PhoneUIVoIPExtension, |
|
172 "CPhoneCustomizationVoip::CustomizeMenuBarL" ); |
|
173 |
|
174 if ( 0 == aResourceId || !aMenuBar ) |
|
175 { |
|
176 __ASSERT_DEBUG( EFalse, Panic( EPhoneCtrlParameterNotInitialized ) ); |
|
177 } |
|
178 } |
|
179 |
|
180 |
|
181 // ----------------------------------------------------------- |
|
182 // From class MPhoneCustomization. |
|
183 // CPhoneCustomizationVoip::CustomizeMenuPaneL |
|
184 // ----------------------------------------------------------- |
|
185 // |
|
186 void CPhoneCustomizationVoip::CustomizeMenuPaneL( |
|
187 TInt aResourceId, CEikMenuPane* aMenuPane) |
|
188 { |
|
189 __LOGMETHODSTARTEND( PhoneUIVoIPExtension, |
|
190 "CPhoneCustomizationVoip::CustomizeMenuPaneL" ); |
|
191 |
|
192 CEikMenuPane* menuPane = aMenuPane; |
|
193 RArray<TInt> menuItemArray; |
|
194 CleanupClosePushL( menuItemArray ); |
|
195 |
|
196 // Menu items to array |
|
197 TInt menuItemCount = menuPane->NumberOfItemsInPane(); |
|
198 for ( TInt i( 0 ); i < menuItemCount; i++ ) |
|
199 { |
|
200 menuItemArray.Append( menuPane->MenuItemCommandId( i ) ); |
|
201 } |
|
202 |
|
203 // Menu items to be deleted |
|
204 for ( TInt i( 0 ); i < menuItemArray.Count(); i++ ) |
|
205 { |
|
206 switch( menuItemArray[ i ] ) |
|
207 { |
|
208 case EPhoneDialerCmdTouchInput: |
|
209 { |
|
210 if ( !AllowAlphaNumericMode() ) |
|
211 { |
|
212 menuPane->DeleteMenuItem( menuItemArray[ i ] ); |
|
213 } |
|
214 break; |
|
215 } |
|
216 case EPhoneInCallCmdTransfer: |
|
217 { |
|
218 if ( ! IsFeatureSupported( EFeatureTransfer ) ) |
|
219 { |
|
220 menuPane->DeleteMenuItem( menuItemArray[ i ] ); |
|
221 } |
|
222 break; |
|
223 } |
|
224 case EPhoneInCallCmdCreateConference: |
|
225 { |
|
226 if ( ! IsFeatureSupported( EFeatureConference ) ) |
|
227 { |
|
228 menuPane->DeleteMenuItem( menuItemArray[ i ] ); |
|
229 } |
|
230 break; |
|
231 } |
|
232 case EPhoneInCallCmdNewCall: |
|
233 { |
|
234 if ( !FeatureManager::FeatureSupported( KFeatureIdOnScreenDialer ) && |
|
235 AllowAlphaNumericMode() && |
|
236 R_PHONEUI_NEW_CALL_MENU_VOIP != aResourceId ) |
|
237 { |
|
238 |
|
239 menuPane->DeleteMenuItem( menuItemArray[ i ] ); |
|
240 |
|
241 HBufC* string = StringLoader::LoadLC( |
|
242 CPhoneMainResourceResolver::Instance()-> |
|
243 ResolveResourceID( EPhoneVoIPNewCallMenuOption ) ); |
|
244 |
|
245 CEikMenuPaneItem::SData data; |
|
246 data.iCascadeId=R_PHONEUI_NEW_CALL_MENU_VOIP; //r_phoneui_new_call_menu_voip |
|
247 data.iText = *string; |
|
248 data.iFlags=0; |
|
249 data.iCommandId = 0; |
|
250 |
|
251 menuPane->InsertMenuItemL( data, i ); |
|
252 |
|
253 CleanupStack::PopAndDestroy( string ); |
|
254 } |
|
255 break; |
|
256 } |
|
257 default: |
|
258 break; |
|
259 } |
|
260 } |
|
261 |
|
262 CleanupStack::PopAndDestroy( &menuItemArray ); |
|
263 |
|
264 // Added HO menu items if needed |
|
265 AddHandoverMenuItemIfNeededL( aResourceId, *aMenuPane ); |
|
266 |
|
267 if ( iViewCommandHandle.HandleCommandL( |
|
268 EPhoneViewGetNumberEntryIsVisibleStatus ) != |
|
269 EPhoneViewResponseSuccess ) |
|
270 { |
|
271 // Handle call menu without dialer/number entry |
|
272 TRAP_IGNORE( ModifyInCallMenuL( aResourceId, *aMenuPane ) ); |
|
273 } |
|
274 else |
|
275 { |
|
276 // Handle dialer/number entry options menu modification |
|
277 ModifyNumberAcquisitionMenuL( aResourceId, *aMenuPane ); |
|
278 } |
|
279 } |
|
280 |
|
281 |
|
282 // ----------------------------------------------------------- |
|
283 // From class MPhoneCustomization. |
|
284 // CPhoneCustomizationVoip::ModifyCallHeaderTexts |
|
285 // Formats and fits VoIP address and possible display name into two lines to |
|
286 // be shown on a call bubble. These two lines are placed on CLI and CNAP |
|
287 // fields of the TPhoneCmdParamCallHeaderData. In a call bubble CLI-field is |
|
288 // placed as a first line and CNAP-field is placed as a second line. |
|
289 // ----------------------------------------------------------- |
|
290 // |
|
291 void CPhoneCustomizationVoip::ModifyCallHeaderTexts( TInt aCallId, |
|
292 TPhoneCmdParamCallHeaderData* aCommandParam, |
|
293 const TDesC& /*aInCallNumberText*/ ) |
|
294 { |
|
295 __LOGMETHODSTARTEND( PhoneUIVoIPExtension, |
|
296 "CPhoneCustomizationVoip::ModifyCallHeaderTexts" ); |
|
297 |
|
298 MPEEngineInfo& engineInfo = *iStateMachine.PhoneEngineInfo(); |
|
299 |
|
300 if ( EPECallTypeVoIP == engineInfo.CallType( aCallId ) ) |
|
301 { |
|
302 const TBool contactInfoAvailable = |
|
303 engineInfo.RemoteName( aCallId ).Length() || |
|
304 engineInfo.RemoteCompanyName( aCallId ).Length(); |
|
305 |
|
306 if ( EPEStateRinging == aCommandParam->CallState() && |
|
307 !contactInfoAvailable ) |
|
308 { |
|
309 if ( KNullDesC() != engineInfo.RemotePartyName( aCallId ) ) |
|
310 { |
|
311 // Telephone UI specification, 4.2.1 Call identification: |
|
312 // display name is used as the CLI if available. |
|
313 aCommandParam->SetCLIText( |
|
314 engineInfo.RemotePartyName( aCallId ), |
|
315 CBubbleManager::ERight ); |
|
316 // use line reserved for CNAP to show SIP URI |
|
317 aCommandParam->SetCNAPText( |
|
318 engineInfo.RemotePhoneNumber( aCallId ), |
|
319 CBubbleManager::ERight ); |
|
320 } |
|
321 else if( KNullDesC() != engineInfo.RemotePhoneNumber( aCallId ) ) |
|
322 { |
|
323 // Fit address to two rows if it doesnt fit to one |
|
324 TBuf<KMaxLengthForSIPURI> sipURI; |
|
325 TBuf<KMaxLengthForSIPURI> sipURIDomainPart; |
|
326 HandleURIFittingToCallBubble( |
|
327 aCommandParam->CLIText(), |
|
328 sipURI, |
|
329 sipURIDomainPart ); |
|
330 |
|
331 aCommandParam->SetCLIText( sipURI, CBubbleManager::ERight ); |
|
332 aCommandParam->SetCNAPText( |
|
333 sipURIDomainPart, |
|
334 CBubbleManager::ERight ); |
|
335 } |
|
336 else |
|
337 { |
|
338 // No address or display name specified |
|
339 // Do nothing |
|
340 } |
|
341 } |
|
342 else |
|
343 { |
|
344 // Change clipping direction |
|
345 aCommandParam->SetCLIText( |
|
346 aCommandParam->CLIText(), |
|
347 CBubbleManager::ERight ); |
|
348 |
|
349 // Change clipping direction |
|
350 aCommandParam->SetCNAPText( |
|
351 aCommandParam->CNAPText(), |
|
352 CBubbleManager::ERight ); |
|
353 } |
|
354 } |
|
355 } |
|
356 |
|
357 |
|
358 // ----------------------------------------------------------- |
|
359 // From class MPhoneCustomization. |
|
360 // CPhoneCustomizationVoip::HandleCommandL |
|
361 // ----------------------------------------------------------- |
|
362 // |
|
363 TBool CPhoneCustomizationVoip::HandleCommandL( TInt aCommand ) |
|
364 { |
|
365 __LOGMETHODSTARTEND( PhoneUIVoIPExtension, |
|
366 "CPhoneCustomizationVoip::HandleCommandL" ); |
|
367 |
|
368 TBool handled( EFalse ); |
|
369 switch( aCommand ) |
|
370 { |
|
371 case EPhoneNumberAcqCmdInternetCall: |
|
372 { |
|
373 StateUtils().SelectServiceAndDialL(); |
|
374 handled = ETrue; |
|
375 } |
|
376 break; |
|
377 case EPhoneInCallCmdNewInternetCall: |
|
378 case EPhoneCmdNewInternetCallOk: |
|
379 case EPhoneCmdNewInternetCallSearch: |
|
380 case EPhoneCmdNewInternetCallContactFetch: |
|
381 { |
|
382 iNewCallCmdHandler->HandleCommandL( aCommand ); |
|
383 handled = ETrue; |
|
384 } |
|
385 break; |
|
386 case EPhoneInCallCmdUnattendedTransfer: |
|
387 case EPhoneCmdTransferDialerOk: |
|
388 case EPhoneCmdTransferDialerExit: |
|
389 case EPhoneCmdTransferDialerSearch: |
|
390 case EPhoneCmdTransferDialerContactFetch: |
|
391 // intended fall-through |
|
392 iTransferCmdHandler->HandleCommandL( aCommand ); |
|
393 handled = ETrue; |
|
394 break; |
|
395 case EPhoneCmdCancelServiceEnabling: |
|
396 { |
|
397 iStateMachine.SendPhoneEngineMessage( |
|
398 MPEPhoneModel::EPEMessageDisableService ); |
|
399 handled = ETrue; |
|
400 } |
|
401 break; |
|
402 case EPhoneCmdServiceEnablingTimedOut: |
|
403 { |
|
404 iStateMachine.SendPhoneEngineMessage( |
|
405 MPEPhoneModel::EPEMessageDisableService ); |
|
406 |
|
407 TUint32 serviceId = |
|
408 iStateMachine.PhoneEngineInfo()->ServiceIdCommand(); |
|
409 static_cast<CPhoneStateMachineVoIP&>( iStateMachine ). |
|
410 VoipErrorMessageHandler().ShowErrorNoteWithServiceNameL( |
|
411 EPhoneVoIPServiceUnavailable, serviceId ); |
|
412 |
|
413 handled = ETrue; |
|
414 } |
|
415 break; |
|
416 |
|
417 case EPhoneCmdHandoverToGsm: |
|
418 iVccHandler->StartManualHandoverL( EPhoneVoIPWaitHandoverFromWlan ); |
|
419 handled = ETrue; |
|
420 break; |
|
421 |
|
422 |
|
423 case EPhoneCmdHandoverToWlan: |
|
424 iVccHandler->StartManualHandoverL( EPhoneVoIPWaitHandoverFromGsm ); |
|
425 handled = ETrue; |
|
426 break; |
|
427 |
|
428 default: |
|
429 { |
|
430 RArray<CTelMenuExtension::TCallInfo> array; |
|
431 CleanupClosePushL( array ); |
|
432 GetActiveCallArrayL( array ); |
|
433 |
|
434 // Let extensions handle custom commands |
|
435 TRAP_IGNORE( handled = iExtensionHandler->HandleCommandL( |
|
436 ServiceIdForActivestCallL( array ), |
|
437 aCommand ) ); |
|
438 |
|
439 CleanupStack::PopAndDestroy( &array ); |
|
440 } |
|
441 break; |
|
442 } |
|
443 |
|
444 return handled; |
|
445 } |
|
446 |
|
447 |
|
448 // ----------------------------------------------------------- |
|
449 // From class MPhoneCustomization. |
|
450 // CPhoneCustomizationVoip::AllowAlphaNumericMode |
|
451 // ----------------------------------------------------------- |
|
452 // |
|
453 TBool CPhoneCustomizationVoip::AllowAlphaNumericMode() |
|
454 { |
|
455 __LOGMETHODSTARTEND( PhoneUIVoIPExtension, |
|
456 "CPhoneCustomizationVoip::AllowAlphaNumericMode" ); |
|
457 |
|
458 TBool alphaModeSupported( EFalse ); |
|
459 TRAP_IGNORE( alphaModeSupported = VoIPSupportedL() ); |
|
460 |
|
461 return alphaModeSupported; |
|
462 } |
|
463 |
|
464 |
|
465 // ----------------------------------------------------------- |
|
466 // From class MPhoneCustomization. |
|
467 // CPhoneCustomizationVoip::CustomizeSoftKeys |
|
468 // ----------------------------------------------------------- |
|
469 // |
|
470 TInt CPhoneCustomizationVoip::CustomizeSoftKeys() |
|
471 { |
|
472 __LOGMETHODSTARTEND( PhoneUIVoIPExtension, |
|
473 "CPhoneCustomizationVoip::CustomizeSoftKeys" ); |
|
474 |
|
475 return CPhoneMainResourceResolver::Instance()-> |
|
476 ResolveResourceID( EPhoneVoIPNumberAcqInternetSoftkey ); |
|
477 } |
|
478 |
|
479 |
|
480 // ----------------------------------------------------------- |
|
481 // From class MPhoneCustomization. |
|
482 // CPhoneCustomizationVoip::CustomizeCallHeaderText |
|
483 // ----------------------------------------------------------- |
|
484 // |
|
485 TInt CPhoneCustomizationVoip::CustomizeCallHeaderText() |
|
486 { |
|
487 __LOGMETHODSTARTEND( PhoneUIVoIPExtension, |
|
488 "CPhoneCustomizationVoip::CustomizeCallHeaderText" ); |
|
489 |
|
490 return EPhoneVoIPPrivateAddress; |
|
491 } |
|
492 |
|
493 |
|
494 // ----------------------------------------------------------- |
|
495 // From class MPhoneCustomization. |
|
496 // CPhoneCustomizationVoip::CustomizeBusyNoteText |
|
497 // ----------------------------------------------------------- |
|
498 // |
|
499 TInt CPhoneCustomizationVoip::CustomizeBusyNoteText() |
|
500 { |
|
501 __LOGMETHODSTARTEND( PhoneUIVoIPExtension, |
|
502 "CPhoneCustomizationVoip::CustomizeBusyNoteText" ); |
|
503 |
|
504 TInt resource( EPhoneNumberBusy ); |
|
505 |
|
506 const TPECallType callType = |
|
507 iStateMachine.PhoneEngineInfo()->CallTypeCommand(); |
|
508 if ( callType == EPECallTypeVoIP ) |
|
509 { |
|
510 resource = EPhoneVoIPNumberBusy; |
|
511 } |
|
512 |
|
513 return resource; |
|
514 } |
|
515 |
|
516 |
|
517 // ----------------------------------------------------------- |
|
518 // From class MPhoneCustomization. |
|
519 // CPhoneCustomizationVoip::HandleCallFromNumberEntryL |
|
520 // ----------------------------------------------------------- |
|
521 // |
|
522 TBool CPhoneCustomizationVoip::HandleCallFromNumberEntryL() |
|
523 { |
|
524 __LOGMETHODSTARTEND( PhoneUIVoIPExtension, |
|
525 "CPhoneCustomizationVoip::HandleCallFromNumberEntryL" ); |
|
526 |
|
527 TBool handled = EFalse; |
|
528 |
|
529 if ( StateUtils().IsVoipNumber() ) |
|
530 { |
|
531 // Dial voip because invalid string for cs call in number entry/dialer. |
|
532 StateUtils().SelectServiceAndDialL(); |
|
533 handled = ETrue; |
|
534 } |
|
535 |
|
536 return handled; |
|
537 } |
|
538 |
|
539 |
|
540 // ----------------------------------------------------------- |
|
541 // From class MPhoneCustomization. |
|
542 // CPhoneCustomizationVoip::HandlePhoneEngineMessageL |
|
543 // ----------------------------------------------------------- |
|
544 // |
|
545 TBool CPhoneCustomizationVoip::HandlePhoneEngineMessageL( |
|
546 const TInt aMessage, |
|
547 TInt aCallId ) |
|
548 { |
|
549 __LOGMETHODSTARTEND( PhoneUIVoIPExtension, |
|
550 "CPhoneCustomizationVoip::HandlePhoneEngineMessageL" ); |
|
551 |
|
552 TBool handled = ETrue; |
|
553 switch ( aMessage ) |
|
554 { |
|
555 case MEngineMonitor::EPEMessageServiceEnabled: |
|
556 case MEngineMonitor::EPEMessageServiceDisabled: |
|
557 { |
|
558 iViewCommandHandle.ExecuteCommandL( |
|
559 EPhoneViewRemoveGlobalWaitNote ); |
|
560 break; |
|
561 } |
|
562 case MEngineMonitor::EPEMessageServiceEnabling: |
|
563 { |
|
564 LaunchEnablingServiceNoteL(); |
|
565 break; |
|
566 } |
|
567 case MEngineMonitor::EPEMessageNoService: |
|
568 { |
|
569 SendGlobalErrorNoteL( EPhoneVoIPNoService ); |
|
570 break; |
|
571 } |
|
572 case MEngineMonitor::EPEMessageMovedPermanently: |
|
573 { |
|
574 iCallForwardHandler-> |
|
575 ShowMovedPermanentlyQueryL( aCallId ); |
|
576 break; |
|
577 } |
|
578 case MEngineMonitor::EPEMessageMultipleChoices: |
|
579 { |
|
580 iCallForwardHandler-> |
|
581 ShowMultipleChoicesQueryL( aCallId ); |
|
582 break; |
|
583 } |
|
584 case MEngineMonitor::EPEMessageCallSecureStatusChanged: |
|
585 { |
|
586 HandleCallSecureStatusChangeL( aCallId ); |
|
587 break; |
|
588 } |
|
589 case MEngineMonitor::EPEMessageTransferring: |
|
590 { |
|
591 iViewCommandHandle.ExecuteCommandL( EPhoneViewRemoveGlobalNote ); |
|
592 CPhoneState* phoneState = |
|
593 static_cast< CPhoneState* >( iStateMachine.State() ); |
|
594 SendGlobalInfoNoteL( EPhoneInCallTransferred ); |
|
595 break; |
|
596 } |
|
597 case MEngineMonitor::EPEMessageRemoteForwarding: |
|
598 { |
|
599 SendGlobalErrorNoteL( EPhoneRemoteForwarding ); |
|
600 break; |
|
601 } |
|
602 default: |
|
603 handled = EFalse; |
|
604 break; |
|
605 } |
|
606 return handled; |
|
607 } |
|
608 |
|
609 // ----------------------------------------------------------- |
|
610 // From class MPhoneCustomization. |
|
611 // CPhoneCustomizationVoip::HandleDialL |
|
612 // ----------------------------------------------------------- |
|
613 // |
|
614 void CPhoneCustomizationVoip::HandleDialL( const TDesC& aNumber ) |
|
615 { |
|
616 __LOGMETHODSTARTEND( PhoneUIVoIPExtension, |
|
617 "CPhoneCustomizationVoip::HandleDialL" ); |
|
618 |
|
619 StateUtils().SelectServiceAndDialL( aNumber, NULL ); |
|
620 } |
|
621 |
|
622 // ----------------------------------------------------------- |
|
623 // From class MPhoneButtonCustomization. |
|
624 // CPhoneCustomizationVoip::CustomizeTouchPaneButtons |
|
625 // ----------------------------------------------------------- |
|
626 // |
|
627 void CPhoneCustomizationVoip::CustomizeTouchPaneButtons( |
|
628 MBubbleTouchPaneInterface& aTouchPane ) |
|
629 { |
|
630 __LOGMETHODSTARTEND( PhoneUIVoIPExtension, |
|
631 "CPhoneCustomizationVoip::CustomizeTouchPaneButtons" ); |
|
632 |
|
633 TRAPD( err, CustomizeTouchPaneUsingExtensionL( aTouchPane ) ); |
|
634 |
|
635 if ( KErrNone != err ) |
|
636 { |
|
637 // Extension plugin didn't handle touch pane dimming. |
|
638 TInt buttonCount = aTouchPane.NumberOfButtonsInPane(); |
|
639 |
|
640 for ( TInt i=0; i < buttonCount; i++ ) |
|
641 { |
|
642 TInt commandId = aTouchPane.ButtonCommandId( i ); |
|
643 |
|
644 switch ( commandId ) |
|
645 { |
|
646 case EPhoneInCallCmdCreateConference: |
|
647 case EPhoneInCallCmdJoin: |
|
648 { |
|
649 if ( !IsFeatureSupported( EFeatureConference ) ) |
|
650 { |
|
651 // Conference not supported -> set item dimmed |
|
652 aTouchPane.SetButtonDimmed( commandId, ETrue ); |
|
653 } |
|
654 break; |
|
655 } |
|
656 default: |
|
657 break; |
|
658 } // switch |
|
659 } // for |
|
660 } |
|
661 } |
|
662 |
|
663 |
|
664 // ----------------------------------------------------------- |
|
665 // CPhoneCustomizationVoip::VoIPSupportedL |
|
666 // ----------------------------------------------------------- |
|
667 // |
|
668 TBool CPhoneCustomizationVoip::VoIPSupportedL() |
|
669 { |
|
670 __LOGMETHODSTARTEND( PhoneUIVoIPExtension, |
|
671 "CPhoneCustomizationVoip::VoIPSupportedL" ); |
|
672 |
|
673 TBool voipSupported( EFalse ); |
|
674 |
|
675 CSPSettings* serviceProviderSettings = CSPSettings::NewL(); |
|
676 voipSupported = serviceProviderSettings->IsFeatureSupported( |
|
677 ESupportInternetCallFeature ); |
|
678 delete serviceProviderSettings; |
|
679 |
|
680 return voipSupported; |
|
681 } |
|
682 |
|
683 |
|
684 // ----------------------------------------------------------- |
|
685 // CPhoneCustomizationVoip::ModifyInCallMenuL |
|
686 // ----------------------------------------------------------- |
|
687 // |
|
688 void CPhoneCustomizationVoip::ModifyInCallMenuL( TInt aResourceId, CEikMenuPane& aMenuPane ) |
|
689 { |
|
690 __LOGMETHODSTARTEND( PhoneUIVoIPExtension, |
|
691 "CPhoneCustomizationVoip::ModifyInCallMenuL" ); |
|
692 |
|
693 if ( aResourceId != R_AVKON_MENUPANE_FEP_DEFAULT && |
|
694 aResourceId != R_AVKON_MENUPANE_EDITTEXT_DEFAULT && |
|
695 aResourceId != R_AVKON_MENUPANE_LANGUAGE_DEFAULT ) |
|
696 { |
|
697 RArray<CTelMenuExtension::TCallInfo> array; |
|
698 CleanupClosePushL( array ); |
|
699 |
|
700 GetActiveCallArrayL( array ); |
|
701 |
|
702 // Use extensions for menu modifications |
|
703 iExtensionHandler->ModifyInCallMenuL( |
|
704 ServiceIdForActivestCallL( array ), |
|
705 array, |
|
706 aResourceId, |
|
707 aMenuPane ); |
|
708 |
|
709 __PHONELOG( EBasic, PhoneUIVoIPExtension, |
|
710 "CPhoneCustomizationVoip::ModifyInCallMenuL() plugin exists" ); |
|
711 |
|
712 CleanupStack::PopAndDestroy( &array ); |
|
713 } |
|
714 } |
|
715 |
|
716 |
|
717 // ----------------------------------------------------------- |
|
718 // CPhoneCustomizationVoip::ModifyNumberAcquisitionMenuL |
|
719 // This function is called when user opens menu from dialler/number entry. |
|
720 // ----------------------------------------------------------- |
|
721 // |
|
722 void CPhoneCustomizationVoip::ModifyNumberAcquisitionMenuL( |
|
723 TInt aResourceId, CEikMenuPane& aMenuPane ) |
|
724 { |
|
725 __LOGMETHODSTARTEND( PhoneUIVoIPExtension, |
|
726 "CPhoneCustomizationVoip::ModifyNumberAcquisitionMenuL"); |
|
727 |
|
728 if ( ( aResourceId == R_PHONEUI_NUMBERACQ_OPTIONS_CALL_MENU || |
|
729 aResourceId == R_PHONEUI_NUMBERACQ_OPTIONS_MENU || |
|
730 aResourceId == R_PHONEUIDIALER_OPTIONS_MENU ) && |
|
731 VoIPSupportedL() ) |
|
732 { |
|
733 InsertInternetCallMenuItemL( aResourceId, aMenuPane ); |
|
734 } |
|
735 |
|
736 if ( ( aResourceId == R_PHONEUI_NUMBERACQ_OPTIONS_MENU || |
|
737 aResourceId == R_PHONEUI_NUMBERACQ_OPTIONS_MENU_VOIP || |
|
738 aResourceId == R_PHONEUI_NUMBERACQ_OPTIONS_MENU_VOIP_WITH_SERVICE_NUMBER ) && |
|
739 VoIPSupportedL() ) |
|
740 { |
|
741 InsertTextInputModeChangeMenuItemL( aMenuPane ); |
|
742 } |
|
743 } |
|
744 |
|
745 |
|
746 // ----------------------------------------------------------- |
|
747 // CPhoneCustomizationVoip::InsertInternetCallMenuItemL |
|
748 // ----------------------------------------------------------- |
|
749 // |
|
750 void CPhoneCustomizationVoip::InsertInternetCallMenuItemL( |
|
751 TInt aResourceId, CEikMenuPane& aMenuPane ) |
|
752 { |
|
753 __LOGMETHODSTARTEND( PhoneUIVoIPExtension, |
|
754 "CPhoneCustomizationVoip::InsertInternetCallMenuItemL" ); |
|
755 |
|
756 // get VoIP services |
|
757 RIdArray voipServices; |
|
758 CleanupClosePushL( voipServices ); |
|
759 GetVoIPServiceIdsL( voipServices ); |
|
760 |
|
761 CEikMenuPaneItem* voipMenuItem = NULL; |
|
762 |
|
763 if ( 1 == voipServices.Count() ) |
|
764 { |
|
765 voipMenuItem = CreateMenuPaneItemLC( |
|
766 EPhoneNumberAcqCmdInternetCall, |
|
767 voipServices[0] ); |
|
768 } |
|
769 else |
|
770 { |
|
771 voipMenuItem = CreateMenuPaneItemLC( |
|
772 EPhoneNumberAcqCmdInternetCall, |
|
773 CPhoneMainResourceResolver::Instance()-> |
|
774 ResolveResourceID( EPhoneVoIPCallTypeInternet ) ); |
|
775 } |
|
776 |
|
777 HBufC* phoneNumber = PhoneNumberFromEntryLC(); |
|
778 |
|
779 if ( aResourceId == R_PHONEUI_NUMBERACQ_OPTIONS_CALL_MENU ) |
|
780 { |
|
781 if ( !CPhoneKeys::Validate( phoneNumber->Des() ) ) |
|
782 { |
|
783 TInt index(KErrNotFound); |
|
784 if ( aMenuPane.MenuItemExists( EPhoneNumberAcqCmdCall, index ) ) |
|
785 { |
|
786 aMenuPane.DeleteMenuItem( EPhoneNumberAcqCmdCall ); |
|
787 } |
|
788 |
|
789 if ( aMenuPane.MenuItemExists( EPhoneNumberAcqCmdVideoCall, index ) ) |
|
790 { |
|
791 aMenuPane.DeleteMenuItem( EPhoneNumberAcqCmdVideoCall ); |
|
792 } |
|
793 } |
|
794 |
|
795 aMenuPane.AddMenuItemL( voipMenuItem->iData ); |
|
796 } |
|
797 else if ( iStateMachine.PhoneEngineInfo()->PhoneNumberIsServiceCode() ) |
|
798 { |
|
799 // When user writes string recognized as service code (eg.*#31# -> clir off) |
|
800 // call menu is not visible. Internet call must still be possible so |
|
801 // internet call option is added here to the menu. |
|
802 |
|
803 // If number entry is empty don't add internet call option |
|
804 if ( phoneNumber->Length() ) |
|
805 { |
|
806 // Internet call item must be on the top of the menu |
|
807 aMenuPane.InsertMenuItemL( voipMenuItem->iData, 0 ); |
|
808 } |
|
809 } |
|
810 |
|
811 CleanupStack::PopAndDestroy( 3, &voipServices ); |
|
812 } |
|
813 |
|
814 |
|
815 // ----------------------------------------------------------- |
|
816 // CPhoneCustomizationVoip::InsertTextInputModeChangeMenuItemL |
|
817 // ----------------------------------------------------------- |
|
818 // |
|
819 void CPhoneCustomizationVoip::InsertTextInputModeChangeMenuItemL( |
|
820 CEikMenuPane& aMenuPane ) |
|
821 { |
|
822 __LOGMETHODSTARTEND( PhoneUIVoIPExtension, |
|
823 "CPhoneCustomizationVoip::InsertTextInputModeChangeMenuItemL" ); |
|
824 |
|
825 TInt modeChangeOptionIndex = KErrNotFound; |
|
826 if ( aMenuPane.MenuItemExists( |
|
827 EPhoneNumberAcqCmdToggleNeAlphaMode, modeChangeOptionIndex ) || |
|
828 aMenuPane.MenuItemExists( |
|
829 EPhoneNumberAcqCmdToggleNeNumericMode, modeChangeOptionIndex ) ) |
|
830 { |
|
831 __PHONELOG( EBasic, PhoneUIVoIPExtension, |
|
832 "InsertTextInputModeChangeMenuItemL, MENU ITEM ALREADY EXISTS" ); |
|
833 __ASSERT_DEBUG( EFalse, Panic( EPhoneCtrlInvariant ) ); |
|
834 } |
|
835 |
|
836 CEikMenuPaneItem* menuItem = NULL; |
|
837 TBool numberEntryInNumericMode = iViewCommandHandle.HandleCommandL( |
|
838 EPhoneViewIsNumberEntryNumericMode ) == EPhoneViewResponseSuccess; |
|
839 if ( numberEntryInNumericMode ) |
|
840 { |
|
841 menuItem = CreateMenuPaneItemLC( |
|
842 EPhoneNumberAcqCmdToggleNeAlphaMode, |
|
843 R_PHONEUI_NUMBERACQ_OPTIONS_MENU_ITEM_ALPHA_MODE ); |
|
844 } |
|
845 else |
|
846 { |
|
847 menuItem = CreateMenuPaneItemLC( |
|
848 EPhoneNumberAcqCmdToggleNeNumericMode, |
|
849 R_PHONEUI_NUMBERACQ_OPTIONS_MENU_ITEM_NUMERIC_MODE ); |
|
850 } |
|
851 |
|
852 // alpha/numeric mode option is always second item in number entry menu |
|
853 const TInt KTextInputModeChangeMenuItemIndex = 1; |
|
854 aMenuPane.InsertMenuItemL( |
|
855 menuItem->iData, KTextInputModeChangeMenuItemIndex ); |
|
856 CleanupStack::PopAndDestroy( menuItem ); |
|
857 } |
|
858 |
|
859 |
|
860 // ----------------------------------------------------------- |
|
861 // CPhoneCustomizationVoip::GetActiveCallArrayL |
|
862 // ----------------------------------------------------------- |
|
863 // |
|
864 void CPhoneCustomizationVoip::GetActiveCallArrayL( |
|
865 RArray<CTelMenuExtension::TCallInfo>& aArray ) |
|
866 { |
|
867 __LOGMETHODSTARTEND( PhoneUIVoIPExtension, |
|
868 "CPhoneCustomizationVoip::GetActiveCallArrayL"); |
|
869 |
|
870 MPEEngineInfo* engineInfo = iStateMachine.PhoneEngine()->EngineInfo(); |
|
871 |
|
872 for( TInt i = 0; i < KPEMaximumNumberOfCalls; i++ ) |
|
873 { |
|
874 CTelMenuExtension::TCallInfo callInfo; |
|
875 callInfo.iCallId = i; |
|
876 callInfo.iServiceId = engineInfo->ServiceId( i ); |
|
877 callInfo.iCallType = CTelMenuExtension::EUninitialized; |
|
878 |
|
879 switch( engineInfo->CallType( i ) ) |
|
880 { |
|
881 case EPECallTypeUninitialized: |
|
882 callInfo.iCallType = CTelMenuExtension::EUninitialized; |
|
883 break; |
|
884 case EPECallTypeCSVoice: |
|
885 callInfo.iCallType = CTelMenuExtension::ECsVoice; |
|
886 break; |
|
887 case EPECallTypeVideo: |
|
888 callInfo.iCallType = CTelMenuExtension::ECsVideo; |
|
889 break; |
|
890 case EPECallTypeVoIP: |
|
891 callInfo.iCallType = CTelMenuExtension::EPsVoice; |
|
892 break; |
|
893 default: |
|
894 break; |
|
895 } |
|
896 |
|
897 callInfo.iCallState = CTelMenuExtension::ENone; |
|
898 |
|
899 // Convert call bubble indications to call states |
|
900 switch( engineInfo->CallState( i ) ) |
|
901 { |
|
902 // Call states 0 - 499 |
|
903 case EPEStateDialing: |
|
904 case EPEStateEmergencyDialing: |
|
905 case EPEStateConnecting: |
|
906 callInfo.iCallState = CTelMenuExtension::EOutgoing; |
|
907 break; |
|
908 case EPEStateAnswering: |
|
909 case EPEStateRinging: |
|
910 callInfo.iCallState = CTelMenuExtension::EIncoming; |
|
911 break; |
|
912 |
|
913 case EPEStateConnectedConference: |
|
914 case EPEStateConnected: |
|
915 callInfo.iCallState = CTelMenuExtension::EActive; |
|
916 break; |
|
917 |
|
918 case EPEStateHeldConference: |
|
919 case EPEStateHeld: |
|
920 callInfo.iCallState = CTelMenuExtension::EOnHold; |
|
921 break; |
|
922 |
|
923 case EPEStateHangingUpConference: |
|
924 case EPEStateRejecting: |
|
925 case EPEStateHangingUp: |
|
926 case EPEStateDisconnecting: |
|
927 callInfo.iCallState = CTelMenuExtension::EDisconnecting; |
|
928 break; |
|
929 |
|
930 case EPEStateUnknown: |
|
931 case EPEStateIdle: |
|
932 case EPEStateConferenceIdle: |
|
933 break; |
|
934 |
|
935 // conference |
|
936 case EPEStateCreatingConference: |
|
937 case EPEStateSwappingConference: |
|
938 case EPEStateResumeHoldConference: |
|
939 // misc states. |
|
940 case EPEStateMaximumState: |
|
941 default: |
|
942 User::Leave( KErrNotReady ); |
|
943 break; |
|
944 } |
|
945 |
|
946 if( callInfo.iCallState != CTelMenuExtension::ENone ) |
|
947 { |
|
948 aArray.Append( callInfo ); |
|
949 } |
|
950 |
|
951 } |
|
952 } |
|
953 |
|
954 |
|
955 // ----------------------------------------------------------- |
|
956 // CPhoneCustomizationVoip::ResolveMostActiveCallL |
|
957 // ----------------------------------------------------------- |
|
958 // |
|
959 TInt CPhoneCustomizationVoip::ResolveMostActiveCallL( |
|
960 const RArray<CTelMenuExtension::TCallInfo>& aArray ) |
|
961 { |
|
962 __LOGMETHODSTARTEND( PhoneUIVoIPExtension, |
|
963 "CPhoneCustomizationVoip::ResolveMostActiveCallL" ); |
|
964 |
|
965 TInt incomingCallId( KErrNotFound ); |
|
966 TInt activeCallId( KErrNotFound ); |
|
967 TInt onholdCallId( KErrNotFound ); |
|
968 TInt disconnectingCallId( KErrNotFound ); |
|
969 |
|
970 for( TInt i = 0; i < aArray.Count(); i++ ) |
|
971 { |
|
972 if( aArray[i].iCallState == CTelMenuExtension::EOutgoing ) |
|
973 { |
|
974 // Always most active call |
|
975 return aArray[i].iCallId; |
|
976 } |
|
977 else if( aArray[i].iCallState == CTelMenuExtension::EActive ) |
|
978 { |
|
979 activeCallId = aArray[i].iCallId; |
|
980 } |
|
981 else if( aArray[i].iCallState == CTelMenuExtension::EIncoming ) |
|
982 { |
|
983 incomingCallId = aArray[i].iCallId; |
|
984 } |
|
985 else if( aArray[i].iCallState == CTelMenuExtension::EOnHold ) |
|
986 { |
|
987 onholdCallId = aArray[i].iCallId; |
|
988 } |
|
989 else if( aArray[i].iCallState == CTelMenuExtension::EDisconnecting ) |
|
990 { |
|
991 disconnectingCallId = aArray[i].iCallId; |
|
992 } |
|
993 } |
|
994 |
|
995 if( activeCallId != KErrNotFound ) |
|
996 { |
|
997 return activeCallId; |
|
998 } |
|
999 else if( incomingCallId != KErrNotFound ) |
|
1000 { |
|
1001 return incomingCallId; |
|
1002 } |
|
1003 else if( onholdCallId != KErrNotFound ) |
|
1004 { |
|
1005 return onholdCallId; |
|
1006 } |
|
1007 else if( disconnectingCallId != KErrNotFound ) |
|
1008 { |
|
1009 return disconnectingCallId; |
|
1010 } |
|
1011 else |
|
1012 { |
|
1013 User::Leave( KErrNotFound ); |
|
1014 } |
|
1015 |
|
1016 return KErrNotFound; |
|
1017 } |
|
1018 |
|
1019 |
|
1020 // ----------------------------------------------------------- |
|
1021 // CPhoneCustomizationVoip::ServiceIdForActivestCallL |
|
1022 // (other items were commented in a header). |
|
1023 // ----------------------------------------------------------- |
|
1024 // |
|
1025 TUint CPhoneCustomizationVoip::ServiceIdForActivestCallL( |
|
1026 const RArray<CTelMenuExtension::TCallInfo>& aCallArray ) |
|
1027 { |
|
1028 __LOGMETHODSTARTEND( PhoneUIVoIPExtension, |
|
1029 "CPhoneCustomizationVoip::ServiceIdForActivestCallL" ); |
|
1030 |
|
1031 const TInt KActiveCallId = ResolveMostActiveCallL( aCallArray ); |
|
1032 |
|
1033 MPEEngineInfo* engineInfo = iStateMachine.PhoneEngine()->EngineInfo(); |
|
1034 |
|
1035 // Return service id for activest call |
|
1036 return engineInfo->ServiceId( KActiveCallId ); |
|
1037 } |
|
1038 |
|
1039 |
|
1040 // ----------------------------------------------------------- |
|
1041 // CPhoneCustomizationVoip::IsFeatureSupported() |
|
1042 // (other items were commented in a header). |
|
1043 // ----------------------------------------------------------- |
|
1044 // |
|
1045 TBool CPhoneCustomizationVoip::IsFeatureSupported( TFeature aFeature ) |
|
1046 { |
|
1047 __LOGMETHODSTARTEND( PhoneUIVoIPExtension, |
|
1048 "CPhoneCustomizationVoip::IsFeatureSupported" ); |
|
1049 |
|
1050 TBool ret( EFalse ); |
|
1051 |
|
1052 TRAP_IGNORE( ret = CheckFeatureSupportByCallTypeL( aFeature ) ); |
|
1053 |
|
1054 __PHONELOG1( EBasic, PhoneUIVoIPExtension, |
|
1055 "CPhoneCustomizationVoip::IsFeatureSupported =%d", ret ); |
|
1056 |
|
1057 return ret; |
|
1058 } |
|
1059 |
|
1060 |
|
1061 // ----------------------------------------------------------- |
|
1062 // CPhoneCustomizationVoip::CheckFeatureSupportByCallTypeL() |
|
1063 // (other items were commented in a header). |
|
1064 // ----------------------------------------------------------- |
|
1065 // |
|
1066 TBool CPhoneCustomizationVoip::CheckFeatureSupportByCallTypeL( |
|
1067 TFeature aFeature ) |
|
1068 { |
|
1069 __LOGMETHODSTARTEND( PhoneUIVoIPExtension, |
|
1070 "CPhoneCustomizationVoip::CheckFeatureSupportByCallTypeL" ); |
|
1071 |
|
1072 if ( aFeature != EFeatureConference && |
|
1073 aFeature != EFeatureTransfer ) |
|
1074 { |
|
1075 return ETrue; |
|
1076 } |
|
1077 |
|
1078 RArray<CTelMenuExtension::TCallInfo> array; |
|
1079 CleanupClosePushL( array ); |
|
1080 GetActiveCallArrayL( array ); |
|
1081 __PHONELOG1( EBasic, PhoneUIVoIPExtension, |
|
1082 "CPhoneCustomizationVoip::CheckFeatureSupportByCallTypeL CallCount=%d", |
|
1083 array.Count() ); |
|
1084 |
|
1085 TBool supported( ETrue ); |
|
1086 TInt firstCallType = CTelMenuExtension::EUninitialized; |
|
1087 for( TInt i = 0; i < array.Count(); i++ ) |
|
1088 { |
|
1089 if( array[i].iCallState == CTelMenuExtension::EOutgoing || |
|
1090 array[i].iCallState == CTelMenuExtension::EActive || |
|
1091 array[i].iCallState == CTelMenuExtension::EOnHold ) |
|
1092 { |
|
1093 if( firstCallType == CTelMenuExtension::EUninitialized ) |
|
1094 { |
|
1095 // Memorize first found call type |
|
1096 firstCallType = array[i].iCallType; |
|
1097 } |
|
1098 else if( firstCallType != array[i].iCallType ) |
|
1099 { |
|
1100 // Found different call type |
|
1101 supported = EFalse; |
|
1102 break; |
|
1103 } |
|
1104 } |
|
1105 |
|
1106 } |
|
1107 |
|
1108 CleanupStack::PopAndDestroy( &array ); |
|
1109 |
|
1110 return supported; |
|
1111 } |
|
1112 |
|
1113 |
|
1114 // ----------------------------------------------------------- |
|
1115 // CPhoneCustomizationVoip::CustomizeTouchPaneUsingExtensionL |
|
1116 // ----------------------------------------------------------- |
|
1117 // |
|
1118 void CPhoneCustomizationVoip::CustomizeTouchPaneUsingExtensionL( |
|
1119 MBubbleTouchPaneInterface& aTouchPane ) |
|
1120 { |
|
1121 __LOGMETHODSTARTEND( PhoneUIVoIPExtension, |
|
1122 "CPhoneCustomizationVoip::CustomizeTouchPaneUsingExtensionL" ); |
|
1123 |
|
1124 RArray<CTelMenuExtension::TCallInfo> array; |
|
1125 CleanupClosePushL( array ); |
|
1126 |
|
1127 GetActiveCallArrayL( array ); |
|
1128 |
|
1129 // Use extensions for touch pane buttons dimming |
|
1130 iExtensionHandler->CustomizeTouchPaneButtonsL( |
|
1131 ServiceIdForActivestCallL( array ), |
|
1132 array, |
|
1133 aTouchPane ); |
|
1134 |
|
1135 __PHONELOG( EBasic, PhoneUIVoIPExtension, |
|
1136 "CPhoneCustomizationVoip::ModifyInCallMenuL() plugin exists" ); |
|
1137 |
|
1138 CleanupStack::PopAndDestroy( &array ); |
|
1139 } |
|
1140 |
|
1141 |
|
1142 // ----------------------------------------------------------- |
|
1143 // CPhoneCustomizationVoip::LaunchEnablingServiceNoteL |
|
1144 // ----------------------------------------------------------- |
|
1145 // |
|
1146 void CPhoneCustomizationVoip::LaunchEnablingServiceNoteL() |
|
1147 { |
|
1148 __LOGMETHODSTARTEND( PhoneUIVoIPExtension, |
|
1149 "CPhoneCustomizationVoip::LaunchEnablingServiceNoteL" ) |
|
1150 |
|
1151 TPhoneCmdParamQuery queryParam; |
|
1152 queryParam.SetQueryType( EPhoneGlobalWaitNote ); |
|
1153 queryParam.SetCommandParamId( |
|
1154 TPhoneCommandParam::EPhoneParamIdGlobalWaitNote ); |
|
1155 |
|
1156 RBuf serviceName; |
|
1157 CleanupClosePushL( serviceName ); |
|
1158 TUint32 serviceId = |
|
1159 iStateMachine.PhoneEngineInfo()->ServiceIdCommand(); |
|
1160 static_cast<CPhoneStateMachineVoIP&>( iStateMachine ). |
|
1161 VoipErrorMessageHandler().GetServiceProviderNameL( |
|
1162 serviceName, serviceId ); |
|
1163 |
|
1164 RBuf noteText; |
|
1165 CleanupClosePushL( noteText ); |
|
1166 noteText.Assign( StringLoader::LoadL( |
|
1167 CPhoneMainResourceResolver::Instance()->ResolveResourceID( |
|
1168 EPhoneVoIPEnablingServiceWaitNoteText ), serviceName ) ); |
|
1169 |
|
1170 queryParam.SetDataText( ¬eText ); |
|
1171 queryParam.SetDefaultCba( R_AVKON_SOFTKEYS_CANCEL ); |
|
1172 |
|
1173 const TInt KEnableServiceTimeOutInSecs = 60; |
|
1174 queryParam.SetTimeOut( KEnableServiceTimeOutInSecs ); |
|
1175 // configure custom command mappings for user responses |
|
1176 queryParam.SetCbaCommandMapping( |
|
1177 EAknSoftkeyCancel, EPhoneCmdCancelServiceEnabling ); |
|
1178 queryParam.SetCbaCommandMapping( |
|
1179 KErrCancel, EPhoneCmdCancelServiceEnabling ); |
|
1180 queryParam.SetCustomCommandForTimeOut( EPhoneCmdServiceEnablingTimedOut ); |
|
1181 iViewCommandHandle.ExecuteCommandL( EPhoneViewShowQuery, &queryParam ); |
|
1182 |
|
1183 CleanupStack::PopAndDestroy( ¬eText ); |
|
1184 CleanupStack::PopAndDestroy( &serviceName ); |
|
1185 } |
|
1186 |
|
1187 |
|
1188 // --------------------------------------------------------- |
|
1189 // CPhoneCustomizationVoip::SendGlobalErrorNoteL |
|
1190 // --------------------------------------------------------- |
|
1191 // |
|
1192 void CPhoneCustomizationVoip::SendGlobalErrorNoteL( TInt aResourceId ) |
|
1193 { |
|
1194 __LOGMETHODSTARTEND( PhoneUIVoIPExtension, |
|
1195 "CPhoneCustomizationVoip::SendGlobalErrorNoteL" ); |
|
1196 |
|
1197 __ASSERT_DEBUG( aResourceId, Panic( EPhoneCtrlParameterNotInitialized ) ); |
|
1198 |
|
1199 CPhoneState* phoneState = |
|
1200 static_cast< CPhoneState* >( iStateMachine.State() ); |
|
1201 |
|
1202 phoneState->SendGlobalErrorNoteL( aResourceId ); |
|
1203 } |
|
1204 |
|
1205 |
|
1206 // --------------------------------------------------------- |
|
1207 // CPhoneCustomizationVoip::SendGlobalInfoNoteL |
|
1208 // --------------------------------------------------------- |
|
1209 // |
|
1210 void CPhoneCustomizationVoip::SendGlobalInfoNoteL( TInt aResourceId ) |
|
1211 { |
|
1212 __LOGMETHODSTARTEND( PhoneUIVoIPExtension, |
|
1213 "CPhoneCustomizationVoip::SendGlobalInfoNoteL" ); |
|
1214 |
|
1215 __ASSERT_DEBUG( aResourceId, Panic( EPhoneCtrlParameterNotInitialized ) ); |
|
1216 |
|
1217 CPhoneState* phoneState = |
|
1218 static_cast< CPhoneState* >( iStateMachine.State() ); |
|
1219 |
|
1220 phoneState->SendGlobalInfoNoteL( aResourceId ); |
|
1221 } |
|
1222 |
|
1223 |
|
1224 // ----------------------------------------------------------- |
|
1225 // CPhoneCustomizationVoip::HandleURIFittingToCallBubble |
|
1226 // ----------------------------------------------------------- |
|
1227 // |
|
1228 void CPhoneCustomizationVoip::HandleURIFittingToCallBubble( |
|
1229 const TDesC& aCLIText, TDes& aSipURI, TDes& aSipURIDomainPart ) |
|
1230 { |
|
1231 __LOGMETHODSTARTEND( PhoneUIVoIPExtension, |
|
1232 "CPhoneCustomizationVoip::HandleURIFittingToCallBubble" ); |
|
1233 |
|
1234 TInt cliLength = aCLIText.Length(); |
|
1235 if ( KMaxLengthForSIPURIFirstLine > cliLength ) |
|
1236 { |
|
1237 aSipURI.Copy( aCLIText ); |
|
1238 aSipURIDomainPart.Copy( KNullDesC ); |
|
1239 } |
|
1240 else if ( KMaxLengthForSIPURITwoLines > cliLength ) |
|
1241 { |
|
1242 aSipURI.Copy( aCLIText.Mid( 0, KMaxLengthForSIPURIFirstLine ) ); |
|
1243 aSipURIDomainPart.Copy( aCLIText.Mid( KMaxLengthForSIPURIFirstLine, |
|
1244 cliLength-KMaxLengthForSIPURIFirstLine ) ); |
|
1245 } |
|
1246 else |
|
1247 { |
|
1248 TInt atPosition = aCLIText.Find( KVoipAt ); |
|
1249 if ( atPosition == KErrNotFound ) |
|
1250 { |
|
1251 atPosition = KMaxLengthForSIPURIFirstLine; |
|
1252 } |
|
1253 aSipURI.Copy( aCLIText.Mid( 0, atPosition ) ); |
|
1254 aSipURIDomainPart.Copy( aCLIText.Mid( atPosition, |
|
1255 ( cliLength-atPosition ) ) ); |
|
1256 } |
|
1257 } |
|
1258 |
|
1259 |
|
1260 // ----------------------------------------------------------- |
|
1261 // CPhoneCustomizationVoip::StateUtils |
|
1262 // ----------------------------------------------------------- |
|
1263 // |
|
1264 CPhoneStateUtilsVoip& CPhoneCustomizationVoip::StateUtils() |
|
1265 { |
|
1266 return static_cast<CPhoneStateMachineVoIP&>( iStateMachine ).StateUtils(); |
|
1267 } |
|
1268 |
|
1269 |
|
1270 // ----------------------------------------------------------- |
|
1271 // CPhoneCustomizationVoip::HandleSecureStatusChangeL |
|
1272 // ----------------------------------------------------------- |
|
1273 // |
|
1274 void CPhoneCustomizationVoip::HandleCallSecureStatusChangeL( TInt aCallId ) |
|
1275 { |
|
1276 __LOGMETHODSTARTEND( PhoneUIVoIPExtension, |
|
1277 "CPhoneCustomizationVoip::HandleCallSecureStatusChangeL" ); |
|
1278 |
|
1279 if ( KErrNotFound < aCallId ) |
|
1280 { |
|
1281 if ( ( EPECallTypeVoIP == |
|
1282 iStateMachine.PhoneEngineInfo()->CallType( aCallId ) ) && |
|
1283 !iStateMachine.PhoneEngineInfo()->IsSecureCall( aCallId ) ) |
|
1284 { |
|
1285 TInt state = iStateMachine.PhoneEngineInfo()->CallState( |
|
1286 aCallId ); |
|
1287 switch ( state ) |
|
1288 { |
|
1289 case EPEStateConnected: |
|
1290 { |
|
1291 iViewCommandHandle.ExecuteCommand( |
|
1292 EPhoneViewCipheringInfoChangePlayTone ); |
|
1293 break; |
|
1294 } |
|
1295 case EPEStateDialing: |
|
1296 { |
|
1297 SendGlobalInfoNoteL( |
|
1298 EPhoneSSNotificationTextVoipSipsFailed ); |
|
1299 break; |
|
1300 } |
|
1301 default: |
|
1302 break; |
|
1303 |
|
1304 } |
|
1305 } |
|
1306 } |
|
1307 } |
|
1308 |
|
1309 |
|
1310 // ----------------------------------------------------------- |
|
1311 // CPhoneCustomizationVoip::CreateMenuPaneItemLC |
|
1312 // ----------------------------------------------------------- |
|
1313 // |
|
1314 CEikMenuPaneItem* CPhoneCustomizationVoip::CreateMenuPaneItemLC( |
|
1315 TInt aCommandId, TInt aTextResourceId ) const |
|
1316 { |
|
1317 __LOGMETHODSTARTEND( PhoneUIVoIPExtension, |
|
1318 "CPhoneCustomizationVoip::CreateMenuPaneItemLC" ); |
|
1319 |
|
1320 CEikMenuPaneItem::SData data; |
|
1321 data.iCommandId = aCommandId; |
|
1322 data.iCascadeId = 0; |
|
1323 data.iFlags = 0; |
|
1324 iCoeEnv.ReadResourceL( data.iText, aTextResourceId ); |
|
1325 data.iExtraText = KNullDesC(); |
|
1326 |
|
1327 CEikMenuPaneItem* menuItem = new ( ELeave ) CEikMenuPaneItem(); |
|
1328 CleanupStack::PushL( menuItem ); |
|
1329 menuItem->iData = data; |
|
1330 |
|
1331 return menuItem; |
|
1332 } |
|
1333 |
|
1334 |
|
1335 // ----------------------------------------------------------- |
|
1336 // CPhoneCustomizationVoip::CreateMenuPaneItemLC |
|
1337 // ----------------------------------------------------------- |
|
1338 // |
|
1339 CEikMenuPaneItem* CPhoneCustomizationVoip::CreateMenuPaneItemLC( |
|
1340 TInt aCommandId, TServiceId aServiceId ) const |
|
1341 { |
|
1342 __LOGMETHODSTARTEND( PhoneUIVoIPExtension, |
|
1343 "CPhoneCustomizationVoip::CreateMenuPaneItemLC" ); |
|
1344 |
|
1345 CEikMenuPaneItem::SData data; |
|
1346 data.iCommandId = aCommandId; |
|
1347 data.iCascadeId = 0; |
|
1348 data.iFlags = 0; |
|
1349 data.iExtraText = KNullDesC(); |
|
1350 |
|
1351 // insert service name |
|
1352 TBuf<KMaxVoIPServiceName> serviceName; |
|
1353 GetVoipServiceNameL( aServiceId, serviceName ); |
|
1354 |
|
1355 HBufC* callText = StringLoader::LoadLC( |
|
1356 CPhoneMainResourceResolver::Instance() |
|
1357 ->ResolveResourceID( EPhoneVoIPNumberAcqXSPCall ), |
|
1358 serviceName ); |
|
1359 |
|
1360 data.iText.Append( *callText ); |
|
1361 |
|
1362 CleanupStack::PopAndDestroy( callText ); |
|
1363 |
|
1364 CEikMenuPaneItem* menuItem = new ( ELeave ) CEikMenuPaneItem(); |
|
1365 CleanupStack::PushL( menuItem ); |
|
1366 menuItem->iData = data; |
|
1367 |
|
1368 return menuItem; |
|
1369 } |
|
1370 |
|
1371 |
|
1372 // ----------------------------------------------------------- |
|
1373 // CPhoneCustomizationVoip::AddHandoverMenuItemIfNeededL |
|
1374 // ----------------------------------------------------------- |
|
1375 // |
|
1376 void CPhoneCustomizationVoip::AddHandoverMenuItemIfNeededL( TInt aResourceId, |
|
1377 CEikMenuPane& aMenuPane ) |
|
1378 { |
|
1379 __LOGMETHODSTARTEND( PhoneUIVoIPExtension, |
|
1380 "CPhoneCustomizationVoip::AddHandoverMenuItemIfNeededL" ); |
|
1381 |
|
1382 // Menu items to be added |
|
1383 if ( iVccHandler && AllowAlphaNumericMode() && |
|
1384 ( aResourceId == R_PHONEUI_CALLHANDLING_INCALL_OPTIONS_MENU || |
|
1385 aResourceId == R_PHONEUI_CALLWAITING_OPTIONS_MENU || |
|
1386 aResourceId == R_PHONEUI_ACTIVEANDHELDCALL_OPTIONS_MENU || |
|
1387 aResourceId == R_PHONEUI_ACTIVEANDHELDCONFCALL_OPTIONS_MENU || |
|
1388 aResourceId == R_PHONEUI_CALLACTIVEHELDANDWAITING_OPTIONS_MENU |
|
1389 )) |
|
1390 { |
|
1391 RArray<CTelMenuExtension::TCallInfo> array; |
|
1392 CleanupClosePushL( array ); |
|
1393 GetActiveCallArrayL( array ); |
|
1394 |
|
1395 iVccHandler->AddHandoverMenuItemL( array, aResourceId, aMenuPane ); |
|
1396 CleanupStack::PopAndDestroy( &array ); |
|
1397 } |
|
1398 } |
|
1399 |
|
1400 |
|
1401 // ----------------------------------------------------------- |
|
1402 // CPhoneCustomizationVoip::GetVoIPServiceIdsL |
|
1403 // ----------------------------------------------------------- |
|
1404 // |
|
1405 void CPhoneCustomizationVoip::GetVoIPServiceIdsL( RIdArray& aVoipServiceIds ) const |
|
1406 { |
|
1407 aVoipServiceIds.Reset(); |
|
1408 |
|
1409 // Fetch the settings api. |
|
1410 CSPSettings* settingsApi = CSPSettings::NewLC(); |
|
1411 |
|
1412 // read all service ids to array |
|
1413 RIdArray idArray; |
|
1414 CleanupClosePushL( idArray ); |
|
1415 |
|
1416 if ( KErrNone == settingsApi->FindServiceIdsL( idArray ) ) |
|
1417 { |
|
1418 // go throught all the services and check if any |
|
1419 // of them supports internet call |
|
1420 for ( TInt i = 0; idArray.Count() > i; i++) |
|
1421 { |
|
1422 // check if the service supports internet call |
|
1423 CSPProperty* property = CSPProperty::NewLC(); |
|
1424 |
|
1425 // get attribute mask of the service |
|
1426 TRAPD( error, error = settingsApi->FindPropertyL( idArray[i], |
|
1427 EPropertyServiceAttributeMask, *property ) ); |
|
1428 |
|
1429 if ( KErrNone == error ) |
|
1430 { |
|
1431 // read the value of mask property |
|
1432 TInt mask = 0; |
|
1433 error = property->GetValue( mask ); |
|
1434 if ( KErrNone == error ) |
|
1435 { |
|
1436 if ( ( mask & ESupportsInternetCall ) |
|
1437 && ( mask & EIsVisibleInCallMenu ) ) |
|
1438 { |
|
1439 aVoipServiceIds.Append( idArray[i] ); |
|
1440 } |
|
1441 } |
|
1442 } |
|
1443 CleanupStack::PopAndDestroy( property ); |
|
1444 } |
|
1445 } |
|
1446 |
|
1447 CleanupStack::PopAndDestroy( 2, settingsApi ); |
|
1448 } |
|
1449 |
|
1450 |
|
1451 // ----------------------------------------------------------- |
|
1452 // CPhoneCustomizationVoip::GetVoIPServiceIdsL |
|
1453 // ----------------------------------------------------------- |
|
1454 // |
|
1455 void CPhoneCustomizationVoip::GetVoipServiceNameL( TServiceId aServiceId, TDes& aServiceName ) const |
|
1456 { |
|
1457 CSPSettings* settingsApi = CSPSettings::NewLC(); |
|
1458 CSPProperty* property = CSPProperty::NewLC(); |
|
1459 |
|
1460 settingsApi->FindPropertyL( aServiceId, EServiceName, *property ); |
|
1461 property->GetValue( aServiceName ); |
|
1462 |
|
1463 CleanupStack::PopAndDestroy( 2, settingsApi ); |
|
1464 } |
|
1465 |
|
1466 |
|
1467 // ----------------------------------------------------------- |
|
1468 // CPhoneCustomizationVoip::PhoneNumberFromEntryLC |
|
1469 // ----------------------------------------------------------- |
|
1470 // |
|
1471 HBufC* CPhoneCustomizationVoip::PhoneNumberFromEntryLC() const |
|
1472 { |
|
1473 HBufC* phoneNumber = HBufC::NewLC( KPhoneNumberEntryBufferSize ); |
|
1474 |
|
1475 TPtr ptr( phoneNumber->Des() ); |
|
1476 TPhoneCmdParamString stringParam; |
|
1477 stringParam.SetString( &ptr ); |
|
1478 iViewCommandHandle.ExecuteCommand( |
|
1479 EPhoneViewGetNumberFromEntry, |
|
1480 &stringParam ); |
|
1481 |
|
1482 return phoneNumber; |
|
1483 } |
|
1484 |
|
1485 // End of File |