meetingrequest/mrgui/mrfieldbuilderplugin/src/cmrviewerattachmentfield.cpp
branchRCL_3
changeset 60 d620048b4810
parent 24 b5fbb9b25d57
equal deleted inserted replaced
52:efd4f1afd43e 60:d620048b4810
   131 void CMRViewerAttachmentsField::ConstructL( )
   131 void CMRViewerAttachmentsField::ConstructL( )
   132     {
   132     {
   133     FUNC_LOG;
   133     FUNC_LOG;
   134     SetComponentsToInheritVisibility( ETrue );
   134     SetComponentsToInheritVisibility( ETrue );
   135 
   135 
   136     iFieldIcon = CMRImage::NewL( NMRBitmapManager::EMRBitmapAttachment );
   136     iFieldIcon = CMRImage::NewL(
   137     iFieldIcon->SetParent( this );
   137             NMRBitmapManager::EMRBitmapAttachment,
       
   138             this );
   138 
   139 
   139     iRichTextViewer = CESMRRichTextViewer::NewL( this );
   140     iRichTextViewer = CESMRRichTextViewer::NewL( this );
   140     CESMRField::ConstructL( iRichTextViewer ); // ownership transferred
   141     CESMRField::ConstructL( iRichTextViewer ); // ownership transferred
   141     iRichTextViewer->SetEdwinSizeObserver ( this );
   142     iRichTextViewer->SetEdwinSizeObserver ( this );
   142     iRichTextViewer->SetLinkObserver (this );
   143     iRichTextViewer->SetLinkObserver (this );
   281     {
   282     {
   282     FUNC_LOG;
   283     FUNC_LOG;
   283     switch ( aInd )
   284     switch ( aInd )
   284         {
   285         {
   285         case 0:
   286         case 0:
       
   287             return iFieldIcon;
       
   288         case 1:
   286             return iRichTextViewer;
   289             return iRichTextViewer;
   287         case 1:
       
   288             return iFieldIcon;
       
   289         case 2:
   290         case 2:
   290         	return iLockIcon;
   291         	return iLockIcon;
   291         default:
   292         default:
   292             return NULL;
   293             return NULL;
   293         }
   294         }
   398 
   399 
   399     return response;
   400     return response;
   400     }
   401     }
   401 
   402 
   402 // ---------------------------------------------------------------------------
   403 // ---------------------------------------------------------------------------
   403 // CMRViewerAttachmentsField::SetContainerWindowL()
       
   404 // ---------------------------------------------------------------------------
       
   405 //
       
   406 void CMRViewerAttachmentsField::SetContainerWindowL( const CCoeControl& aControl )
       
   407     {
       
   408     FUNC_LOG;
       
   409     CESMRField::SetContainerWindowL( aControl );
       
   410     iRichTextViewer->SetContainerWindowL( aControl );
       
   411     iRichTextViewer->SetParent( this );
       
   412 
       
   413     iFieldIcon->SetContainerWindowL( aControl );
       
   414     iFieldIcon->SetParent( this );
       
   415 
       
   416     iButtonGroupContainer = CEikButtonGroupContainer::Current();
       
   417     }
       
   418 
       
   419 // ---------------------------------------------------------------------------
       
   420 // CMRViewerAttachmentsField::HandleEdwinSizeEventL
   404 // CMRViewerAttachmentsField::HandleEdwinSizeEventL
   421 // ---------------------------------------------------------------------------
   405 // ---------------------------------------------------------------------------
   422 //
   406 //
   423 TBool CMRViewerAttachmentsField::HandleEdwinSizeEventL( CEikEdwin* aEdwin,
   407 TBool CMRViewerAttachmentsField::HandleEdwinSizeEventL( CEikEdwin* aEdwin,
   424         TEdwinSizeEvent /*aType*/, TSize aSize )
   408         TEdwinSizeEvent /*aType*/, TSize aSize )
   433 
   417 
   434         if ( iObserver && aEdwin == iRichTextViewer )
   418         if ( iObserver && aEdwin == iRichTextViewer )
   435            {
   419            {
   436            iObserver->ControlSizeChanged( this );
   420            iObserver->ControlSizeChanged( this );
   437            reDraw = ETrue;
   421            reDraw = ETrue;
       
   422            
       
   423            if ( !iOutlineFocus )
       
   424                {
       
   425                RecordField();
       
   426                }
   438            }
   427            }
   439         }
   428         }
   440 
   429 
   441     return reDraw;
   430     return reDraw;
   442     }
   431     }
   640         if( iAttachmentCount > 1 )
   629         if( iAttachmentCount > 1 )
   641             {
   630             {
   642             iRichTextViewer->SetLineSpacingL( LineSpacing() );
   631             iRichTextViewer->SetLineSpacingL( LineSpacing() );
   643             }
   632             }
   644 
   633 
   645         iRichTextViewer->ApplyLayoutChangesL();
       
   646 
       
   647         iRichTextViewer->SetMargins( KMargin ); // What's this?
       
   648         iRichTextViewer->HandleTextChangedL();
       
   649 
       
   650         while ( attachmentLinks.Count() > 0 )
   634         while ( attachmentLinks.Count() > 0 )
   651             {
   635             {
   652             CESMRRichTextLink* link = attachmentLinks[0];
   636             CESMRRichTextLink* link = attachmentLinks[0];
   653             CleanupStack::PushL( link );
   637             CleanupStack::PushL( link );
   654             attachmentLinks.Remove( 0 );
   638             attachmentLinks.Remove( 0 );
   655             iRichTextViewer->AddLinkL( link );
   639             iRichTextViewer->AddLinkL( link );
   656             CleanupStack::Pop( link );
   640             CleanupStack::Pop( link );
   657             }
   641             }
       
   642 
       
   643         iRichTextViewer->ApplyLayoutChangesL();
       
   644 
       
   645         iRichTextViewer->SetMargins( KMargin ); // What's this?
       
   646         iRichTextViewer->HandleTextChangedL();
   658         }
   647         }
   659 
   648 
   660     CleanupStack::PopAndDestroy( &attachmentLinks );
   649     CleanupStack::PopAndDestroy( &attachmentLinks );
   661     CleanupStack::PopAndDestroy( &buffer );
   650     CleanupStack::PopAndDestroy( &buffer );
   662 
   651 
   829 
   818 
   830 	CESMRField::LockL();
   819 	CESMRField::LockL();
   831 
   820 
   832 	delete iLockIcon;
   821 	delete iLockIcon;
   833 	iLockIcon = NULL;
   822 	iLockIcon = NULL;
   834 	iLockIcon = CMRImage::NewL( NMRBitmapManager::EMRBitmapLockField, ETrue );
   823 	iLockIcon = CMRImage::NewL(
   835 	iLockIcon->SetParent( this );
   824 	        NMRBitmapManager::EMRBitmapLockField,
       
   825 	        this,
       
   826 	        ETrue );
   836 	}
   827 	}
   837 
   828 
   838 // ---------------------------------------------------------------------------
   829 // ---------------------------------------------------------------------------
   839 // CMRViewerAttachmentsField::LineSpacing
   830 // CMRViewerAttachmentsField::LineSpacing
   840 // ---------------------------------------------------------------------------
   831 // ---------------------------------------------------------------------------