phonebookui/Phonebook2/Commands/src/CPbk2PrependCmd.cpp
branchRCL_3
changeset 15 e8e3147d53eb
parent 0 e686773b3f54
child 64 c1e8ba0c2b16
equal deleted inserted replaced
14:81f8547efd4f 15:e8e3147d53eb
   168     if (iStoreContact && iUiControl)
   168     if (iStoreContact && iUiControl)
   169         {
   169         {
   170         // get field text (phone no)
   170         // get field text (phone no)
   171         TInt fieldIndex( iUiControl->FocusedFieldIndex() );
   171         TInt fieldIndex( iUiControl->FocusedFieldIndex() );
   172         MVPbkStoreContactField* field =
   172         MVPbkStoreContactField* field =
   173             iStoreContact->Fields().FieldAtLC(
   173             iStoreContact->Fields().FieldAtLC( fieldIndex );
   174                 ToStoreFieldIndexL( fieldIndex ) );
       
   175         TPtrC phoneNo =
   174         TPtrC phoneNo =
   176             MVPbkContactFieldTextData::Cast( field->FieldData() ).Text();
   175             MVPbkContactFieldTextData::Cast( field->FieldData() ).Text();
   177         HBufC* number = HBufC::NewLC( KBufferSize );
   176         HBufC* number = HBufC::NewLC( KBufferSize );
   178         number->Des().Copy( phoneNo );
   177         number->Des().Copy( phoneNo );
   179         TPtr numberPtr = number->Des();
   178         TPtr numberPtr = number->Des();
   259 
   258 
   260 // --------------------------------------------------------------------------
   259 // --------------------------------------------------------------------------
   261 // CPbk2PrependCmd::MaxLengthOfEditorL
   260 // CPbk2PrependCmd::MaxLengthOfEditorL
   262 // --------------------------------------------------------------------------
   261 // --------------------------------------------------------------------------
   263 //
   262 //
   264 TInt CPbk2PrependCmd::MaxLengthOfEditorL( TInt aFieldIndex )
   263 TInt CPbk2PrependCmd::MaxLengthOfEditorL( TInt aFieldStoreIndex )
   265     {
   264     {
   266     TInt maxLength( KErrNotFound );
   265     TInt maxLength( KErrNotFound );
   267     CPbk2PresentationContact* presentationContact =
   266     CPbk2PresentationContact* presentationContact =
   268         CreatePresentationContactLC();
   267         CreatePresentationContactLC();
       
   268     
       
   269     TInt fieldIndex = KErrNotFound;
       
   270      
       
   271     fieldIndex = presentationContact->PresentationFields().FieldIndexOfStoreField( aFieldStoreIndex );
   269 
   272 
   270     __ASSERT_DEBUG( presentationContact->PresentationFields().FieldCount() >
   273     __ASSERT_DEBUG( presentationContact->PresentationFields().FieldCount() >
   271                     aFieldIndex, Panic( EMaxLengthOfEditorL_OOB ) );
   274                        fieldIndex, Panic( EMaxLengthOfEditorL_OOB ) );
   272 
   275     
   273     maxLength = presentationContact->PresentationFields().At( aFieldIndex ).
   276     __ASSERT_DEBUG( fieldIndex > KErrNotFound, Panic( EMaxLengthOfEditorL_OOB ) );
       
   277 
       
   278     maxLength = presentationContact->PresentationFields().At( fieldIndex ).
   274                 MaxDataLength();
   279                 MaxDataLength();
   275 
   280 
   276     CleanupStack::PopAndDestroy( presentationContact );
   281     CleanupStack::PopAndDestroy( presentationContact );
   277 
   282 
   278     return maxLength;
   283     return maxLength;