mobilemessaging/audiomsg/src/audiomessagesendreadreportoperation.cpp
changeset 0 72b543305e3a
equal deleted inserted replaced
-1:000000000000 0:72b543305e3a
       
     1 /*
       
     2 * Copyright (c) 2006 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 *       CAudioMessageSendReadReportOperation, Storage for single attachment in presentation. 
       
    16 *
       
    17 */
       
    18 
       
    19 
       
    20 
       
    21 // ========== INCLUDE FILES ================================
       
    22 
       
    23 #include <mmsconst.h>
       
    24 #include <mmsclient.h>
       
    25 
       
    26 #include "AudioMessageLogging.h"
       
    27 #include "audiomessagesendreadreportoperation.h"
       
    28 
       
    29 // ========== EXTERNAL DATA STRUCTURES =====================
       
    30 
       
    31 // ========== EXTERNAL FUNCTION PROTOTYPES =================
       
    32 
       
    33 // ========== CONSTANTS ====================================
       
    34 
       
    35 // ========== MACROS =======================================
       
    36 
       
    37 // ========== LOCAL CONSTANTS AND MACROS ===================
       
    38 
       
    39 // ========== MODULE DATA STRUCTURES =======================
       
    40 
       
    41 // ========== LOCAL FUNCTION PROTOTYPES ====================
       
    42 
       
    43 // ========== LOCAL FUNCTIONS ==============================
       
    44 
       
    45 // ========== MEMBER FUNCTIONS =============================
       
    46 
       
    47 // ---------------------------------------------------------
       
    48 // CAudioMessageSendReadReportOperation
       
    49 //
       
    50 // Constructor.
       
    51 // ---------------------------------------------------------
       
    52 //
       
    53 CAudioMessageSendReadReportOperation::CAudioMessageSendReadReportOperation(
       
    54         MAmsOperationObserver& aOperationObserver,
       
    55         CAudioMessageDocument& aDocument ) :
       
    56     CAudioMessageOperation( aOperationObserver, aDocument)
       
    57     {
       
    58     }
       
    59 
       
    60 // ---------------------------------------------------------
       
    61 // ~CAudioMessageSendReadReportOperation
       
    62 //
       
    63 // Destructor.
       
    64 // ---------------------------------------------------------
       
    65 //
       
    66 CAudioMessageSendReadReportOperation::~CAudioMessageSendReadReportOperation()
       
    67     {
       
    68     Cancel();
       
    69     delete iSendReadReportOperation;
       
    70     }
       
    71 
       
    72 
       
    73 // ---------------------------------------------------------
       
    74 // SendReadReportL
       
    75 // ---------------------------------------------------------
       
    76 //
       
    77 void CAudioMessageSendReadReportOperation::SendReadReportL( )
       
    78     {
       
    79     iStatus = KRequestPending;
       
    80     SetActive();
       
    81     iSendReadReportOperation =  iDocument.Mtm( ).SendReadReportL( 
       
    82                                 iDocument.Entry().Id( ),
       
    83                                 iStatus );
       
    84     }
       
    85 
       
    86 
       
    87 // ---------------------------------------------------------
       
    88 // RunL
       
    89 // ---------------------------------------------------------
       
    90 //
       
    91 void CAudioMessageSendReadReportOperation::RunL()
       
    92     {    
       
    93     if (    iStatus.Int() != KErrNone 
       
    94         &&  iStatus.Int() != KErrGeneral )
       
    95         {
       
    96         AMSLOGGER_WRITEF( _L("CAudioMessageSendReadReportOperation::RunL iStatus=%d"), iStatus.Int() );
       
    97         SetError( iStatus.Int() );
       
    98         iObserver.EditorOperationEvent(
       
    99             EAmsOperationSendReadReport,
       
   100             EAmsOperationError );
       
   101         }
       
   102     else
       
   103         {
       
   104         switch ( iNextState )
       
   105             {
       
   106             case EAmsReadReportEnd:
       
   107                 {
       
   108 #ifdef USE_LOGGER
       
   109                 if ( iStatus.Int() == KErrGeneral )
       
   110                     {
       
   111                     // Report was not permitted
       
   112                     AMSLOGGER_WRITE( "CAudioMessageSendReadReportOperation::RunL Report was not permitted" );
       
   113                     }
       
   114                 else
       
   115                     {                        
       
   116                     AMSLOGGER_WRITE( "CAudioMessageSendReadReportOperation::RunL Report sent OK" );
       
   117                     }
       
   118 #endif
       
   119                 iObserver.EditorOperationEvent(
       
   120                     EAmsOperationSendReadReport,
       
   121                     EAmsOperationComplete );
       
   122                 break;
       
   123                 }
       
   124             default:
       
   125                 iObserver.EditorOperationEvent(
       
   126                     EAmsOperationSendReadReport,
       
   127                     EAmsOperationError ); 
       
   128                 break;
       
   129             }
       
   130         }
       
   131     }
       
   132 
       
   133 // ---------------------------------------------------------
       
   134 // DoCancel
       
   135 //
       
   136 // ---------------------------------------------------------
       
   137 //
       
   138 void CAudioMessageSendReadReportOperation::DoCancel()
       
   139     {
       
   140     AMSLOGGER_WRITE( "CAudioMessageSendReadReportOperation::DoCancel" );
       
   141     if ( iSendReadReportOperation )
       
   142     	{
       
   143         iSendReadReportOperation->Cancel();
       
   144     	}
       
   145     }
       
   146 
       
   147 
       
   148 // EOF