phonebookui/Phonebook2/ServerApplication/src/CPbk2AddressSelectPhase.cpp
branchRCL_3
changeset 20 f4a778e096c2
child 21 9da50d567e3c
equal deleted inserted replaced
19:5b6f26637ad3 20:f4a778e096c2
       
     1 /*
       
     2 * Copyright (c) 2005-2007 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:  Phonebook 2 server app address select phase.
       
    15 *
       
    16 */
       
    17 
       
    18 #include "CPbk2AddressSelectPhase.h"
       
    19 
       
    20 // Phonebook 2
       
    21 #include "MPbk2ServicePhaseObserver.h"
       
    22 #include "CPbk2ServerAppAppUi.h"
       
    23 #include "CPbk2KeyEventDealer.h"
       
    24 #include <MPbk2DialogEliminator.h>
       
    25 #include <CPbk2AddressSelect.h>
       
    26 #include <TPbk2AddressSelectParams.h>
       
    27 #include <MPbk2ApplicationServices.h>
       
    28 #include <Pbk2UIControls.rsg>
       
    29 #include <Pbk2Commands.rsg>
       
    30 #include <CPbk2StoreManager.h>
       
    31 
       
    32 // Virtual Phonebook
       
    33 #include <MVPbkContactLink.h>
       
    34 #include <CVPbkContactLinkArray.h>
       
    35 #include <MVPbkContactOperationBase.h>
       
    36 #include <MVPbkStoreContact.h>
       
    37 #include <CVPbkContactManager.h>
       
    38 
       
    39 // System includes
       
    40 #include <barsread.h>
       
    41 #include <avkon.rsg>
       
    42 
       
    43 /// Unnamed namespace for local definitions
       
    44 namespace {
       
    45 
       
    46 const TInt KFirstElement = 0;
       
    47 
       
    48 /**
       
    49  * Copies a link array to another.
       
    50  *
       
    51  * @param aSourceLinkArray    Link array which is copied
       
    52  * @param aTargetLinkArray    Links are copied to this
       
    53  */
       
    54 void CopyContactLinksL( const MVPbkContactLinkArray& aSourceLinkArray,
       
    55         CVPbkContactLinkArray& aTargetLinkArray )
       
    56     {
       
    57     const TInt count = aSourceLinkArray.Count();
       
    58     for ( TInt i(0); i < count; ++i )
       
    59         {
       
    60         const MVPbkContactLink& contactLink = aSourceLinkArray.At(i);
       
    61         aTargetLinkArray.AppendL( contactLink.CloneLC() );
       
    62         CleanupStack::Pop(); // link
       
    63         }
       
    64     }
       
    65 
       
    66 } /// namespace
       
    67 
       
    68 // --------------------------------------------------------------------------
       
    69 // CPbk2AddressSelectPhase::CPbk2AddressSelectPhase
       
    70 // --------------------------------------------------------------------------
       
    71 //
       
    72 CPbk2AddressSelectPhase::CPbk2AddressSelectPhase
       
    73         ( MPbk2ServicePhaseObserver& aObserver,
       
    74           RVPbkContactFieldDefaultPriorities& aPriorities,
       
    75           TBool aRskBack ) :
       
    76             iObserver( aObserver ),
       
    77             iPriorities( aPriorities ),
       
    78             iRskBack( aRskBack )
       
    79     {
       
    80     }
       
    81 
       
    82 // --------------------------------------------------------------------------
       
    83 // CPbk2AddressSelectPhase::~CPbk2AddressSelectPhase
       
    84 // --------------------------------------------------------------------------
       
    85 //
       
    86 CPbk2AddressSelectPhase::~CPbk2AddressSelectPhase()
       
    87     {
       
    88     if ( iAddressSelectEliminator )
       
    89         {
       
    90         iAddressSelectEliminator->ForceExit();
       
    91         }
       
    92     delete iStoreContact;
       
    93     delete iRetrieveOperation;
       
    94     delete iContactLinks;
       
    95     delete iResults;
       
    96     delete iDealer;
       
    97     if ( iThisPtrDestroyed )
       
    98         {
       
    99         *iThisPtrDestroyed = ETrue;
       
   100         }
       
   101     }
       
   102 
       
   103 // --------------------------------------------------------------------------
       
   104 // CPbk2AddressSelectPhase::ConstructL
       
   105 // --------------------------------------------------------------------------
       
   106 //
       
   107 inline void CPbk2AddressSelectPhase::ConstructL
       
   108         ( MVPbkContactLinkArray& aContactLinks,
       
   109           TAiwAddressSelectType aAddressSelectType )
       
   110     {
       
   111     iEikenv = CEikonEnv::Static();
       
   112 
       
   113     iContactLinks = CVPbkContactLinkArray::NewL();
       
   114     // Take a own copy of supplied contact links
       
   115     CopyContactLinksL( aContactLinks, *iContactLinks );
       
   116 
       
   117     iDealer = CPbk2KeyEventDealer::NewL( *this );
       
   118 
       
   119     iResourceId = AddressSelectResourceId( aAddressSelectType );
       
   120     }
       
   121 
       
   122 // --------------------------------------------------------------------------
       
   123 // CPbk2AddressSelectPhase::NewL
       
   124 // --------------------------------------------------------------------------
       
   125 //
       
   126 CPbk2AddressSelectPhase* CPbk2AddressSelectPhase::NewL
       
   127         ( MPbk2ServicePhaseObserver& aObserver,
       
   128           MVPbkContactLinkArray& aContactLinks,
       
   129           RVPbkContactFieldDefaultPriorities& aPriorities,
       
   130           TAiwAddressSelectType aAddressSelectType,
       
   131           TBool aRskBack )
       
   132     {
       
   133     CPbk2AddressSelectPhase* self =
       
   134         new ( ELeave ) CPbk2AddressSelectPhase
       
   135             ( aObserver, aPriorities, aRskBack );
       
   136     CleanupStack::PushL( self );
       
   137     self->ConstructL( aContactLinks, aAddressSelectType );
       
   138     CleanupStack::Pop( self );
       
   139     return self;
       
   140     }
       
   141 
       
   142 // --------------------------------------------------------------------------
       
   143 // CPbk2AddressSelectPhase::LaunchServicePhaseL
       
   144 // --------------------------------------------------------------------------
       
   145 //
       
   146 void CPbk2AddressSelectPhase::LaunchServicePhaseL()
       
   147     {
       
   148     // Start by retrieving first contact
       
   149     RetrieveContactL();
       
   150     }
       
   151 
       
   152 // --------------------------------------------------------------------------
       
   153 // CPbk2AddressSelectPhase::CancelServicePhase
       
   154 // --------------------------------------------------------------------------
       
   155 //
       
   156 void CPbk2AddressSelectPhase::CancelServicePhase()
       
   157     {
       
   158     if ( iAddressSelectEliminator )
       
   159         {
       
   160         iAddressSelectEliminator->ForceExit();
       
   161         }
       
   162 
       
   163     delete iRetrieveOperation;
       
   164     iRetrieveOperation = NULL;
       
   165 
       
   166     // Reset and destroy contact links
       
   167     iContactLinks->ResetAndDestroy();
       
   168 
       
   169     iObserver.PhaseCanceled( *this );
       
   170     }
       
   171 
       
   172 // --------------------------------------------------------------------------
       
   173 // CPbk2AddressSelectPhase::RequestCancelL
       
   174 // --------------------------------------------------------------------------
       
   175 //
       
   176 void CPbk2AddressSelectPhase::RequestCancelL( TInt aExitCommandId )
       
   177     {
       
   178     if ( iAddressSelectEliminator )
       
   179         {
       
   180         iAddressSelectEliminator->RequestExitL( aExitCommandId );
       
   181         }
       
   182 
       
   183     // Withdraw our key event agent so that it does not react to
       
   184     // app shutter's escape key event simulation
       
   185     delete iDealer;
       
   186     iDealer = NULL;
       
   187 
       
   188    if ( aExitCommandId == EEikBidCancel )
       
   189         {
       
   190         iObserver.PhaseAborted( *this );
       
   191         }
       
   192     else
       
   193         {
       
   194         iObserver.PhaseCanceled( *this );
       
   195         }
       
   196     }
       
   197 
       
   198 // --------------------------------------------------------------------------
       
   199 // CPbk2AddressSelectPhase::AcceptDelayed
       
   200 // --------------------------------------------------------------------------
       
   201 //
       
   202 void CPbk2AddressSelectPhase::AcceptDelayedL
       
   203         ( const TDesC8& /*aContactLinkBuffer*/ )
       
   204     {
       
   205     // Nothing to accept
       
   206     }
       
   207 
       
   208 // --------------------------------------------------------------------------
       
   209 // CPbk2AddressSelectPhase::DenyDelayed
       
   210 // --------------------------------------------------------------------------
       
   211 //
       
   212 void CPbk2AddressSelectPhase::DenyDelayedL
       
   213         ( const TDesC8& /*aContactLinkBuffer*/ )
       
   214     {
       
   215     // Nothing to deny
       
   216     }
       
   217 
       
   218 // --------------------------------------------------------------------------
       
   219 // CPbk2AddressSelectPhase::Results
       
   220 // --------------------------------------------------------------------------
       
   221 //
       
   222 MVPbkContactLinkArray* CPbk2AddressSelectPhase::Results() const
       
   223     {
       
   224     return iResults;
       
   225     }
       
   226 
       
   227 // --------------------------------------------------------------------------
       
   228 // CPbk2AddressSelectPhase::ExtraResultData
       
   229 // --------------------------------------------------------------------------
       
   230 //
       
   231 TInt CPbk2AddressSelectPhase::ExtraResultData() const
       
   232     {
       
   233     return KErrNotSupported;
       
   234     }
       
   235 
       
   236 // --------------------------------------------------------------------------
       
   237 // CPbk2AddressSelectPhase::TakeStoreContact
       
   238 // --------------------------------------------------------------------------
       
   239 //
       
   240 MVPbkStoreContact* CPbk2AddressSelectPhase::TakeStoreContact()
       
   241     {
       
   242     MVPbkStoreContact* contact = iStoreContact;
       
   243     iStoreContact = NULL;
       
   244     return contact;
       
   245     }
       
   246 
       
   247 // --------------------------------------------------------------------------
       
   248 // CPbk2AddressSelectPhase::FieldContent
       
   249 // --------------------------------------------------------------------------
       
   250 //
       
   251 HBufC* CPbk2AddressSelectPhase::FieldContent() const
       
   252     {
       
   253     return NULL;
       
   254     }
       
   255 
       
   256 // --------------------------------------------------------------------------
       
   257 // CPbk2AddressSelectPhase::VPbkSingleContactOperationComplete
       
   258 // --------------------------------------------------------------------------
       
   259 //
       
   260 void CPbk2AddressSelectPhase::VPbkSingleContactOperationComplete
       
   261         ( MVPbkContactOperationBase& /*aOperation*/,
       
   262           MVPbkStoreContact* aContact )
       
   263     {
       
   264     // Contact retrieval complete
       
   265     delete iStoreContact;
       
   266     iStoreContact = aContact;
       
   267 
       
   268     // Run the address select
       
   269     TRAPD( err, DoSelectAddressesL() );
       
   270 
       
   271     if ( err != KErrNone )
       
   272         {
       
   273         // Deregister store events if something went wrong.
       
   274         CPbk2ServerAppAppUi& appUi = static_cast<CPbk2ServerAppAppUi&>
       
   275             ( *iEikenv->EikAppUi() );
       
   276         appUi.StoreManager().DeregisterStoreEvents( *this );
       
   277 
       
   278         iObserver.PhaseError( *this, err );
       
   279         }
       
   280     }
       
   281 
       
   282 // --------------------------------------------------------------------------
       
   283 // CPbk2AddressSelectPhase::VPbkSingleContactOperationFailed
       
   284 // --------------------------------------------------------------------------
       
   285 //
       
   286 void CPbk2AddressSelectPhase::VPbkSingleContactOperationFailed
       
   287         ( MVPbkContactOperationBase& /*aOperation*/, TInt aError )
       
   288     {
       
   289     iObserver.PhaseError( *this, aError );
       
   290     }
       
   291 
       
   292 // --------------------------------------------------------------------------
       
   293 // CPbk2AddressSelectPhase::Pbk2ProcessKeyEventL
       
   294 // --------------------------------------------------------------------------
       
   295 //
       
   296 TBool CPbk2AddressSelectPhase::Pbk2ProcessKeyEventL
       
   297         ( const TKeyEvent& aKeyEvent, TEventCode aType )
       
   298     {
       
   299     TBool ret = EFalse;
       
   300 
       
   301     if ( aType == EEventKey && aKeyEvent.iCode == EKeyEscape )
       
   302         {
       
   303         iObserver.PhaseOkToExit( *this, EEikBidCancel );
       
   304         ret = ETrue;
       
   305         }
       
   306 
       
   307     return ret;
       
   308     }
       
   309 
       
   310 // --------------------------------------------------------------------------
       
   311 // CPbk2AddressSelectPhase::StoreReady
       
   312 // --------------------------------------------------------------------------
       
   313 //
       
   314 void CPbk2AddressSelectPhase::StoreReady(
       
   315     MVPbkContactStore& /*aContactStore*/ )
       
   316     {
       
   317     // not interested
       
   318     }
       
   319 
       
   320 // --------------------------------------------------------------------------
       
   321 // CPbk2AddressSelectPhase::StoreUnavailable
       
   322 // --------------------------------------------------------------------------
       
   323 //
       
   324 void CPbk2AddressSelectPhase::StoreUnavailable(
       
   325     MVPbkContactStore& /*aContactStore*/,
       
   326     TInt /*aReason*/ )
       
   327     {
       
   328     // not interested
       
   329     }
       
   330 
       
   331 // --------------------------------------------------------------------------
       
   332 // CPbk2AttributeAddressSelectPhase::StoreUnavailable
       
   333 // --------------------------------------------------------------------------
       
   334 //
       
   335 void CPbk2AddressSelectPhase::HandleStoreEventL(
       
   336      MVPbkContactStore& /*aContactStore*/,
       
   337      TVPbkContactStoreEvent aEvent )
       
   338     {
       
   339     if ( aEvent.iContactLink != NULL && iStoreContact != NULL )
       
   340         {
       
   341         if ( aEvent.iContactLink->RefersTo( *iStoreContact ) )
       
   342             {
       
   343             CancelServicePhase();
       
   344             }
       
   345         }
       
   346     }
       
   347 
       
   348 // --------------------------------------------------------------------------
       
   349 // CPbk2AddressSelectPhase::RetrieveContactL
       
   350 // --------------------------------------------------------------------------
       
   351 //
       
   352 void CPbk2AddressSelectPhase::RetrieveContactL()
       
   353     {
       
   354     CPbk2ServerAppAppUi& appUi = static_cast<CPbk2ServerAppAppUi&>
       
   355         ( *iEikenv->EikAppUi() );
       
   356 
       
   357     // Fetch one contact at a time if service cancellation is not
       
   358     // commanded.
       
   359     if ( iContactLinks && iContactLinks->Count() > 0 )
       
   360         {
       
   361         delete iRetrieveOperation;
       
   362         iRetrieveOperation = NULL;
       
   363         iRetrieveOperation = appUi.ApplicationServices().ContactManager().
       
   364             RetrieveContactL( iContactLinks->At( KFirstElement ), *this );
       
   365         }
       
   366     else
       
   367         {
       
   368         iObserver.NextPhase( *this );
       
   369         }
       
   370     }
       
   371 
       
   372 // --------------------------------------------------------------------------
       
   373 // CPbk2AddressSelectPhase::DoSelectAddressesL
       
   374 // --------------------------------------------------------------------------
       
   375 //
       
   376 void CPbk2AddressSelectPhase::DoSelectAddressesL()
       
   377     {
       
   378     // If field has already given use it prior to default field.
       
   379     MVPbkStoreContactField* field = CheckIfFieldAlreadySelectedLC();
       
   380 
       
   381     TResourceReader reader;
       
   382     CCoeEnv::Static()->CreateResourceReaderLC( reader, iResourceId );
       
   383 
       
   384     CPbk2ServerAppAppUi& appUi = static_cast<CPbk2ServerAppAppUi&>
       
   385         ( *iEikenv->EikAppUi() );
       
   386 
       
   387     TPbk2AddressSelectParams params
       
   388         ( *iStoreContact, appUi.ApplicationServices().ContactManager(),
       
   389           appUi.ApplicationServices().NameFormatter(),
       
   390           appUi.ApplicationServices().FieldProperties(),
       
   391           reader, iTitleResId );
       
   392 
       
   393     // If default priorities are set use defaults directly.
       
   394     params.SetDefaultPriorities( iPriorities );
       
   395 
       
   396     if ( field )
       
   397         {
       
   398         params.SetFocusedField( field );
       
   399         // If we have field focused we don't launch call directly using
       
   400         // default number. The number selection dialog should be shown.
       
   401         params.SetUseDefaultDirectly( EFalse );
       
   402         }
       
   403     else
       
   404         {
       
   405         // Launch call directly using default values.
       
   406         params.SetUseDefaultDirectly( ETrue );
       
   407         }
       
   408 
       
   409     CPbk2AddressSelect* addressSelect =
       
   410         CPbk2AddressSelect::NewL( params );
       
   411 
       
   412     // Correct CBA buttons
       
   413     TInt correctedCba = CorrectRSK( iResourceId );
       
   414     if ( correctedCba > KErrNone )
       
   415         {
       
   416         addressSelect->SetCba( correctedCba );
       
   417         }
       
   418 
       
   419     // Execute
       
   420     iAddressSelectEliminator = addressSelect;
       
   421     iAddressSelectEliminator->ResetWhenDestroyed
       
   422         ( &iAddressSelectEliminator );
       
   423 
       
   424     appUi.StoreManager().RegisterStoreEventsL( *this );
       
   425     
       
   426     TBool amIDestroyed( EFalse );
       
   427     iThisPtrDestroyed = &amIDestroyed;    
       
   428     
       
   429     MVPbkStoreContactField* resultField = addressSelect->ExecuteLD();
       
   430     appUi.StoreManager().DeregisterStoreEvents( *this );
       
   431     CleanupStack::PopAndDestroy(); // reader
       
   432 
       
   433     if ( amIDestroyed )
       
   434         {        
       
   435         return;
       
   436         }
       
   437     
       
   438     //Reset
       
   439     iThisPtrDestroyed = NULL;
       
   440     if ( resultField )
       
   441         {
       
   442         CleanupDeletePushL(resultField);
       
   443         AddFieldToResultsAndContinueL(resultField);
       
   444         CleanupStack::PopAndDestroy(); // resultField
       
   445         }
       
   446     else
       
   447         {
       
   448         if ( !iContactLinks->Count() && !iResults )
       
   449             {
       
   450             // Normal cancellation and there is no results
       
   451             // to be sent to caller
       
   452             iObserver.PhaseCanceled( *this );
       
   453             }
       
   454         else
       
   455             {
       
   456             // Although contact does not contain any selectable fields
       
   457             // address  fetching is continued because there is more
       
   458             // contacts left or some valid addresses are already selected
       
   459             RetrieveContactL();
       
   460             }
       
   461         }
       
   462 
       
   463     if ( field )
       
   464         {
       
   465         CleanupStack::PopAndDestroy();
       
   466         }
       
   467     }
       
   468 
       
   469 // --------------------------------------------------------------------------
       
   470 // CPbk2AddressSelectPhase::CorrectRSK
       
   471 // --------------------------------------------------------------------------
       
   472 //
       
   473 inline TInt CPbk2AddressSelectPhase::CorrectRSK
       
   474         ( TInt aAddressSelectResourceId )
       
   475     {
       
   476     TInt result = KErrNone;
       
   477 
       
   478     if ( iRskBack )
       
   479         {
       
   480         switch ( aAddressSelectResourceId )
       
   481             {
       
   482             case R_PBK2_GENERIC_ADDRESS_SELECT:
       
   483             case R_PBK2_PHONE_NUMBER_SELECT:
       
   484             case R_PBK2_VIDEO_NUMBER_SELECT:
       
   485             case R_PBK2_EMAIL_ADDRESS_SELECT:
       
   486             case R_PBK2_EMAIL_OVER_SMS_ADDRESS_SELECT:
       
   487             case R_PBK2_MMS_ADDRESS_SELECT:
       
   488             case R_PBK2_POC_ADDRESS_SELECT:
       
   489             case R_PBK2_VOIP_ADDRESS_SELECT:
       
   490             case R_PBK2_DTMF_PHONE_NUMBER_SELECT:
       
   491             case R_PBK2_THUMBNAIL_SELECT:
       
   492             case R_PBK2_CALL_ITEM_NUMBER_SELECT:
       
   493                 {
       
   494                 result = R_AVKON_SOFTKEYS_SELECT_BACK__SELECT;
       
   495                 break;
       
   496                 }
       
   497 
       
   498             default:
       
   499                 {
       
   500                 // Do nothing
       
   501                 break;
       
   502                 }
       
   503             }
       
   504         }
       
   505 
       
   506     return result;
       
   507     }
       
   508 
       
   509 // --------------------------------------------------------------------------
       
   510 // CPbk2AddressSelectPhase::CheckIfFieldAlreadySelectedLC
       
   511 // --------------------------------------------------------------------------
       
   512 //
       
   513 inline MVPbkStoreContactField*
       
   514         CPbk2AddressSelectPhase::CheckIfFieldAlreadySelectedLC()
       
   515     {
       
   516     const MVPbkContactLink& contactLink = iContactLinks->At( KFirstElement );
       
   517     MVPbkStoreContactFieldCollection& fields = iStoreContact->Fields();
       
   518     MVPbkStoreContactField* field = fields.RetrieveField(contactLink);
       
   519     iContactLinks->Delete( KFirstElement );
       
   520     if ( field )
       
   521         {
       
   522         // Use CloneLC to avoid unwanted behaviour. Field collection might
       
   523         // mess up the field reference.
       
   524         return field->CloneLC();
       
   525         }
       
   526     return NULL;
       
   527     }
       
   528 
       
   529 // --------------------------------------------------------------------------
       
   530 // CPbk2AddressSelectPhase::AddFieldToResultsL
       
   531 // --------------------------------------------------------------------------
       
   532 //
       
   533 void CPbk2AddressSelectPhase::AddFieldToResultsAndContinueL
       
   534         ( MVPbkStoreContactField* aField )
       
   535     {
       
   536     // Add the results
       
   537     AppendResultL( aField );
       
   538 
       
   539     // Continue with next contact
       
   540     RetrieveContactL();
       
   541     }
       
   542 
       
   543 // --------------------------------------------------------------------------
       
   544 // CPbk2AddressSelectPhase::AppendResultL
       
   545 // --------------------------------------------------------------------------
       
   546 //
       
   547 void CPbk2AddressSelectPhase::AppendResultL
       
   548         ( const MVPbkStoreContactField* aField )
       
   549     {
       
   550     if ( aField )
       
   551         {
       
   552         // Add the contact link to the result array
       
   553         MVPbkContactLink* link = aField->CreateLinkLC();
       
   554         if ( link )
       
   555             {
       
   556             if ( !iResults )
       
   557                 {
       
   558                 iResults = CVPbkContactLinkArray::NewL();
       
   559                 }
       
   560 
       
   561             CleanupStack::Pop(); // aField->CreateLinkLC()
       
   562 
       
   563             iResults->AppendL( link );
       
   564             }
       
   565         }
       
   566     }
       
   567 
       
   568 
       
   569 // --------------------------------------------------------------------------
       
   570 // CPbk2AddressSelectPhase::AddressSelectResourceId
       
   571 // --------------------------------------------------------------------------
       
   572 //
       
   573 inline TInt CPbk2AddressSelectPhase::AddressSelectResourceId
       
   574         ( TAiwAddressSelectType aType )
       
   575     {
       
   576     TInt result = KErrNotFound;
       
   577     iTitleResId = 0;    // default is 0
       
   578     switch ( aType )
       
   579         {
       
   580         case EAiwAllItemsSelect:
       
   581             {
       
   582             result = R_PBK2_GENERIC_ADDRESS_SELECT;
       
   583             break;
       
   584             }
       
   585 
       
   586         case EAiwPhoneNumberSelect:
       
   587             {
       
   588             result = R_PBK2_PHONE_NUMBER_SELECT;
       
   589             break;
       
   590             }
       
   591 
       
   592         case EAiwCallItemSelect:
       
   593             {
       
   594             result = R_PBK2_CALL_ITEM_NUMBER_SELECT;
       
   595             iTitleResId = R_QTN_PHOB_QTL_CALL_TO_NAME;
       
   596             break;
       
   597             }
       
   598 
       
   599         case EAiwVideoNumberSelect:
       
   600             {
       
   601             result = R_PBK2_VIDEO_NUMBER_SELECT;
       
   602             break;
       
   603             }
       
   604 
       
   605         case EAiwPOCNumberSelect:
       
   606             {
       
   607             result =  R_PBK2_POC_ADDRESS_SELECT;
       
   608             break;
       
   609             }
       
   610 
       
   611         case EAiwEMailSelect:
       
   612             {
       
   613             result = R_PBK2_EMAIL_ADDRESS_SELECT;
       
   614             break;
       
   615             }
       
   616 
       
   617         case EAiwMMSSelect:
       
   618             {
       
   619             CPbk2ServerAppAppUi& appUi = static_cast<CPbk2ServerAppAppUi&>
       
   620                 ( *iEikenv->EikAppUi() );
       
   621 
       
   622             if (appUi.ApplicationServices().
       
   623                 LocallyVariatedFeatureEnabled( EVPbkLVShowEmailInSendMsg ))
       
   624                 {
       
   625                 // Email fields included
       
   626                 result = R_PBK2_MMS_ADDRESS_SELECT;
       
   627                 }
       
   628             else
       
   629                 {
       
   630                 result = R_PBK2_SMS_ADDRESS_SELECT;
       
   631                 }
       
   632             break;
       
   633             }
       
   634 
       
   635         case EAiwSMSEMailSelect:
       
   636             {
       
   637             result = R_PBK2_EMAIL_OVER_SMS_ADDRESS_SELECT;
       
   638             break;
       
   639             }
       
   640 
       
   641         case EAiwVOIPSelect:
       
   642             {
       
   643             result = R_PBK2_VOIP_ADDRESS_SELECT;
       
   644             break;
       
   645             }
       
   646 
       
   647         case EAiwVoIPItemSelect:
       
   648             {
       
   649             result = R_PBK2_VOIP_ITEM_ADDRESS_SELECT;
       
   650             iTitleResId = R_QTN_PHOB_QTL_CALL_TO_NAME;
       
   651             break;
       
   652             }
       
   653 
       
   654         case EAiwSIPSelect:
       
   655             {
       
   656             result = R_PBK2_SIP_ADDRESS_SELECT;
       
   657             break;
       
   658             }
       
   659 
       
   660         case EAiwSIPMSISDNSelect:
       
   661             {
       
   662             result = R_PBK2_SIP_MSISDN_ADDRESS_SELECT;
       
   663             break;
       
   664             }
       
   665 
       
   666         case EAiwThumbnailSelect:
       
   667             {
       
   668             result = R_PBK2_THUMBNAIL_SELECT;
       
   669             break;
       
   670             }
       
   671 
       
   672         case EAiwDTMFPhoneNumberSelect:
       
   673             {
       
   674             result = R_PBK2_DTMF_PHONE_NUMBER_SELECT;
       
   675             break;
       
   676             };
       
   677 
       
   678         default:
       
   679             {
       
   680             // Do nothing
       
   681             break;
       
   682             }
       
   683         }
       
   684 
       
   685     return result;
       
   686     }
       
   687 
       
   688 // End of File