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