email/imum/Mtms/Src/Imap4ConnectedDeleteOp.cpp
branchRCL_3
changeset 60 7fdbb852d323
parent 0 72b543305e3a
equal deleted inserted replaced
57:ebe688cedc25 60:7fdbb852d323
       
     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 *       Folder delete
       
    16 *
       
    17 */
       
    18 
       
    19 
       
    20 #include <eikenv.h>
       
    21 #include <eikrutil.h>
       
    22 
       
    23 #include "Imap4ConnectedDeleteOp.h"
       
    24 #include "EmailMsgSizerOperation.h"
       
    25 #include "EmailUtils.H"
       
    26 #include "ImumDisconnectOperation.h"
       
    27 #include "IMAPPRGR.H"
       
    28 #include "ImumMtmLogging.h"
       
    29 
       
    30 CImap4ConnectedDeleteOp* CImap4ConnectedDeleteOp::NewL(
       
    31     CImumInternalApi& aMailboxApi,
       
    32     TRequestStatus& aStatus,
       
    33     MMsvProgressReporter& aReporter,
       
    34     TMsvId aServiceId,
       
    35     const CMsvEntrySelection& aSel)
       
    36     {
       
    37     IMUM_STATIC_CONTEXT( CImap4ConnectedDeleteOp::NewL, 0, mtm, KImumMtmLog );
       
    38     IMUM_IN();
       
    39     
       
    40     CImap4ConnectedDeleteOp* op = new(ELeave) CImap4ConnectedDeleteOp(
       
    41         aMailboxApi, aStatus, aReporter, aServiceId);
       
    42     CleanupStack::PushL(op);
       
    43     op->iSelection = aSel.CopyL();
       
    44     op->ConstructL();
       
    45     CleanupStack::Pop();
       
    46     IMUM_OUT();
       
    47     return op;
       
    48     }
       
    49 
       
    50 CImap4ConnectedDeleteOp::~CImap4ConnectedDeleteOp()
       
    51     {
       
    52     IMUM_CONTEXT( CImap4ConnectedDeleteOp::~CImap4ConnectedDeleteOp, 0, KImumMtmLog );
       
    53     IMUM_IN();
       
    54     
       
    55     delete iSelection;
       
    56     IMUM_OUT();
       
    57     }
       
    58 
       
    59 void CImap4ConnectedDeleteOp::DoConnectedOpL()
       
    60     {
       
    61     IMUM_CONTEXT( CImap4ConnectedDeleteOp::DoConnectedOpL, 0, KImumMtmLog );
       
    62     IMUM_IN();
       
    63     
       
    64     iStatus = KRequestPending;
       
    65     if(iSelection->Count())
       
    66         {
       
    67         CMsvEntry* centry = iMsvSession.GetEntryL((*iSelection)[0]);
       
    68         CleanupStack::PushL(centry);
       
    69         centry->SetEntryL(centry->Entry().Parent());
       
    70         delete iOperation;
       
    71         iOperation = NULL;
       
    72         iOperation = centry->DeleteL(*iSelection, iStatus);
       
    73         CleanupStack::PopAndDestroy();
       
    74         }
       
    75     else
       
    76         {
       
    77         CompleteThis();
       
    78         }
       
    79     SetActive();
       
    80     IMUM_OUT();
       
    81     }
       
    82 
       
    83 const TDesC8& CImap4ConnectedDeleteOp::ConnectedOpErrorProgressL(TInt aError)
       
    84     {
       
    85     IMUM_CONTEXT( CImap4ConnectedDeleteOp::ConnectedOpErrorProgressL, 0, KImumMtmLog );
       
    86     IMUM_IN();
       
    87     
       
    88     TImap4UiProgress& prog = iUiProgressBuf();
       
    89     prog.iType = KImap4UiProgressType;
       
    90     prog.iUiOperation = TImap4UiProgress::EDeletingFolder;
       
    91     prog.iError = aError;
       
    92     IMUM_OUT();
       
    93     return iUiProgressBuf;
       
    94     }
       
    95 
       
    96 CImap4ConnectedDeleteOp::CImap4ConnectedDeleteOp(
       
    97     CImumInternalApi& aMailboxApi,
       
    98     TRequestStatus& aStatus,
       
    99     MMsvProgressReporter& aReporter,
       
   100     TMsvId aServiceId)
       
   101     :
       
   102     CImap4ConnectedOp(aMailboxApi, aStatus, aReporter, aServiceId)
       
   103     {
       
   104     IMUM_CONTEXT( CImap4ConnectedDeleteOp::CImap4ConnectedDeleteOp, 0, KImumMtmLog );
       
   105     IMUM_IN();
       
   106     IMUM_OUT();
       
   107     
       
   108     }
       
   109 
       
   110