meetingrequest/mrgui/mrfieldbuilderplugin/src/cmrattachmentsfield.cpp
branchRCL_3
changeset 16 b5fbb9b25d57
parent 13 8592a65ad3fb
child 18 6b8f3b30d0ec
equal deleted inserted replaced
14:b13141f05c3d 16:b5fbb9b25d57
    25 #include "cesmrrichtextviewer.h"
    25 #include "cesmrrichtextviewer.h"
    26 #include "cesmreditor.h"
    26 #include "cesmreditor.h"
    27 #include "cesmrrichtextlink.h"
    27 #include "cesmrrichtextlink.h"
    28 #include "cmrattachmentcommandhandler.h"
    28 #include "cmrattachmentcommandhandler.h"
    29 
    29 
    30 #include <aknsbasicbackgroundcontrolcontext.h>
    30 #include <AknsBasicBackgroundControlContext.h>
    31 #include <calentry.h>
    31 #include <calentry.h>
    32 #include <calattachment.h>
    32 #include <calattachment.h>
    33 #include <stringloader.h>
    33 #include <StringLoader.h>
    34 #include <esmrgui.rsg>
    34 #include <esmrgui.rsg>
    35 #include <gulicon.h>
    35 #include <gulicon.h>
    36 #include <ct/rcpointerarray.h>
    36 #include <ct/rcpointerarray.h>
    37 #include <aknbiditextutils.h>
    37 #include <AknBidiTextUtils.h>
    38 
    38 
    39 // DEBUG
    39 // DEBUG
    40 #include "emailtrace.h"
    40 #include "emailtrace.h"
    41 
    41 
    42 
    42 
    43 // unnamed namespace for local definitions
    43 // unnamed namespace for local definitions
    44 namespace { // codescanner::namespace
    44 namespace { // codescanner::namespace
    45 //CONSTANTS
    45 //CONSTANTS
    46 
    46 
    47 // TODO: Read default text from resource
       
    48 _LIT( KAddAttachment, "Add attachment" );
    47 _LIT( KAddAttachment, "Add attachment" );
    49 _LIT( KNewLine, "\f" );
    48 _LIT( KNewLine, "\f" );
    50 
    49 
    51 const TInt KOneKiloByte( 1024 );
    50 const TInt KOneKiloByte( 1024 );
    52 const TInt KOneMegaByte( 1048576 ); // (1024^2 or 2^20):
    51 const TInt KOneMegaByte( 1048576 ); // (1024^2 or 2^20):
   139     CESMRField::ConstructL( iRichTextViewer ); // ownership transferred
   138     CESMRField::ConstructL( iRichTextViewer ); // ownership transferred
   140     iRichTextViewer->SetEdwinSizeObserver ( this );
   139     iRichTextViewer->SetEdwinSizeObserver ( this );
   141     iRichTextViewer->SetLinkObserver (this );
   140     iRichTextViewer->SetLinkObserver (this );
   142     iRichTextViewer->SetParent( this );
   141     iRichTextViewer->SetParent( this );
   143 
   142 
   144     // TODO: read from resource
       
   145     iTitle->SetTextL( KAddAttachment );
   143     iTitle->SetTextL( KAddAttachment );
   146 
   144 
   147     // Draw bg instead of using skin bg
   145     // Draw bg instead of using skin bg
   148     TRect tempRect( 0, 0, 0, 0 );
   146     TRect tempRect( 0, 0, 0, 0 );
   149     NMRBitmapManager::TMRBitmapStruct bitmapStruct;
   147     NMRBitmapManager::TMRBitmapStruct bitmapStruct;
   477 // ---------------------------------------------------------------------------
   475 // ---------------------------------------------------------------------------
   478 //
   476 //
   479 TBool CMRAttachmentsField::ExecuteGenericCommandL( TInt aCommand )
   477 TBool CMRAttachmentsField::ExecuteGenericCommandL( TInt aCommand )
   480     {
   478     {
   481     FUNC_LOG;
   479     FUNC_LOG;
   482     // TODO: Changes from other fields have to be implemented here
   480 
   483     TBool handled( EFalse );
   481     TBool handled( EFalse );
   484 
   482 
   485     // From cesmrattachmentfield
   483     // From cesmrattachmentfield
   486     if( aCommand == EAknCmdOpen )
   484     if( aCommand == EAknCmdOpen )
   487         {
   485         {
   618         TInt attachmentSizeLength = attachmentSize->Length();
   616         TInt attachmentSizeLength = attachmentSize->Length();
   619         maxLineWidth -= font->TextWidthInPixels( *attachmentSize );
   617         maxLineWidth -= font->TextWidthInPixels( *attachmentSize );
   620         delete attachmentSize;
   618         delete attachmentSize;
   621         attachmentSize = NULL;
   619         attachmentSize = NULL;
   622 
   620 
   623         // TODO: correct icon zise to correct one. Ask from UI specifier.
       
   624         TSize iconSize( 20, 20);
   621         TSize iconSize( 20, 20);
   625         maxLineWidth -= iconSize.iWidth;
   622         maxLineWidth -= iconSize.iWidth;
   626 
   623 
   627         // Trimming file name to fit to one line
   624         // Trimming file name to fit to one line
   628         TPtrC text = att->Label();
   625         TPtrC text = att->Label();