email/imum/Mtms/Src/ImumDisconnectOperation.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 *       Very simple layer over base class just for setting up progress reporter
       
    16 *
       
    17 */
       
    18 
       
    19 
       
    20 #include <eikenv.h>
       
    21 #include <eikrutil.h>
       
    22 #include <coehelp.h>
       
    23 
       
    24 #include <ImumInternalApi.h>            // CImumInternalApi
       
    25 #include <MsvPrgReporter.h>
       
    26 #include <MTMStore.h>
       
    27 #include <mtmuibas.h>
       
    28 #include <msvuids.h>    // KUidMsvLocalServiceMtm
       
    29 #include <miutmsg.h>    // CImEmailOperation
       
    30 #include <miutset.h>
       
    31 #include <SenduiMtmUids.h>
       
    32 
       
    33 #include <imum.rsg>
       
    34 #include "ImumDisconnectOperation.h"
       
    35 #include "EmailUtils.H"
       
    36 #include "ImumMtmLogging.h"
       
    37 
       
    38 const TInt KEmailDisconnectOpPriority = CActive::EPriorityStandard;
       
    39 
       
    40 // ----------------------------------------------------------------------------
       
    41 // CImumDisconnectOperation::
       
    42 //
       
    43 // ----------------------------------------------------------------------------
       
    44 CImumDisconnectOperation* CImumDisconnectOperation::NewL(CImumInternalApi& aMailboxApi, TRequestStatus& aObserverRequestStatus, MMsvProgressReporter& aReporter, TMsvId aService, TInt aFunctionId, TUid aMtmType)
       
    45     {
       
    46     IMUM_STATIC_CONTEXT( CImumDisconnectOperation::NewL, 0, mtm, KImumMtmLog );
       
    47     IMUM_IN();
       
    48     
       
    49     CImumDisconnectOperation* op = new(ELeave) CImumDisconnectOperation(aMailboxApi, aObserverRequestStatus, aReporter, aService);
       
    50     CleanupStack::PushL(op);
       
    51     op->ConstructL(aFunctionId, aMtmType);
       
    52     CleanupStack::Pop();
       
    53     IMUM_OUT();
       
    54     return op;
       
    55     }
       
    56 
       
    57 // ----------------------------------------------------------------------------
       
    58 // CImumDisconnectOperation::
       
    59 //
       
    60 // ----------------------------------------------------------------------------
       
    61 CImumDisconnectOperation::~CImumDisconnectOperation()
       
    62     {
       
    63     IMUM_CONTEXT( CImumDisconnectOperation::~CImumDisconnectOperation, 0, KImumMtmLog );
       
    64     IMUM_IN();
       
    65     IMUM_OUT();
       
    66     
       
    67     }
       
    68 
       
    69 // ----------------------------------------------------------------------------
       
    70 // CImumDisconnectOperation::
       
    71 //
       
    72 // ----------------------------------------------------------------------------
       
    73 const TDesC8& CImumDisconnectOperation::GetErrorProgressL(TInt /*aError*/)
       
    74     {
       
    75     IMUM_CONTEXT( CImumDisconnectOperation::GetErrorProgressL, 0, KImumMtmLog );
       
    76     IMUM_IN();
       
    77     IMUM_OUT();
       
    78     
       
    79     // Never gets called since iError always == KErrNone, because DoRunL() cannot leave.
       
    80     return iDummyProg;
       
    81     }
       
    82 
       
    83 // ----------------------------------------------------------------------------
       
    84 // ProgressL
       
    85 //
       
    86 // ----------------------------------------------------------------------------
       
    87 const TDesC8& CImumDisconnectOperation::ProgressL()
       
    88     {
       
    89     IMUM_CONTEXT( CImumDisconnectOperation::ProgressL, 0, KImumMtmLog );
       
    90     IMUM_IN();
       
    91     IMUM_OUT();
       
    92     
       
    93     return iDummyProg;
       
    94     }
       
    95 
       
    96 // ----------------------------------------------------------------------------
       
    97 // CImumDisconnectOperation::
       
    98 //
       
    99 // ----------------------------------------------------------------------------
       
   100 void CImumDisconnectOperation::DoRunL()
       
   101     {
       
   102     IMUM_CONTEXT( CImumDisconnectOperation::DoRunL, 0, KImumMtmLog );
       
   103     IMUM_IN();
       
   104     
       
   105     CompleteObserver();
       
   106     IMUM_OUT();
       
   107     }
       
   108 
       
   109 // ----------------------------------------------------------------------------
       
   110 // CImumDisconnectOperation::
       
   111 //
       
   112 // ----------------------------------------------------------------------------
       
   113 CImumDisconnectOperation::CImumDisconnectOperation(
       
   114     CImumInternalApi& aMailboxApi,
       
   115     TRequestStatus& aObserverRequestStatus,
       
   116     MMsvProgressReporter& aReporter,
       
   117     TMsvId aService)
       
   118     :
       
   119     CImumOnlineOperation(
       
   120         aMailboxApi,
       
   121         KEmailDisconnectOpPriority,
       
   122         aObserverRequestStatus,
       
   123         aReporter)
       
   124     {
       
   125     IMUM_CONTEXT( CImumDisconnectOperation::CImumDisconnectOperation, 0, KImumMtmLog );
       
   126     IMUM_IN();
       
   127     
       
   128     iService = aService;
       
   129     IMUM_OUT();
       
   130     }
       
   131 
       
   132 // ----------------------------------------------------------------------------
       
   133 // CImumDisconnectOperation::
       
   134 //
       
   135 // ----------------------------------------------------------------------------
       
   136 void CImumDisconnectOperation::ConstructL(TInt aFunctionId, TUid aMtmType)
       
   137     {
       
   138     IMUM_CONTEXT( CImumDisconnectOperation::ConstructL, 0, KImumMtmLog );
       
   139     IMUM_IN();
       
   140     
       
   141     BaseConstructL(aMtmType);
       
   142     iReporter.SetTitleL( R_EMAIL_DISCONNECT );
       
   143     iReporter.SetProgressDecoder(*this);
       
   144     iReporter.SetCanCancelL( EFalse );
       
   145 
       
   146     InvokeClientMtmAsyncFunctionL(aFunctionId, iService, iService);
       
   147     SetActive();
       
   148     IMUM_OUT();
       
   149     }
       
   150 
       
   151 // ----------------------------------------------------------------------------
       
   152 // CImumDisconnectOperation::
       
   153 //
       
   154 // ----------------------------------------------------------------------------
       
   155 TInt CImumDisconnectOperation::DecodeProgress(
       
   156     const TDesC8& /*aProgress*/,
       
   157     TBuf<CBaseMtmUi::EProgressStringMaxLen>& aReturnString,
       
   158     TInt& aTotalEntryCount,
       
   159     TInt& aEntriesDone,
       
   160     TInt& aCurrentEntrySize,
       
   161     TInt& aCurrentBytesTrans,
       
   162     TBool /*aInternal*/)
       
   163     {
       
   164     IMUM_CONTEXT( CImumDisconnectOperation::DecodeProgress, 0, KImumMtmLog );
       
   165     IMUM_IN();
       
   166     
       
   167     aTotalEntryCount=0;     //  No quantitative progress to return
       
   168     aEntriesDone=0;
       
   169     aCurrentEntrySize=0;
       
   170     aCurrentBytesTrans=0;
       
   171 
       
   172     aReturnString.Zero(); // when returning zero then muiu does not change current progress.
       
   173     IMUM_OUT();
       
   174 
       
   175     return KErrNone;
       
   176     }
       
   177