phonebookui/Phonebook2/UIControls/src/CPbk2ContactEditorDlgImpl.cpp
branchRCL_3
changeset 32 2828b4d142c0
parent 26 0d28c1c5b6dd
child 35 4ae315f230bc
--- a/phonebookui/Phonebook2/UIControls/src/CPbk2ContactEditorDlgImpl.cpp	Tue Apr 27 16:23:35 2010 +0300
+++ b/phonebookui/Phonebook2/UIControls/src/CPbk2ContactEditorDlgImpl.cpp	Tue May 11 16:00:21 2010 +0300
@@ -843,12 +843,6 @@
 //
 void CPbk2ContactEditorDlgImpl::SetInitialCurrentLine()
     {
-    TRAPD( err, ActivateFirstPageL() );
-    if(err)
-        {
-        return;
-        }
-
     TInt focusedIndex = 0;
     if ( iParams.iFocusedContactField )
         {
@@ -3379,31 +3373,36 @@
 		TEventCode aType )
     {
     MPbk2ContactEditorField* editorField = aCurrentField->ContactEditorField();
-    MVPbkStoreContactField& contactField = editorField->ContactField();
-    TVPbkFieldStorageType dataType = contactField.FieldData().DataType();
-    
-    if ( EVPbkFieldStorageTypeText == dataType )
+    if ( editorField )
         {
-        const MVPbkContactFieldTextData& textData = 
-            MVPbkContactFieldTextData::Cast(contactField.FieldData());
-        TInt maxSize = textData.MaxLength();
+        MVPbkStoreContactField& contactField = editorField->ContactField();
+        TVPbkFieldStorageType dataType = contactField.FieldData().DataType();
         
-        if ( KVPbkUnlimitedFieldLength != maxSize &&
-                IsCheckPointEvent( aKeyEvent, aType ) )
+        if ( EVPbkFieldStorageTypeText == dataType )
             {
-            CEikEdwin* ctrl = editorField->Control();
-            HBufC* textBuf = ctrl->GetTextInHBufL();
+            const MVPbkContactFieldTextData& textData = 
+                MVPbkContactFieldTextData::Cast(contactField.FieldData());
+            TInt maxSize = textData.MaxLength();
             
-            if ( textBuf )
+            if ( KVPbkUnlimitedFieldLength != maxSize &&
+                    IsCheckPointEvent( aKeyEvent, aType ) )
                 {
-                TInt maxLen = maxSize;
-                if ( IsUnicodeL( *textBuf ) )
+                CEikEdwin* ctrl = editorField->Control();
+                HBufC* textBuf = ctrl->GetTextInHBufL();
+                
+                if ( textBuf )
                     {
-                    maxLen = maxSize / KTwoBytes - KExtraByte;
-                    }
-                if ( ctrl->MaxLength() != maxLen && textBuf->Length() <= maxLen )
-                    {
-                    ctrl->SetMaxLength( maxLen );
+                    CleanupStack::PushL( textBuf );
+                    TInt maxLen = maxSize;
+                    if ( IsUnicodeL( *textBuf ) )
+                        {
+                        maxLen = maxSize / KTwoBytes - KExtraByte;
+                        }
+                    if ( ctrl->MaxLength() != maxLen && textBuf->Length() <= maxLen )
+                        {
+                        ctrl->SetMaxLength( maxLen );
+                        }
+                    CleanupStack::PopAndDestroy( textBuf );
                     }
                 }
             }