mobilemessaging/mmsui/viewersrc/MmsViewerSendReadReportOperation.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 *       CMmsViewerSendReadReportOperation, Storage for single attachment in presentation. 
       
    16 *
       
    17 */
       
    18 
       
    19 
       
    20 
       
    21 // ========== INCLUDE FILES ================================
       
    22 
       
    23 #include <mmsconst.h>
       
    24 #include "MmsMtmConst.h"
       
    25 #include <mmsclient.h>
       
    26 
       
    27 #include "MmsViewerSendReadReportOperation.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 // CMmsViewerSendReadReportOperation
       
    49 //
       
    50 // Constructor.
       
    51 // ---------------------------------------------------------
       
    52 //
       
    53 CMmsViewerSendReadReportOperation::CMmsViewerSendReadReportOperation(
       
    54         MMmsViewerOperationObserver& aOperationObserver,
       
    55         CMmsViewerDocument& aDocument,
       
    56         RFs& aFs ) :
       
    57     CMmsViewerOperation( aOperationObserver, aDocument, aFs )
       
    58     {
       
    59     }
       
    60 
       
    61 // ---------------------------------------------------------
       
    62 // ~CMmsViewerSendReadReportOperation
       
    63 //
       
    64 // Destructor.
       
    65 // ---------------------------------------------------------
       
    66 //
       
    67 CMmsViewerSendReadReportOperation::~CMmsViewerSendReadReportOperation()
       
    68     {
       
    69     Cancel();
       
    70     delete iSendReadReportOperation;
       
    71     }
       
    72 
       
    73 
       
    74 // ---------------------------------------------------------
       
    75 // SendReadReportL
       
    76 // ---------------------------------------------------------
       
    77 //
       
    78 void CMmsViewerSendReadReportOperation::SendReadReportL( )
       
    79     {
       
    80     iStatus = KRequestPending;
       
    81     SetActive();
       
    82     iSendReadReportOperation =  iDocument.Mtm( ).SendReadReportL( 
       
    83                                 iDocument.Entry().Id( ),
       
    84                                 iStatus );
       
    85     }
       
    86 
       
    87 
       
    88 // ---------------------------------------------------------
       
    89 // RunL
       
    90 // ---------------------------------------------------------
       
    91 //
       
    92 void CMmsViewerSendReadReportOperation::RunL()
       
    93     {    
       
    94     if (    iStatus.Int() != KErrNone 
       
    95         &&  iStatus.Int() != KErrGeneral )
       
    96         {
       
    97         LOGTEXT2(_L("CMmsViewerSendReadReportOperation::RunL iStatus=%d"), iStatus.Int() );
       
    98         iObserver.ViewerOperationEvent(
       
    99             EMmsViewerOperationReadReport,
       
   100             EMmsViewerOperationError,
       
   101             iStatus.Int() );
       
   102         }
       
   103     else
       
   104         {
       
   105 #ifdef USE_LOGGER
       
   106         if ( iStatus.Int() == KErrGeneral )
       
   107             {
       
   108             // Report was not permitted
       
   109             LOGTEXT(_L8("CMmsViewerSendReadReportOperation::RunL Report was not permitted") );
       
   110             }
       
   111         else
       
   112             {                        
       
   113             LOGTEXT(_L8("CMmsViewerSendReadReportOperation::RunL Report sent OK") );
       
   114             }
       
   115 #endif
       
   116         iObserver.ViewerOperationEvent(
       
   117             EMmsViewerOperationReadReport,
       
   118             EMmsViewerOperationComplete,
       
   119             KErrNone ); 
       
   120         }
       
   121     }
       
   122 
       
   123 // ---------------------------------------------------------
       
   124 // DoCancel
       
   125 //
       
   126 // ---------------------------------------------------------
       
   127 //
       
   128 void CMmsViewerSendReadReportOperation::DoCancel()
       
   129     {
       
   130     LOGTEXT(_L8("CMmsViewerSendReadReportOperation::DoCancel") );
       
   131     // iSendReadReportOperation completes ourselves, when it cancels
       
   132     if ( iSendReadReportOperation )
       
   133         {            
       
   134         iSendReadReportOperation->Cancel();
       
   135         }
       
   136     iObserver.ViewerOperationEvent(
       
   137         EMmsViewerOperationReadReport,
       
   138         EMmsViewerOperationCancel,
       
   139         KErrNone );
       
   140     }
       
   141 
       
   142 
       
   143 // ---------------------------------------------------------
       
   144 // RunError
       
   145 //
       
   146 // ---------------------------------------------------------
       
   147 //
       
   148 TInt CMmsViewerSendReadReportOperation::RunError( TInt aError )
       
   149     {
       
   150     LOGTEXT2(_L("CMmsViewerSendReadReportOperation::RunError aError"), aError );
       
   151     iObserver.ViewerOperationEvent(
       
   152         EMmsViewerOperationReadReport,
       
   153         EMmsViewerOperationError,
       
   154         aError );
       
   155     return KErrNone;
       
   156     }
       
   157 
       
   158 // EOF