|
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 "mesmrtask.h" |
|
23 #include <e32base.h> |
|
24 |
|
25 class MESMRCalEntry; |
|
26 |
|
27 /** |
|
28 * CESMRCombinedTask is responsibe for executing multiple tasks. |
|
29 * |
|
30 * CESMRCombinedTask executes the tasks in the order they are appended |
|
31 * to task list. |
|
32 * |
|
33 * It is possible first add some tasks and execute them. Then remove |
|
34 * some tasks and execute the task again. |
|
35 * |
|
36 * @code |
|
37 * CESMRCombinedTask* task = CESMRCombinedTask::NewL( ... ); |
|
38 * CleanupStack::PushL( task ); |
|
39 * task->AppendTaskL( ... ); |
|
40 * task->AppendTaskL( ... ); |
|
41 * task->AppendTaskL( ... ); |
|
42 * task->ExecuteTaskL(); |
|
43 * task->RemoveTaskL( ... ); |
|
44 * task->ExecuteTaskL(); |
|
45 * CleanupStack::PopAndDestroy(); |
|
46 * @endcode |
|
47 * |
|
48 * @lib esmrtasks.lib |
|
49 */ |
|
50 NONSHARABLE_CLASS( CESMRCombinedTask ) : public CBase, |
|
51 public MESMRTask |
|
52 { |
|
53 public: |
|
54 |
|
55 /** |
|
56 * Enumeration for combined task execution rule. |
|
57 * If EESMRTrap is used, each task is trapped when executed. |
|
58 * If any of the tasks leave, then combined task leave after |
|
59 * each task is executed. |
|
60 * However leave code KErrCancel is leaved right away. |
|
61 */ |
|
62 enum TESMRExecutionRule |
|
63 { |
|
64 EESMRLeave, // Leave if any of the tasks leave |
|
65 EESMRTrap // TRAP each task and continue |
|
66 }; |
|
67 |
|
68 public: |
|
69 /** |
|
70 * Creates and initializes new CESMRCombinedTask object. |
|
71 * Ownership is transferred to caller. |
|
72 * @param aCalDbMgr Reference to cal db manager. |
|
73 * @param aEntry Reference to ES MR calendar entry. |
|
74 * @param aMRMailboxUtils Reference mr mailbox utilities. |
|
75 * @param aRule Exection rule |
|
76 */ |
|
77 IMPORT_C static CESMRCombinedTask* NewL( |
|
78 MESMRCalEntry& aEntry, |
|
79 TESMRExecutionRule aRule = CESMRCombinedTask::EESMRLeave ); |
|
80 |
|
81 /** |
|
82 * C++ destructor. |
|
83 */ |
|
84 IMPORT_C ~CESMRCombinedTask(); |
|
85 |
|
86 /** |
|
87 * Appends task to be executed. Ownership of appended task |
|
88 * is transferred. |
|
89 * @param aTask Pointer to task to be executed. |
|
90 */ |
|
91 IMPORT_C void AppendTaskL( MESMRTask* aTask ); |
|
92 |
|
93 /** |
|
94 * Removes the task from task list. Method returns the pointer to |
|
95 * removed task. Ownership of the removed task is transferred to caller. |
|
96 * |
|
97 * @param aTask Pointer to task to be removed. |
|
98 * @return Pointer to removed task. |
|
99 */ |
|
100 IMPORT_C MESMRTask* RemoveTaskL( MESMRTask* aTask ); |
|
101 |
|
102 public:// From MESMRTask |
|
103 void ExecuteTaskL(); |
|
104 |
|
105 private: // Implementation |
|
106 CESMRCombinedTask( |
|
107 MESMRCalEntry& aEntry, |
|
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 * Reference to entry. |
|
121 */ |
|
122 MESMRCalEntry& iEntry; |
|
123 |
|
124 /** |
|
125 * Task execution rule |
|
126 */ |
|
127 TESMRExecutionRule iExecutionRule; |
|
128 }; |
|
129 |
|
130 /** |
|
131 * Helper function to append task into a combined task. |
|
132 * Takes ownership of aTask at calling time and delegates it to the combined task. |
|
133 * aTask must not be into CleanupStack at calling time. |
|
134 * |
|
135 * @param aContainer combined task |
|
136 * @param aTask a task to append into container |
|
137 */ |
|
138 IMPORT_C void AppendTaskL( CESMRCombinedTask& aContainer, MESMRTask* aTask ); |
|
139 |
|
140 #endif // C_ESMRCOMBINEDTASK_H |