phonebookui/Phonebook2/Commands/src/CPbk2PrependCmd.cpp
branchRCL_3
changeset 6 e8e3147d53eb
parent 0 e686773b3f54
--- a/phonebookui/Phonebook2/Commands/src/CPbk2PrependCmd.cpp	Fri Mar 12 15:41:25 2010 +0200
+++ b/phonebookui/Phonebook2/Commands/src/CPbk2PrependCmd.cpp	Mon Mar 15 12:39:26 2010 +0200
@@ -170,8 +170,7 @@
         // get field text (phone no)
         TInt fieldIndex( iUiControl->FocusedFieldIndex() );
         MVPbkStoreContactField* field =
-            iStoreContact->Fields().FieldAtLC(
-                ToStoreFieldIndexL( fieldIndex ) );
+            iStoreContact->Fields().FieldAtLC( fieldIndex );
         TPtrC phoneNo =
             MVPbkContactFieldTextData::Cast( field->FieldData() ).Text();
         HBufC* number = HBufC::NewLC( KBufferSize );
@@ -261,16 +260,22 @@
 // CPbk2PrependCmd::MaxLengthOfEditorL
 // --------------------------------------------------------------------------
 //
-TInt CPbk2PrependCmd::MaxLengthOfEditorL( TInt aFieldIndex )
+TInt CPbk2PrependCmd::MaxLengthOfEditorL( TInt aFieldStoreIndex )
     {
     TInt maxLength( KErrNotFound );
     CPbk2PresentationContact* presentationContact =
         CreatePresentationContactLC();
+    
+    TInt fieldIndex = KErrNotFound;
+     
+    fieldIndex = presentationContact->PresentationFields().FieldIndexOfStoreField( aFieldStoreIndex );
 
     __ASSERT_DEBUG( presentationContact->PresentationFields().FieldCount() >
-                    aFieldIndex, Panic( EMaxLengthOfEditorL_OOB ) );
+                       fieldIndex, Panic( EMaxLengthOfEditorL_OOB ) );
+    
+    __ASSERT_DEBUG( fieldIndex > KErrNotFound, Panic( EMaxLengthOfEditorL_OOB ) );
 
-    maxLength = presentationContact->PresentationFields().At( aFieldIndex ).
+    maxLength = presentationContact->PresentationFields().At( fieldIndex ).
                 MaxDataLength();
 
     CleanupStack::PopAndDestroy( presentationContact );