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