phonebookui/Phonebook2/UIControls/src/CPbk2AddressSelect.cpp
branchRCL_3
changeset 21 b3431bff8c19
parent 0 e686773b3f54
child 64 c1e8ba0c2b16
equal deleted inserted replaced
15:e8e3147d53eb 21:b3431bff8c19
    27 #include <MPbk2ApplicationServices.h>
    27 #include <MPbk2ApplicationServices.h>
    28 #include <MPbk2ApplicationServices2.h>
    28 #include <MPbk2ApplicationServices2.h>
    29 #include <CPbk2ServiceManager.h>
    29 #include <CPbk2ServiceManager.h>
    30 #include <MPbk2AppUi.h>
    30 #include <MPbk2AppUi.h>
    31 #include <Pbk2UIControls.rsg>
    31 #include <Pbk2UIControls.rsg>
       
    32 #include <Pbk2Commands.rsg>
    32 #include <CPbk2ApplicationServices.h>
    33 #include <CPbk2ApplicationServices.h>
    33 #include <TPbk2StoreContactAnalyzer.h>
    34 #include <TPbk2StoreContactAnalyzer.h>
    34 
    35 
    35 // Virtual Phonebook
    36 // Virtual Phonebook
    36 #include <CVPbkFieldFilter.h>
    37 #include <CVPbkFieldFilter.h>
    51 
    52 
    52 //SpSettings
    53 //SpSettings
    53 #include <spsettings.h>
    54 #include <spsettings.h>
    54 #include <spentry.h>
    55 #include <spentry.h>
    55 #include <spproperty.h>
    56 #include <spproperty.h>
       
    57 #include <spsettingsvoiputils.h>
    56 
    58 
    57 /// Unnamed namespace for local definitions
    59 /// Unnamed namespace for local definitions
    58 namespace {
    60 namespace {
    59 
    61 
    60 #ifdef _DEBUG
    62 #ifdef _DEBUG
   689             }
   691             }
   690         }
   692         }
   691     }
   693     }
   692 
   694 
   693 // --------------------------------------------------------------------------
   695 // --------------------------------------------------------------------------
       
   696 // CPbk2AddressSelect::IsVoiceCallExistL
       
   697 // --------------------------------------------------------------------------
       
   698 //
       
   699 inline TBool CPbk2AddressSelect::IsVoiceCallExistL()
       
   700     {
       
   701     TInt countFields = iParams.iContact.Fields().FieldCount();
       
   702     TPbk2StoreContactAnalyzer analyzer( iParams.iContactManager, NULL );
       
   703 
       
   704     for ( TInt i = 0; i < countFields; i++ )
       
   705         {
       
   706         const MVPbkStoreContactField& field =
       
   707             iParams.iContact.Fields().FieldAt( i );
       
   708         
       
   709         // If the field is voice call, then return ETrue.
       
   710         if ( analyzer.IsFieldTypeIncludedL( field, R_PHONEBOOK2_PHONENUMBER_SELECTOR ) )
       
   711             {
       
   712             return ETrue;
       
   713             }
       
   714         }
       
   715     
       
   716     // No voice call filed, return EFalse.    
       
   717     return EFalse;
       
   718     }
       
   719 
       
   720 // --------------------------------------------------------------------------
       
   721 // CPbk2AddressSelect::GetVoiceAndVOIPCallDialogTitleL
       
   722 // --------------------------------------------------------------------------
       
   723 //
       
   724 inline HBufC* CPbk2AddressSelect::GetVoiceAndVOIPCallDialogTitleL()
       
   725     {
       
   726     HBufC* title (NULL);
       
   727     
       
   728     // If the popped up dialog is started in namelist view.
       
   729     // Then, the title of the dialog should obey such rules:
       
   730     // 1. When there are only VoIP addresses for contact or if VoIP is preferred.
       
   731     // Then show "Internet call:"
       
   732     // 2. In other cases show "Call:". This would be shown when:
       
   733     // 2.1 VoIP is not preferred and there's at least one Voice call number for the contact
       
   734     // 2.2 So even in case when there's only voice call numbers.
       
   735     // The title should be "Call:" instead of "Voice call:" 
       
   736     if ( iParams.iTitleResId == R_QTN_PHOB_QTL_CALL_TO_NAME )
       
   737         {
       
   738         // Check whether VoIP is preferred.
       
   739         CSPSettingsVoIPUtils* sPSettings = CSPSettingsVoIPUtils::NewLC();
       
   740         if ( sPSettings->IsPreferredTelephonyVoIP() ||
       
   741              !IsVoiceCallExistL() )
       
   742         	{
       
   743         	title = GetVOIPDialogTitleL();
       
   744         	}
       
   745         else
       
   746         	{
       
   747         	title = StringLoader::LoadL( R_QTN_PHOB_TITLE_POPUP_CALL );
       
   748         	}
       
   749         CleanupStack::PopAndDestroy( sPSettings ); 
       
   750         }
       
   751     else if ( iParams.iCommMethod == VPbkFieldTypeSelectorFactory::EVoiceCallSelector )
       
   752         {                               
       
   753         title =  StringLoader::LoadL( R_QTN_CCA_POPUP_VOICE_CALL );
       
   754         }
       
   755     else if ( iParams.iCommMethod == VPbkFieldTypeSelectorFactory::EVOIPCallSelector )
       
   756         {
       
   757         title = GetVOIPDialogTitleL();
       
   758         }	
       
   759     return title;
       
   760     }
       
   761 	
       
   762 // --------------------------------------------------------------------------
   694 // CPbk2AddressSelect::LoadDialogTitleL
   763 // CPbk2AddressSelect::LoadDialogTitleL
   695 // --------------------------------------------------------------------------
   764 // --------------------------------------------------------------------------
   696 //
   765 //
   697 inline HBufC* CPbk2AddressSelect::LoadDialogTitleL()
   766 inline HBufC* CPbk2AddressSelect::LoadDialogTitleL()
   698     {
   767     {
   699     HBufC* title = NULL;
   768     HBufC* title = NULL;
   700     switch( iParams.iCommMethod )
   769     switch( iParams.iCommMethod )
   701         {
   770         {
   702         case VPbkFieldTypeSelectorFactory::EVoiceCallSelector:
   771         case VPbkFieldTypeSelectorFactory::EVoiceCallSelector:
   703             {
   772         case VPbkFieldTypeSelectorFactory::EVOIPCallSelector:
   704             title = StringLoader::LoadL( R_QTN_PHOB_TITLE_POPUP_CALL );
   773             {
       
   774             title = GetVoiceAndVOIPCallDialogTitleL();
   705             break;
   775             break;
   706             }
   776             }
       
   777         	
   707         case VPbkFieldTypeSelectorFactory::EUniEditorSelector:
   778         case VPbkFieldTypeSelectorFactory::EUniEditorSelector:
   708             {
   779             {
   709             title = StringLoader::LoadL( R_QTN_PHOB_TITLE_POPUP_MESSAGE );
   780             title = StringLoader::LoadL( R_QTN_PHOB_TITLE_POPUP_MESSAGE );
   710             break;
   781             break;
   711             }
   782             }
   716             }
   787             }
   717         case VPbkFieldTypeSelectorFactory::EInstantMessagingSelector:
   788         case VPbkFieldTypeSelectorFactory::EInstantMessagingSelector:
   718             {
   789             {
   719             title = StringLoader::LoadL( R_QTN_PHOB_TITLE_POPUP_CHAT );
   790             title = StringLoader::LoadL( R_QTN_PHOB_TITLE_POPUP_CHAT );
   720             break;
   791             break;
   721             }
   792             }    
   722         case VPbkFieldTypeSelectorFactory::EVOIPCallSelector:
       
   723             {
       
   724             title = GetVOIPDialogTitleL();
       
   725             break;
       
   726             }       
       
   727         case VPbkFieldTypeSelectorFactory::EURLSelector:
   793         case VPbkFieldTypeSelectorFactory::EURLSelector:
   728             {
   794             {
   729             title = StringLoader::LoadL( R_QTN_PHOB_TITLE_POPUP_URL );
   795             title = StringLoader::LoadL( R_QTN_PHOB_TITLE_POPUP_URL );
   730             break;
   796             break;
   731             }
   797             }