meetingrequest/mrtasks/mrcaleventtaskplugin/src/cmrcalentryuideletetask.cpp
branchRCL_3
changeset 12 4ce476e64c59
equal deleted inserted replaced
11:0396474f30f5 12:4ce476e64c59
       
     1 /*
       
     2 * Copyright (c) 2007-2009 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:  Implementation for ESMR calendar event task
       
    15 *
       
    16 */
       
    17 
       
    18 #include "cmrcalentryuideletetask.h"
       
    19 #include "cesmrcaldbmgr.h"
       
    20 #include "mesmrcalentry.h"
       
    21 
       
    22 #include "emailtrace.h"
       
    23 
       
    24 // ======== MEMBER FUNCTIONS ========
       
    25 
       
    26 // ---------------------------------------------------------------------------
       
    27 // CESMRCalEntryUiDeleteTask::CESMRCalEntryUiDeleteTask
       
    28 // ---------------------------------------------------------------------------
       
    29 //
       
    30 CESMRCalEntryUiDeleteTask::CESMRCalEntryUiDeleteTask( MESMRCalEntry& aEntry, 
       
    31         MESMRCalDbMgr& aCalDbMgr )
       
    32 :   iEntry( aEntry ), 
       
    33     iCalDbMgr( aCalDbMgr )
       
    34     {
       
    35     FUNC_LOG;
       
    36     //do nothing
       
    37     }
       
    38 
       
    39 // ---------------------------------------------------------------------------
       
    40 // CESMRCalEntryUiDeleteTask::~CESMRCalEntryUiDeleteTask
       
    41 // ---------------------------------------------------------------------------
       
    42 //
       
    43 CESMRCalEntryUiDeleteTask::~CESMRCalEntryUiDeleteTask()
       
    44     {
       
    45     FUNC_LOG;
       
    46     //do nothing
       
    47     }
       
    48 
       
    49 // ---------------------------------------------------------------------------
       
    50 // CESMRCalEntryUiDeleteTask::NewL
       
    51 // ---------------------------------------------------------------------------
       
    52 //
       
    53 CESMRCalEntryUiDeleteTask* CESMRCalEntryUiDeleteTask::NewL( 
       
    54         MESMRCalEntry& aEntry, 
       
    55         MESMRCalDbMgr& aCalDbMgr )
       
    56     {
       
    57     FUNC_LOG;
       
    58     CESMRCalEntryUiDeleteTask* self = 
       
    59         new (ELeave) CESMRCalEntryUiDeleteTask( aEntry, aCalDbMgr );
       
    60     CleanupStack::PushL(self);
       
    61     self->ConstructL();
       
    62     CleanupStack::Pop(self);
       
    63     return self;
       
    64     }
       
    65 
       
    66 // ---------------------------------------------------------------------------
       
    67 // CESMRCalEntryUiDeleteTask::ConstructL
       
    68 // ---------------------------------------------------------------------------
       
    69 //
       
    70 void CESMRCalEntryUiDeleteTask::ConstructL()
       
    71     {
       
    72     FUNC_LOG;
       
    73     //do nothing
       
    74     }
       
    75 
       
    76 // ---------------------------------------------------------------------------
       
    77 // CESMRCalEntryUiDeleteTask::ExecuteTaskL
       
    78 // ---------------------------------------------------------------------------
       
    79 //
       
    80 void CESMRCalEntryUiDeleteTask::ExecuteTaskL()
       
    81     {
       
    82     FUNC_LOG;
       
    83 
       
    84     // Delete from calendar DB
       
    85     DeleteEntryFromDbL();
       
    86     }
       
    87 
       
    88 // ---------------------------------------------------------------------------
       
    89 // CESMRCalEntryUiDeleteTask::DeleteEntryFromDbL
       
    90 // ---------------------------------------------------------------------------
       
    91 //
       
    92 void CESMRCalEntryUiDeleteTask::DeleteEntryFromDbL()
       
    93     {
       
    94     FUNC_LOG;
       
    95     CCalEntry* entryToBeDeleted = iEntry.ValidateEntryL();
       
    96     CleanupStack::PushL( entryToBeDeleted );
       
    97 
       
    98     TRAPD( err, iCalDbMgr.DeleteEntryCondL( *entryToBeDeleted ) );
       
    99     if ( err != KErrNone )
       
   100         {
       
   101         #ifdef _DEBUG
       
   102         User::LeaveIfError( err );
       
   103         #endif // _DEBUG
       
   104         }
       
   105     
       
   106     CleanupStack::PopAndDestroy( entryToBeDeleted );
       
   107     entryToBeDeleted = NULL;    
       
   108     }
       
   109 
       
   110 // EOF
       
   111