meetingrequest/mrgui/mrfieldbuilderplugin/src/cmrattachmentcommand.cpp
branchRCL_3
changeset 12 4ce476e64c59
equal deleted inserted replaced
11:0396474f30f5 12:4ce476e64c59
       
     1 /*
       
     2 * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12  * Contributors:
       
    13  *
       
    14  * Description:  MR attahcment field implementation
       
    15  *
       
    16  */
       
    17 #include "cmrattachmentcommand.h"
       
    18 #include <apgcli.h>
       
    19 #include <f32file.h>
       
    20 
       
    21 // DEBUG
       
    22 #include "emailtrace.h"
       
    23 
       
    24 // ======== MEMBER FUNCTIONS ========
       
    25 
       
    26 // ---------------------------------------------------------------------------
       
    27 // CMRAttachmentCommand::CMRAttachmentCommand
       
    28 // ---------------------------------------------------------------------------
       
    29 //
       
    30 CMRAttachmentCommand::CMRAttachmentCommand()
       
    31     {
       
    32     FUNC_LOG;
       
    33     }
       
    34     
       
    35 // ---------------------------------------------------------------------------
       
    36 // CMRAttachmentCommand::CMRAttachmentCommand
       
    37 // ---------------------------------------------------------------------------
       
    38 //
       
    39 CMRAttachmentCommand::~CMRAttachmentCommand()
       
    40     {
       
    41     FUNC_LOG;
       
    42     }
       
    43 
       
    44 // -----------------------------------------------------------------------------
       
    45 // CMRAttachmentCommand::GetMimeTypeL
       
    46 // -----------------------------------------------------------------------------
       
    47 //
       
    48 TDataType CMRAttachmentCommand::GetMimeType( RFile& aFile )
       
    49     {
       
    50     FUNC_LOG;
       
    51     TDataType dataType;
       
    52     RApaLsSession aApaSession;
       
    53     if( aFile.SubSessionHandle() )
       
    54         {
       
    55         TInt error(0);
       
    56 
       
    57         if( !aApaSession.Handle() )
       
    58             {
       
    59             error = aApaSession.Connect();
       
    60             }
       
    61         if( error == KErrNone )
       
    62             {
       
    63             TDataRecognitionResult recognitionResult;
       
    64             error = aApaSession.RecognizeData( aFile, recognitionResult );
       
    65             if( recognitionResult.iConfidence !=
       
    66                 CApaDataRecognizerType::ENotRecognized &&
       
    67                     error == KErrNone )
       
    68                 {
       
    69                 dataType = recognitionResult.iDataType;
       
    70                 }
       
    71             }
       
    72         }
       
    73 
       
    74     aApaSession.Close();
       
    75     return dataType;
       
    76     }
       
    77 
       
    78 // EOF