voiceui/pbkinfoviewimpl/src/pbkinfoviewdialog.cpp
branchRCL_3
changeset 12 fc313e1df071
parent 0 bf1d17376201
child 15 6347473a7bb2
equal deleted inserted replaced
11:b2f9a76933e1 12:fc313e1df071
    35 #include <csxhelp/vc.hlp.hrh>  // for help text id
    35 #include <csxhelp/vc.hlp.hrh>  // for help text id
    36 #include <eikmenub.h>  // CEikMenuBar
    36 #include <eikmenub.h>  // CEikMenuBar
    37 #include <PbkIconId.hrh> // Phonebook icon ids
    37 #include <PbkIconId.hrh> // Phonebook icon ids
    38 #include <aknnotewrappers.h>  // For information note
    38 #include <aknnotewrappers.h>  // For information note
    39 #include <StringLoader.h>
    39 #include <StringLoader.h>
       
    40 
       
    41 #include <MPbk2FieldPropertyArray.h>
       
    42 #include <VPbkEng.rsg>
       
    43 #include <CPbk2StoreConfiguration.h>
       
    44 #include <CVPbkContactStoreUriArray.h>
       
    45 #include <CVPbkContactManager.h>
       
    46 #include <VPbkContactStoreUris.h>
       
    47 #include <CVPbkFieldTypeRefsList.h>	
       
    48 #include <CPbk2IconFactory.h>
       
    49 #include <Pbk2FieldPropertiesFactory.h>
       
    50 #include <MPbk2FieldProperty.h>
       
    51 #include <TVPbkContactStoreUriPtr.h>
       
    52 #include <PbkFields.hrh>
       
    53 
       
    54 const TUint KFieldIds[] = 
       
    55     {
       
    56     R_VPBK_FIELD_TYPE_LANDPHONEGEN,    
       
    57     R_VPBK_FIELD_TYPE_MOBILEPHONEGEN,  
       
    58     R_VPBK_FIELD_TYPE_VIDEONUMBERGEN,
       
    59     R_VPBK_FIELD_TYPE_VOIPGEN,
       
    60     R_VPBK_FIELD_TYPE_EMAILGEN,
       
    61     R_VPBK_FIELD_TYPE_IMPP
       
    62     };
    40 
    63 
    41 // ============================ MEMBER FUNCTIONS ===============================
    64 // ============================ MEMBER FUNCTIONS ===============================
    42 
    65 
    43 // -----------------------------------------------------------------------------
    66 // -----------------------------------------------------------------------------
    44 // CPbkInfoViewDialog::NewL
    67 // CPbkInfoViewDialog::NewL
   445     	iListBox->View()->SetListEmptyTextL( *des );
   468     	iListBox->View()->SetListEmptyTextL( *des );
   446 	    }
   469 	    }
   447 	CleanupStack::PopAndDestroy( des );
   470 	CleanupStack::PopAndDestroy( des );
   448     
   471     
   449     // Set icons
   472     // Set icons
   450 	TFileName bitmapName;
   473 
   451 	CPbkInfoViewResHandler::GetBitmapFileName( bitmapName );
       
   452 	CArrayPtr<CGulIcon>* icons = new (ELeave) CAknIconArray( KDefaultArraySize );
   474 	CArrayPtr<CGulIcon>* icons = new (ELeave) CAknIconArray( KDefaultArraySize );
   453 	CleanupStack::PushL( icons );
   475 	CleanupStack::PushL( icons );
   454 	
   476 	
   455 	// NOTE: icons must be appended in the order of enumeration 
   477 	CreateFieldIconsL( icons );
   456 	// TInfoViewDialogIconIndex
   478     
   457 	icons->AppendL( TDialogUtil::CreateIconL(
   479     CleanupStack::Pop( icons );
   458 	                KAknsIIDQgnPropNrtypMobile, bitmapName,
       
   459 	                EMbmAvkonQgn_prop_nrtyp_mobile, 
       
   460 	                EMbmAvkonQgn_prop_nrtyp_mobile_mask ) );
       
   461 	
       
   462 	icons->AppendL( TDialogUtil::CreateIconL( 
       
   463 	                KAknsIIDQgnPropNrtypPhone, bitmapName,
       
   464 	                EMbmAvkonQgn_prop_nrtyp_phone,
       
   465 	                EMbmAvkonQgn_prop_nrtyp_phone_mask ) );
       
   466 	                
       
   467 	icons->AppendL( TDialogUtil::CreateIconL( 
       
   468 	                KAknsIIDQgnPropFolderVideo, bitmapName,
       
   469 	                EMbmAvkonQgn_prop_nrtyp_video,
       
   470 	                EMbmAvkonQgn_prop_nrtyp_video_mask ) );
       
   471 	                
       
   472 	icons->AppendL( TDialogUtil::CreateIconL(
       
   473 	                KAknsIIDQgnPropMceEmailTitle, bitmapName,
       
   474 	                EMbmAvkonQgn_prop_nrtyp_email,
       
   475 	                EMbmAvkonQgn_prop_nrtyp_email_mask ) );
       
   476 	                
       
   477 	icons->AppendL( TDialogUtil::CreateIconL(
       
   478 	                KAknsIIDQgnIndiVoipCallActive, bitmapName,
       
   479 	                EMbmAvkonQgn_prop_nrtyp_voip,
       
   480 	                EMbmAvkonQgn_prop_nrtyp_voip_mask ) );
       
   481 	
       
   482 	icons->AppendL( TDialogUtil::CreateIconL(
       
   483 	                KAknsIIDQgnLogoEmpty, bitmapName,
       
   484 	                EMbmAvkonQgn_prop_empty,
       
   485 	                EMbmAvkonQgn_prop_empty_mask ) );
       
   486 	
       
   487 	iListBox->ItemDrawer()->FormattedCellData()->SetIconArrayL( icons );
       
   488 	CleanupStack::Pop( icons );
       
   489 
   480 
   490 	CreateListBoxItemsL();
   481 	CreateListBoxItemsL();
   491 	
   482 	
   492 	iListBox->UpdateScrollBarsL();
   483 	iListBox->UpdateScrollBarsL();
   493 	iListBox->ScrollBarFrame()->MoveVertThumbTo( 0 );
   484 	iListBox->ScrollBarFrame()->MoveVertThumbTo( 0 );
   541 		    break;
   532 		    break;
   542 		case EPbkqgn_prop_nrtyp_email:
   533 		case EPbkqgn_prop_nrtyp_email:
   543 		    iconIndex = EIconIndexEmail;
   534 		    iconIndex = EIconIndexEmail;
   544 		    break;
   535 		    break;
   545 		case EPbkqgn_prop_nrtyp_voip:
   536 		case EPbkqgn_prop_nrtyp_voip:
   546 		    iconIndex = EIconIndexVoip;
   537 			if ( isXsp )
       
   538 				{
       
   539 				iconIndex = EIconIndexXsp;
       
   540 				}
       
   541 			else
       
   542 				{
       
   543 				iconIndex = EIconIndexVoip;
       
   544 				}
   547 		    break;
   545 		    break;
   548 		default:
   546 		default:
   549 		    iconIndex = EIconIndexEmpty;    
   547 		    iconIndex = EIconIndexEmpty;    
   550 		    break;
   548 		    break;
   551 		}
   549 		}
   574 		{
   572 		{
   575 		// Line header
   573 		// Line header
   576 		HBufC* firstLine = iSindHandler->VoiceTagLabelLC( i );
   574 		HBufC* firstLine = iSindHandler->VoiceTagLabelLC( i );
   577 		// Phone number, email address, etc...
   575 		// Phone number, email address, etc...
   578 		HBufC* secondLine = iSindHandler->VoiceTagValueL( i ).AllocLC();
   576 		HBufC* secondLine = iSindHandler->VoiceTagValueL( i ).AllocLC();
       
   577         isXsp = EFalse;
       
   578 		if( iSindHandler->FieldIdL() == EPbkFieldIdXsp )
       
   579 			{
       
   580 			isXsp = ETrue;
       
   581 			}
   579 		TInt iconIndex = IconIndex( iSindHandler->IconIdL( i ) );
   582 		TInt iconIndex = IconIndex( iSindHandler->IconIdL( i ) );
   580 
   583 
   581 		TPtr ptr1 = firstLine->Des();
   584 		TPtr ptr1 = firstLine->Des();
   582 		AknTextUtils::DisplayTextLanguageSpecificNumberConversion( ptr1 );
   585 		AknTextUtils::DisplayTextLanguageSpecificNumberConversion( ptr1 );
   583 		TPtr ptr2 = secondLine->Des();
   586 		TPtr ptr2 = secondLine->Des();
   700     dialog->ExecuteLD( *noteText );
   703     dialog->ExecuteLD( *noteText );
   701     
   704     
   702     CleanupStack::PopAndDestroy( noteText );
   705     CleanupStack::PopAndDestroy( noteText );
   703 	}
   706 	}
   704 
   707 
       
   708 void CPbkInfoViewDialog::CreateFieldIconsL(CArrayPtr<CGulIcon>* aIconArray)
       
   709 	{
       
   710     CPbk2StoreConfiguration* configuration = CPbk2StoreConfiguration::NewL();
       
   711     CleanupStack::PushL(configuration);
       
   712 	    
       
   713     CVPbkContactStoreUriArray* uriArray = configuration->CurrentConfigurationL();
       
   714     CleanupStack::PushL( uriArray ); 
       
   715     if ( uriArray->IsIncluded(VPbkContactStoreUris::DefaultCntDbUri()) == EFalse )
       
   716         {
       
   717         uriArray->AppendL( VPbkContactStoreUris::DefaultCntDbUri() );	
       
   718 	    }    
       
   719     
       
   720     CVPbkContactManager* contactManager = CVPbkContactManager::NewL(*uriArray);
       
   721     CleanupStack::PushL( contactManager );
       
   722 	    
       
   723     TInt arraySize = sizeof KFieldIds / sizeof KFieldIds[0];
       
   724     TInt count =0;
       
   725     const MVPbkFieldType* fieldType = NULL;
       
   726     CGulIcon* icon = NULL;
       
   727 			
       
   728     CVPbkFieldTypeRefsList* fieldTypeList = CVPbkFieldTypeRefsList::NewL();
       
   729     CleanupStack::PushL( fieldTypeList );
       
   730     
       
   731     for( count = 0; count < arraySize;  ++count )
       
   732         {
       
   733         fieldType = contactManager->FieldTypes().Find( KFieldIds[count] );
       
   734         fieldTypeList->AppendL(*fieldType);	
       
   735         }
       
   736 			
       
   737     MPbk2FieldPropertyArray* propertyArray = Pbk2FieldPropertiesFactory::CreateLC(*fieldTypeList,
       
   738                                                  &contactManager->FsSession() );
       
   739     
       
   740     CPbk2IconFactory* pbk2IconFactory = CPbk2IconFactory::NewL();
       
   741     CleanupStack::PushL( pbk2IconFactory );
       
   742     
       
   743     for( count = 0; count < propertyArray->Count(); ++ count)
       
   744         {
       
   745         icon = pbk2IconFactory->CreateIconL( propertyArray->At(count).IconId());
       
   746         aIconArray->AppendL(icon);
       
   747         }
       
   748 
       
   749 	iListBox->ItemDrawer()->FormattedCellData()->SetIconArrayL( aIconArray );
       
   750 	
       
   751     //Destroy: configuration,uriArray,contactManager
       
   752     //fieldTypeList,propertyArray,pbk2IconFactory
       
   753     CleanupStack::PopAndDestroy( 6,configuration ); 	
       
   754     
       
   755 	TFileName bitmapName;
       
   756 	CPbkInfoViewResHandler::GetBitmapFileName( bitmapName );
       
   757 	
       
   758 	aIconArray->AppendL( TDialogUtil::CreateIconL(
       
   759 	                KAknsIIDQgnLogoEmpty, bitmapName,
       
   760 	                EMbmAvkonQgn_prop_empty,
       
   761 	                EMbmAvkonQgn_prop_empty_mask ) );
       
   762 	}
   705 //  End of File  
   763 //  End of File