meetingrequest/mrgui/mrfieldbuilderplugin/src/cmrsaveandopenattachmentcommand.cpp
branchRCL_3
changeset 26 67369d1b217f
parent 24 b5fbb9b25d57
equal deleted inserted replaced
24:b5fbb9b25d57 26:67369d1b217f
    20 #include <calattachment.h>
    20 #include <calattachment.h>
    21 #include <f32file.h>
    21 #include <f32file.h>
    22 #include <DocumentHandler.h>
    22 #include <DocumentHandler.h>
    23 #include <coemain.h>
    23 #include <coemain.h>
    24 #include <esmrgui.rsg>
    24 #include <esmrgui.rsg>
    25 #include <NpdApi.h>
       
    26 #include <aknnotewrappers.h>
    25 #include <aknnotewrappers.h>
    27 #include <StringLoader.h>
    26 #include <StringLoader.h>
    28 
    27 
    29 // DEBUG
    28 // DEBUG
    30 #include "emailtrace.h"
    29 #include "emailtrace.h"
    31 
    30 
    32 
       
    33 namespace { // codescanner::namespace
       
    34 
       
    35 // Notepad data type
       
    36 _LIT8( KNotePadTextDataType, "text/plain" );
       
    37 
       
    38 }
       
    39 
    31 
    40 // ======== MEMBER FUNCTIONS ========
    32 // ======== MEMBER FUNCTIONS ========
    41 
    33 
    42 // ---------------------------------------------------------------------------
    34 // ---------------------------------------------------------------------------
    43 // CMRSaveAndOpenAttachmentCommand::CMRSaveAndOpenAttachmentCommand
    35 // CMRSaveAndOpenAttachmentCommand::CMRSaveAndOpenAttachmentCommand
   132     CleanupClosePushL( copiedFile );
   124     CleanupClosePushL( copiedFile );
   133 
   125 
   134     TDataType datatype(
   126     TDataType datatype(
   135             aEntry.AttachmentL( aAttachmentIndex )->MimeType() );
   127             aEntry.AttachmentL( aAttachmentIndex )->MimeType() );
   136 
   128 
   137     if( datatype == KNotePadTextDataType() )
   129     // Doc handler will try to open file
   138         {
   130     TRAP( err, iDocHandler.OpenFileEmbeddedL( copiedFile, datatype ) );
   139         // Notepad will try to open text/plain type data
       
   140         err = CNotepadApi::ExecFileViewerL(
       
   141                 copiedFile,
       
   142                 NULL,
       
   143                ETrue,
       
   144                EFalse,
       
   145                KCharacterSetIdentifierIso88591 );
       
   146         }
       
   147     else
       
   148         {
       
   149         // Doc handler will try to open other than text files
       
   150         TRAP( err, iDocHandler.OpenFileEmbeddedL( copiedFile, datatype ) );
       
   151         }
       
   152 
   131 
   153     CleanupStack::PopAndDestroy( &copiedFile );
   132     CleanupStack::PopAndDestroy( &copiedFile );
   154     CleanupStack::PopAndDestroy( &file );
   133     CleanupStack::PopAndDestroy( &file );
   155 
   134 
   156     if( err != KErrNone )
   135     if( err != KErrNone )