voiceui/pbkinfoviewimpl/src/pbkinfoviewdialog.cpp
branchRCL_3
changeset 11 6347473a7bb2
parent 9 fc313e1df071
child 12 994c46bea969
equal deleted inserted replaced
9:fc313e1df071 11:6347473a7bb2
    49 #include <Pbk2FieldPropertiesFactory.h>
    49 #include <Pbk2FieldPropertiesFactory.h>
    50 #include <MPbk2FieldProperty.h>
    50 #include <MPbk2FieldProperty.h>
    51 #include <TVPbkContactStoreUriPtr.h>
    51 #include <TVPbkContactStoreUriPtr.h>
    52 #include <PbkFields.hrh>
    52 #include <PbkFields.hrh>
    53 
    53 
       
    54 #include <MPbk2FieldPropertyArray2.h>
       
    55 #include <MPbk2FieldProperty2.h>
       
    56 #include <MPbk2FieldProperty.h>
       
    57 
    54 const TUint KFieldIds[] = 
    58 const TUint KFieldIds[] = 
    55     {
    59     {
    56     R_VPBK_FIELD_TYPE_LANDPHONEGEN,    
    60     R_VPBK_FIELD_TYPE_LANDPHONEGEN,    
    57     R_VPBK_FIELD_TYPE_MOBILEPHONEGEN,  
    61     R_VPBK_FIELD_TYPE_MOBILEPHONEGEN,  
    58     R_VPBK_FIELD_TYPE_VIDEONUMBERGEN,
    62     R_VPBK_FIELD_TYPE_VIDEONUMBERGEN,
    59     R_VPBK_FIELD_TYPE_VOIPGEN,
    63     R_VPBK_FIELD_TYPE_VOIPGEN,
    60     R_VPBK_FIELD_TYPE_EMAILGEN,
    64     R_VPBK_FIELD_TYPE_EMAILGEN,
    61     R_VPBK_FIELD_TYPE_IMPP
    65     R_VPBK_FIELD_TYPE_IMPP
    62     };
    66     };
       
    67 
       
    68 NONSHARABLE_CLASS( TXspIconHelper )
       
    69     {
       
    70     public:    
       
    71         TXspIconHelper( TInt aIndex, const TDesC& aLable );
       
    72         TDesC& LableText();
       
    73         TInt   Index();
       
    74     private:
       
    75         TBuf<KPbkSIPMaxLength> iLable;
       
    76         TInt iIndex;
       
    77     };
       
    78 
       
    79 TXspIconHelper::TXspIconHelper( TInt aIndex, const TDesC& aLable ):
       
    80     iLable(aLable),iIndex(aIndex)
       
    81     {
       
    82     }
       
    83 
       
    84 inline TInt TXspIconHelper::Index()
       
    85     {
       
    86     return iIndex;
       
    87     }
       
    88 inline TDesC& TXspIconHelper::LableText()
       
    89     {
       
    90     return iLable;
       
    91     }
    63 
    92 
    64 // ============================ MEMBER FUNCTIONS ===============================
    93 // ============================ MEMBER FUNCTIONS ===============================
    65 
    94 
    66 // -----------------------------------------------------------------------------
    95 // -----------------------------------------------------------------------------
    67 // CPbkInfoViewDialog::NewL
    96 // CPbkInfoViewDialog::NewL
   151     // Restore tabs
   180     // Restore tabs
   152     if ( iNaviPane )
   181     if ( iNaviPane )
   153         {
   182         {
   154         iNaviPane->Pop();
   183         iNaviPane->Pop();
   155         }
   184         }
       
   185     
       
   186     iXspIconHelper.Close();
   156     }
   187     }
   157 
   188 
   158 //------------------------------------------------------------------------------
   189 //------------------------------------------------------------------------------
   159 // CPbkInfoViewDialog::ExecuteLD
   190 // CPbkInfoViewDialog::ExecuteLD
   160 // Overrides CAknDialog::ExecuteLD. Checks whether the contact has any voice
   191 // Overrides CAknDialog::ExecuteLD. Checks whether the contact has any voice
   513 // Returns TInfoViewDialogIconIndex enumeration icon index.
   544 // Returns TInfoViewDialogIconIndex enumeration icon index.
   514 // @param aIconId enumeration TPbkIconId from PbkIconId.hrh.
   545 // @param aIconId enumeration TPbkIconId from PbkIconId.hrh.
   515 // @return TInt Icon index.
   546 // @return TInt Icon index.
   516 // -----------------------------------------------------------------------------
   547 // -----------------------------------------------------------------------------
   517 //
   548 //
   518 TInt CPbkInfoViewDialog::IconIndex( TInt aIconId )
   549 TInt CPbkInfoViewDialog::IconIndex( TInt aIconId, TInt aTagIndex )
   519 	{
   550 	{
   520 	TInt iconIndex;
   551 	TInt iconIndex;
   521 	
   552 	
   522 	switch ( aIconId )
   553 	switch ( aIconId )
   523 		{
   554 		{
   532 		    break;
   563 		    break;
   533 		case EPbkqgn_prop_nrtyp_email:
   564 		case EPbkqgn_prop_nrtyp_email:
   534 		    iconIndex = EIconIndexEmail;
   565 		    iconIndex = EIconIndexEmail;
   535 		    break;
   566 		    break;
   536 		case EPbkqgn_prop_nrtyp_voip:
   567 		case EPbkqgn_prop_nrtyp_voip:
   537 			if ( isXsp )
   568 		    iconIndex = EIconIndexVoip;
       
   569 			if ( iSindHandler->FieldIdL( aTagIndex ) == EPbkFieldIdXsp )
   538 				{
   570 				{
   539 				iconIndex = EIconIndexXsp;
   571 				for ( TInt i=0; i<iXspIconHelper.Count();i++)
   540 				}
   572 				    {
   541 			else
   573                     if ( !iXspIconHelper[i].LableText().Compare(iSindHandler->LabelL(aTagIndex)) )
   542 				{
   574                         {
   543 				iconIndex = EIconIndexVoip;
   575                         iconIndex = iXspIconHelper[i].Index();
       
   576                         }
       
   577 				    }                
   544 				}
   578 				}
   545 		    break;
   579 		    break;
   546 		default:
   580 		default:
   547 		    iconIndex = EIconIndexEmpty;    
   581 		    iconIndex = EIconIndexPhone;    
   548 		    break;
   582 		    break;
   549 		}
   583 		}
   550 		
   584 		
   551     return iconIndex; 
   585     return iconIndex; 
   552 	}
   586 	}
   572 		{
   606 		{
   573 		// Line header
   607 		// Line header
   574 		HBufC* firstLine = iSindHandler->VoiceTagLabelLC( i );
   608 		HBufC* firstLine = iSindHandler->VoiceTagLabelLC( i );
   575 		// Phone number, email address, etc...
   609 		// Phone number, email address, etc...
   576 		HBufC* secondLine = iSindHandler->VoiceTagValueL( i ).AllocLC();
   610 		HBufC* secondLine = iSindHandler->VoiceTagValueL( i ).AllocLC();
   577         isXsp = EFalse;
   611 
   578 		if( iSindHandler->FieldIdL() == EPbkFieldIdXsp )
   612 		TInt iconIndex = IconIndex( iSindHandler->IconIdL( i ), i );
   579 			{
       
   580 			isXsp = ETrue;
       
   581 			}
       
   582 		TInt iconIndex = IconIndex( iSindHandler->IconIdL( i ) );
       
   583 
   613 
   584 		TPtr ptr1 = firstLine->Des();
   614 		TPtr ptr1 = firstLine->Des();
   585 		AknTextUtils::DisplayTextLanguageSpecificNumberConversion( ptr1 );
   615 		AknTextUtils::DisplayTextLanguageSpecificNumberConversion( ptr1 );
   586 		TPtr ptr2 = secondLine->Des();
   616 		TPtr ptr2 = secondLine->Des();
   587 		AknTextUtils::DisplayTextLanguageSpecificNumberConversion( ptr2 );
   617 		AknTextUtils::DisplayTextLanguageSpecificNumberConversion( ptr2 );
   741     CleanupStack::PushL( pbk2IconFactory );
   771     CleanupStack::PushL( pbk2IconFactory );
   742     
   772     
   743     for( count = 0; count < propertyArray->Count(); ++ count)
   773     for( count = 0; count < propertyArray->Count(); ++ count)
   744         {
   774         {
   745         icon = pbk2IconFactory->CreateIconL( propertyArray->At(count).IconId());
   775         icon = pbk2IconFactory->CreateIconL( propertyArray->At(count).IconId());
       
   776         // Append xSP icon info to helper array
       
   777         if ( propertyArray->At(count).FieldType().FieldTypeResId() == R_VPBK_FIELD_TYPE_IMPP 
       
   778                 && icon && icon->Bitmap()->Handle() )
       
   779             {
       
   780             const MPbk2FieldProperty& property = propertyArray->At(count);
       
   781             MPbk2FieldProperty2* property2 = reinterpret_cast<MPbk2FieldProperty2*>
       
   782                 ( const_cast<MPbk2FieldProperty&> (property).FieldPropertyExtension(
       
   783                         KMPbk2FieldPropertyExtension2Uid ) );      
       
   784             TXspIconHelper xsp( count, property2->XSpName() );
       
   785             iXspIconHelper.Append( xsp );
       
   786             }
   746         aIconArray->AppendL(icon);
   787         aIconArray->AppendL(icon);
   747         }
   788         }
   748 
   789 
   749 	iListBox->ItemDrawer()->FormattedCellData()->SetIconArrayL( aIconArray );
   790 	iListBox->ItemDrawer()->FormattedCellData()->SetIconArrayL( aIconArray );
   750 	
   791 	
   751     //Destroy: configuration,uriArray,contactManager
   792     //Destroy: configuration,uriArray,contactManager
   752     //fieldTypeList,propertyArray,pbk2IconFactory
   793     //fieldTypeList,propertyArray,pbk2IconFactory
   753     CleanupStack::PopAndDestroy( 6,configuration ); 	
   794     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 	}
   795 	}
   763 //  End of File  
   796 //  End of File