meetingrequest/mrtasks/inc/cesmrcombinedtask.h
changeset 0 8466d47a6819
child 16 4ce476e64c59
equal deleted inserted replaced
-1:000000000000 0:8466d47a6819
       
     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:  Interface definition for ESMR send mr response via mail task
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef C_ESMRCOMBINEDTASK_H
       
    20 #define C_ESMRCOMBINEDTASK_H
       
    21 
       
    22 #include "cesmrtaskbase.h"
       
    23 
       
    24 /**
       
    25  * CESMRCombinedTask is responsibe for executing multiple tasks.
       
    26  *
       
    27  * CESMRCombinedTask executes the tasks in the order they are appended
       
    28  * to task list.
       
    29  *
       
    30  * It is possible first add some tasks and execute them. Then remove
       
    31  * some tasks and execute the task again.
       
    32  *
       
    33  * @code
       
    34  *   CESMRCombinedTask* task = CESMRCombinedTask::NewL( ... );
       
    35  *   CleanupStack::PushL( task );
       
    36  *   task->AppendTaskL( ... );
       
    37  *   task->AppendTaskL( ... );
       
    38  *   task->AppendTaskL( ... );
       
    39  *   task->ExecuteTaskL();
       
    40  *   task->RemoveTaskL( ... );
       
    41  *   task->ExecuteTaskL();
       
    42  *   CleanupStack::PopAndDestroy();
       
    43  * @endcode
       
    44  *
       
    45  * @lib esmrtasks.lib
       
    46  */
       
    47 NONSHARABLE_CLASS( CESMRCombinedTask ) : public CESMRTaskBase
       
    48     {
       
    49 public:
       
    50 
       
    51     /**
       
    52      * Enumeration for combined task execution rule.
       
    53      * If EESMRTrap is used, each task is trapped when executed.
       
    54      * If any of the tasks leave, then combined task leave after
       
    55      * each task is executed.
       
    56      * However leave code KErrCancel is leaved right away.
       
    57      */
       
    58     enum TESMRExecutionRule
       
    59         {
       
    60         EESMRLeave,     // Leave if any of the tasks leave
       
    61         EESMRTrap       // TRAP each task and continue
       
    62         };
       
    63 
       
    64 public:
       
    65     /**
       
    66      * Creates and initializes new CESMRCombinedTask object.
       
    67      * Ownership is transferred to caller.
       
    68      * @param aCalDbMgr Reference to cal db manager.
       
    69      * @param aEntry Reference to ES MR calendar entry.
       
    70      * @param aMRMailboxUtils Reference mr mailbox utilities.
       
    71      * @param aRule Exection rule
       
    72      */
       
    73     static CESMRCombinedTask* NewL(
       
    74         MESMRCalDbMgr& aCalDbMgr,
       
    75         MESMRMeetingRequestEntry& aEntry,
       
    76         CMRMailboxUtils& aMRMailboxUtils,
       
    77         TESMRExecutionRule aRule =  CESMRCombinedTask::EESMRLeave );
       
    78 
       
    79     /**
       
    80      * C++ destructor.
       
    81      */
       
    82     ~CESMRCombinedTask();
       
    83 
       
    84     /**
       
    85      * Appends task to be executed. Ownership of appended task
       
    86      * is transferred.
       
    87      * @param aTask Pointer to task to be executed.
       
    88      */
       
    89     void AppendTaskL( MESMRTask* aTask );
       
    90 
       
    91     /**
       
    92      * Removes the task from task list. Method returns the pointer to
       
    93      * removed task. Ownership of the removed task is transferred to caller.
       
    94      *
       
    95      * @param aTask Pointer to task to be removed.
       
    96      * @return Pointer to removed task.
       
    97      */
       
    98     MESMRTask* RemoveTaskL( MESMRTask* aTask );
       
    99 
       
   100 public:// From MESMRTask
       
   101     void ExecuteTaskL();
       
   102 
       
   103 private: // Implementation
       
   104     CESMRCombinedTask(
       
   105             MESMRCalDbMgr& aCalDbMgr,
       
   106             MESMRMeetingRequestEntry& aEntry,
       
   107             CMRMailboxUtils& aMRMailboxUtils,
       
   108             TESMRExecutionRule aRule );
       
   109 
       
   110     void ConstructL();
       
   111 
       
   112 private: // Data
       
   113     /**
       
   114     * Array of tasks to be executed
       
   115     * Own
       
   116     */
       
   117     RPointerArray<MESMRTask> iTasks;
       
   118 
       
   119     /**
       
   120     * Task execution rule
       
   121     */
       
   122     TESMRExecutionRule iExecutionRule;
       
   123     };
       
   124 
       
   125 #endif // C_ESMRCOMBINEDTASK_H