phonebookui/Phonebook2/UIControls/src/CPbk2ContactEditorDlgImpl.cpp
branchRCL_3
changeset 13 a6539d1e8e43
parent 12 4ae315f230bc
child 18 d4f567ce2e7c
--- a/phonebookui/Phonebook2/UIControls/src/CPbk2ContactEditorDlgImpl.cpp	Tue May 25 12:26:45 2010 +0300
+++ b/phonebookui/Phonebook2/UIControls/src/CPbk2ContactEditorDlgImpl.cpp	Wed Jun 09 09:26:27 2010 +0300
@@ -1850,21 +1850,20 @@
     
     if ( image )
         {
-        image->SetPictureOwnedExternally( EFalse );
-        image->CopyControlContextFrom( LineControl( aControlId ) );
-        image->SetContainerWindowL( *LineControl( aControlId ) );
-        image->SetNonFocusing();
-        image->SetBrushStyle( CGraphicsContext::ENullBrush );
+        CEikCaptionedControl* line = LineControl( aControlId );
+        if( line )
+            {
+            line->SetIconL( 
+                const_cast<CFbsBitmap*>( image->Bitmap() ), 
+                const_cast<CFbsBitmap*>( image->Mask() ) );
+            line->iBitmap->SetPictureOwnedExternally( EFalse );
+            image->SetPictureOwnedExternally( ETrue );
+            line->iBitmap->SetNonFocusing();
+            line->iBitmap->SetBrushStyle( CGraphicsContext::ENullBrush );
+            line->iBitmap->SetContainerWindowL( *line );
+            }
 
-        delete LineControl( aControlId )->iBitmap;
-        LineControl( aControlId )->iBitmap = image;
-        CleanupStack::Pop( image );
-
-        TRect rect = LineControl( aControlId )->Rect();
-        rect.Resize( -1, -1 );
-        LineControl( aControlId )->SetRect( rect );
-        rect.Resize( 1, 1 );
-        LineControl( aControlId )->SetRect( rect );
+        CleanupStack::PopAndDestroy( image );
         }
 
     CleanupStack::PopAndDestroy( factory );