mobilemessaging/msgmedia/src/MsgTextInfo.cpp
changeset 0 72b543305e3a
equal deleted inserted replaced
-1:000000000000 0:72b543305e3a
       
     1 /*
       
     2 * Copyright (c) 2005 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:  
       
    15 *           Messaging Text info class
       
    16 *
       
    17 */
       
    18 
       
    19 
       
    20 
       
    21 // ========== INCLUDE FILES ================================
       
    22 
       
    23 #include <e32std.h>
       
    24 #include <f32file.h>
       
    25 
       
    26 #include <msgtextutils.h>
       
    27 
       
    28 #include "MsgTextInfo.h"
       
    29 #include "MsgMediaInfo.h"
       
    30 
       
    31 
       
    32 // ========== EXTERNAL DATA STRUCTURES =====================
       
    33 
       
    34 // ========== EXTERNAL FUNCTION PROTOTYPES =================
       
    35 
       
    36 // ========== CONSTANTS ====================================
       
    37 
       
    38 // ========== MACROS =======================================
       
    39 
       
    40 // ========== LOCAL CONSTANTS AND MACROS ===================
       
    41 
       
    42 // ========== MODULE DATA STRUCTURES =======================
       
    43 
       
    44 // ========== LOCAL FUNCTION PROTOTYPES ====================
       
    45 
       
    46 // ========== LOCAL FUNCTIONS ==============================
       
    47 
       
    48 // ========== MEMBER FUNCTIONS =============================
       
    49 
       
    50 // ---------------------------------------------------------
       
    51 // CMsgTextInfo::NewL
       
    52 //
       
    53 // Factory method.
       
    54 // ---------------------------------------------------------
       
    55 //
       
    56 EXPORT_C CMsgTextInfo* CMsgTextInfo::NewL(
       
    57         RFile& aFile, 
       
    58         TDataType& aMimeType,
       
    59         RFs& aFs )
       
    60     {
       
    61     CMsgTextInfo* self = new ( ELeave ) CMsgTextInfo( aMimeType, aFs );
       
    62     CleanupStack::PushL( self );
       
    63     if ( aFile.SubSessionHandle() != KNullHandle )
       
    64         {
       
    65         self->ConstructL( aFile );
       
    66         }
       
    67     else
       
    68         {
       
    69         self->ConstructEmpty();
       
    70         }
       
    71     CleanupStack::Pop( self );
       
    72     return self;
       
    73     }
       
    74 
       
    75 // ---------------------------------------------------------
       
    76 // CMsgTextInfo::CMsgTextInfo
       
    77 //
       
    78 // Constructor.
       
    79 // ---------------------------------------------------------
       
    80 //
       
    81 CMsgTextInfo::CMsgTextInfo( TDataType& aMimeType, RFs& aFs ) :
       
    82         CMsgMediaInfo( aMimeType, EMsgMediaText ),
       
    83         iFs( aFs )
       
    84     {
       
    85     }
       
    86 
       
    87 
       
    88 // ---------------------------------------------------------
       
    89 // CMsgTextInfo::CMsgTextInfo
       
    90 //
       
    91 // Destructor.
       
    92 // ---------------------------------------------------------
       
    93 //
       
    94 CMsgTextInfo::~CMsgTextInfo()
       
    95     {
       
    96     }
       
    97 
       
    98 // ---------------------------------------------------------
       
    99 // CMsgTextInfo::ConstructL
       
   100 //
       
   101 // 2nd phase constructor.
       
   102 // ---------------------------------------------------------
       
   103 //
       
   104 void CMsgTextInfo::ConstructL( RFile& aFile )
       
   105     {
       
   106     CMsgMediaInfo::ConstructL( aFile );
       
   107     }
       
   108 
       
   109 // ---------------------------------------------------------
       
   110 // CMsgTextInfo::ConstructEmpty
       
   111 // ---------------------------------------------------------
       
   112 //
       
   113 void CMsgTextInfo::ConstructEmpty()
       
   114     {
       
   115     iMediaType = EMsgMediaText;
       
   116     iParsed = ETrue;
       
   117     }
       
   118 
       
   119 // -----------------------------------------------------------------------------
       
   120 // CMsgTextInfo::DoCancel
       
   121 // 
       
   122 // -----------------------------------------------------------------------------
       
   123 //
       
   124 void CMsgTextInfo::DoCancel()
       
   125     {
       
   126     CMsgMediaInfo::DoCancel();
       
   127     }
       
   128         
       
   129 // -----------------------------------------------------------------------------
       
   130 // CMsgTextInfo::RunL
       
   131 // 
       
   132 // -----------------------------------------------------------------------------
       
   133 //
       
   134 void CMsgTextInfo::RunL()
       
   135     {
       
   136     iParseError = iStatus.Int();
       
   137     if ( !iParseError )
       
   138         {
       
   139         if ( !iCharSetRecognized )
       
   140             {
       
   141             iCharSet = CMsgTextUtils::RecognizeCharSetL( iFs, iFile );    
       
   142             iCharSetRecognized = ETrue;
       
   143             }
       
   144         iParsed = ETrue;
       
   145         }
       
   146     CompleteObserver();
       
   147     }
       
   148 
       
   149 //  End of File