46 #include <AiwServiceHandler.h> |
46 #include <AiwServiceHandler.h> |
47 #include <AiwCommon.hrh> |
47 #include <AiwCommon.hrh> |
48 #include <aiwdialdataext.h> |
48 #include <aiwdialdataext.h> |
49 #include <spsettingsvoiputils.h> |
49 #include <spsettingsvoiputils.h> |
50 |
50 |
|
51 //SPSettings |
|
52 #include <spsettings.h> |
|
53 #include <spproperty.h> |
|
54 |
51 // Debugging headers |
55 // Debugging headers |
52 #include <Pbk2Debug.h> |
56 #include <Pbk2Debug.h> |
53 |
57 |
54 /// Unnamed namespace for local definitions |
58 /// Unnamed namespace for local definitions |
55 namespace { |
59 namespace { |
274 // Set number |
278 // Set number |
275 SetDialDataNumberL( *dialData, *iSelectedField ); |
279 SetDialDataNumberL( *dialData, *iSelectedField ); |
276 |
280 |
277 // We also have select call type by ourselves |
281 // We also have select call type by ourselves |
278 SetCallTypeL( *dialData ); |
282 SetCallTypeL( *dialData ); |
|
283 |
|
284 // If field data has service prefix, extract it and find matched service id |
|
285 // from SP setting, then set the matched service id to daildata. |
|
286 // Service prefix from field data has higher priority over preferred service |
|
287 TPtrC xspId; |
|
288 if ( ExtractXspId( iSelectedField, xspId ) ) |
|
289 { |
|
290 TUint srcId = GetMatchedServiceIdL( xspId ); |
|
291 |
|
292 if ( srcId != (TUint)KErrNotFound ) |
|
293 { |
|
294 dialData->SetServiceId( srcId ); |
|
295 } |
|
296 } |
279 } |
297 } |
280 else |
298 else |
281 { |
299 { |
282 if ( iSelectedField ) |
300 if ( iSelectedField ) |
283 { |
301 { |
424 dialData.SetCallType ( CAiwDialData::EAIWForcedCS); |
442 dialData.SetCallType ( CAiwDialData::EAIWForcedCS); |
425 break; |
443 break; |
426 } |
444 } |
427 } |
445 } |
428 |
446 |
|
447 // -------------------------------------------------------------------------- |
|
448 // CPbk2CallCmd::ExtractXspId |
|
449 // -------------------------------------------------------------------------- |
|
450 // |
|
451 TBool CPbk2CallCmd::ExtractXspId( |
|
452 const MVPbkStoreContactField* aSelectedField, TPtrC& aXSPId ) const |
|
453 { |
|
454 TBool found = EFalse; |
|
455 _LIT( KColon, ":" ); |
|
456 |
|
457 const MVPbkContactFieldData& fieldData = aSelectedField->FieldData(); |
|
458 TPtrC data = GetFieldData( fieldData ); |
|
459 TInt pos = data.Find( KColon ); |
|
460 |
|
461 if ( pos > 0 ) |
|
462 { |
|
463 aXSPId.Set( data.Left( pos ) ); |
|
464 found = ETrue; |
|
465 } |
|
466 |
|
467 return found; |
|
468 } |
|
469 |
|
470 // -------------------------------------------------------------------------- |
|
471 // CPbk2CallCmd::GetMatchedServiceIdL |
|
472 // -------------------------------------------------------------------------- |
|
473 // |
|
474 TServiceId CPbk2CallCmd::GetMatchedServiceIdL( const TDesC& aXSPId ) |
|
475 { |
|
476 TUint ret = ( TUint )KErrNotFound; |
|
477 CDesCArrayFlat* nameArray = NULL; |
|
478 |
|
479 RIdArray ids; |
|
480 CleanupClosePushL( ids ); |
|
481 |
|
482 nameArray = new (ELeave) CDesCArrayFlat( 2 ); |
|
483 CleanupStack::PushL( nameArray ); |
|
484 |
|
485 CSPSettings* settings = CSPSettings::NewLC(); |
|
486 |
|
487 settings->FindServiceIdsL( ids ); |
|
488 settings->FindServiceNamesL( ids, *nameArray ); |
|
489 |
|
490 const TInt count = nameArray->MdcaCount(); |
|
491 for ( TInt i=0; i < count; i++ ) |
|
492 { |
|
493 // Find the mathched service |
|
494 TPtrC name = nameArray->MdcaPoint( i ); |
|
495 if ( !name.CompareF( aXSPId ) ) |
|
496 { |
|
497 // Service found |
|
498 ret = ids[i]; |
|
499 break; |
|
500 } |
|
501 } |
|
502 CleanupStack::PopAndDestroy( 3 ); // ids, nameArray, settings |
|
503 |
|
504 return ret; |
|
505 } |
|
506 |
|
507 // -------------------------------------------------------------------------- |
|
508 // CPbk2CallCmd::GetFieldData |
|
509 // -------------------------------------------------------------------------- |
|
510 // |
|
511 TPtrC CPbk2CallCmd::GetFieldData( const MVPbkContactFieldData& aFieldData ) const |
|
512 { |
|
513 TPtrC text ( KNullDesC() ); |
|
514 |
|
515 switch ( aFieldData.DataType() ) |
|
516 { |
|
517 // Text storage type |
|
518 case EVPbkFieldStorageTypeText: |
|
519 { |
|
520 const MVPbkContactFieldTextData& textData = MVPbkContactFieldTextData::Cast( aFieldData ); |
|
521 text.Set( textData.Text() ); |
|
522 break; |
|
523 } |
|
524 // URI storage type |
|
525 case EVPbkFieldStorageTypeUri: |
|
526 { |
|
527 const MVPbkContactFieldUriData& textData = MVPbkContactFieldUriData::Cast( aFieldData ); |
|
528 text.Set( textData.Text() ); |
|
529 break; |
|
530 } |
|
531 } |
|
532 |
|
533 return text; |
|
534 } |
|
535 |
429 // End of File |
536 // End of File |