|
1 /* |
|
2 * Copyright (c) 2008 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: Definition of the class CFscContactActionPluginEngine. |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #ifndef C_FSCCONTACTACTIONPLUGINENGINE_H |
|
20 #define C_FSCCONTACTACTIONPLUGINENGINE_H |
|
21 |
|
22 #include <e32base.h> |
|
23 //<cmail> |
|
24 #include "fsccontactactionservicedefines.h" |
|
25 #include "mfsccontactactionpluginobserver.h" |
|
26 #include "tfsccontactactionpluginparams.h" |
|
27 //</cmail> |
|
28 |
|
29 // FORWARD DECLARATIONS |
|
30 class CVPbkContactManager; |
|
31 class CFscContactActionPlugin; |
|
32 class CFscActionUtils; |
|
33 class MFscContactSet; |
|
34 class MFscContactActionPluginEngineObserver; |
|
35 |
|
36 /** |
|
37 * Contact Action Service's plugin engine. |
|
38 * The engine implements service's plugin handling |
|
39 * |
|
40 * @lib fsccontactactionservice.lib |
|
41 * @since S60 3.1 |
|
42 */ |
|
43 class CFscContactActionPluginEngine : public CBase, |
|
44 public MFscContactActionPluginObserver |
|
45 { |
|
46 |
|
47 /** the states of operations */ |
|
48 enum TCasPluginEngineLastEvent |
|
49 { |
|
50 ECasEventIdle, |
|
51 ECasEventBeforePriorityForContactSet, |
|
52 ECasEventAfterPriorityForContactSet, |
|
53 ECasEventCanceledPriorityForContactSet |
|
54 }; |
|
55 |
|
56 public: |
|
57 |
|
58 /** |
|
59 * Two-phased constructor. |
|
60 * |
|
61 * @param aContactManager Contact manager |
|
62 * @return Constructed object |
|
63 */ |
|
64 static CFscContactActionPluginEngine* NewL( |
|
65 CVPbkContactManager& aContactManager ); |
|
66 |
|
67 /** |
|
68 * Destructor. |
|
69 */ |
|
70 virtual ~CFscContactActionPluginEngine(); |
|
71 |
|
72 public: // New methods |
|
73 |
|
74 /** |
|
75 * Detect and load plugins |
|
76 */ |
|
77 void LoadPluginsL(); |
|
78 |
|
79 /** |
|
80 * Release loaded plugins |
|
81 */ |
|
82 void ReleasePlugins(); |
|
83 |
|
84 /** |
|
85 * Query state of plugins |
|
86 * |
|
87 * @return ETrue if plugins are loaded |
|
88 */ |
|
89 TBool PluginsLoaded(); |
|
90 |
|
91 /** |
|
92 * Method for quering actions for contacts and groups |
|
93 * Method searches actions for contacts and groups and returns found |
|
94 * actions in aActionList. |
|
95 * |
|
96 * @param aActionList A reference to action list. Found actions are |
|
97 * appended to the list. |
|
98 * @param aContactSet Target contact set |
|
99 * @param aStopWhenOneActionFound stops query when at least one |
|
100 * action found. |
|
101 * @param aActionTypeFlags Action type flags which are used to filter |
|
102 * actions. |
|
103 * @param aMinPriority Min allowed priority of returned actions. |
|
104 * @param aObserver operation observer. |
|
105 */ |
|
106 void QueryActionsL( CFscContactActionList& aActionList, |
|
107 MFscContactSet& aContactSet, |
|
108 TBool aStopWhenOneActionFound, |
|
109 TUint64 aActionTypeFlags, |
|
110 TInt aMinPriority, |
|
111 MFscContactActionPluginEngineObserver* aObserver ); |
|
112 |
|
113 /** |
|
114 * Cancels async method QueryActionsL. |
|
115 */ |
|
116 void CancelQueryActions(); |
|
117 |
|
118 /** |
|
119 * Execute action. Aynchronous method. |
|
120 * |
|
121 * @param aActionUid uid of the action to be executed. |
|
122 * @param aContactSet Target contact set. |
|
123 * @param aObserver operation observer. |
|
124 */ |
|
125 void ExecuteL( |
|
126 TUid aActionUid, |
|
127 MFscContactSet& aContactSet, |
|
128 MFscContactActionPluginEngineObserver* aObserver ); |
|
129 |
|
130 /** |
|
131 * Cancels async method ExecuteL. |
|
132 */ |
|
133 void CancelExecute(); |
|
134 |
|
135 public: // From base class MFscContactActionPluginObserver |
|
136 |
|
137 /** |
|
138 * From MFscContactActionPluginObserver. |
|
139 * Called when PriorityForContactSetL method is complete. |
|
140 * |
|
141 * @param aPriority Retrieved priority. |
|
142 */ |
|
143 void PriorityForContactSetComplete( TInt aPriority ); |
|
144 |
|
145 /** |
|
146 * From MFscContactActionPluginObserver. |
|
147 * Called when PriorityForContactSetL method failed. |
|
148 * |
|
149 * @param aError An error code of the failure. |
|
150 */ |
|
151 void PriorityForContactSetFailed( TInt aError ); |
|
152 |
|
153 /** |
|
154 * From MFscContactActionPluginObserver. |
|
155 * Called when ExecuteL method is complete. |
|
156 */ |
|
157 virtual void ExecuteComplete(); |
|
158 |
|
159 /** |
|
160 * From MFscContactActionPluginObserver. |
|
161 * Called when ExecuteL method failed. |
|
162 * |
|
163 * @param aError An error code of the failure. |
|
164 */ |
|
165 virtual void ExecuteFailed( TInt aError ); |
|
166 |
|
167 private: |
|
168 |
|
169 /** |
|
170 * Constructor. |
|
171 * |
|
172 * @param aContactManager Contact manager |
|
173 */ |
|
174 CFscContactActionPluginEngine( CVPbkContactManager& aContactManager ); |
|
175 |
|
176 /** |
|
177 * Second phase constructor. |
|
178 */ |
|
179 void ConstructL(); |
|
180 |
|
181 private: // data |
|
182 |
|
183 /** |
|
184 * Plug-ins loaded flag. |
|
185 */ |
|
186 TBool iPluginsLoaded; |
|
187 |
|
188 /** |
|
189 * Action plug-in array. |
|
190 */ |
|
191 RPointerArray< CFscContactActionPlugin > iActionPlugins; |
|
192 |
|
193 /** |
|
194 * Virtual phonebook contact manager |
|
195 */ |
|
196 CVPbkContactManager& iContactManager; |
|
197 |
|
198 /** |
|
199 * Action Utils. |
|
200 * Own. |
|
201 */ |
|
202 CFscActionUtils* iActionUtils; |
|
203 |
|
204 /** |
|
205 * Plugin params |
|
206 */ |
|
207 TFscContactActionPluginParams iPluginParams; |
|
208 |
|
209 /** |
|
210 * Last event that took place - for cooperation with async methods. |
|
211 */ |
|
212 TCasPluginEngineLastEvent iLastEvent; |
|
213 |
|
214 /** |
|
215 * Operation observer. |
|
216 * Not own. |
|
217 */ |
|
218 MFscContactActionPluginEngineObserver* iObserver; |
|
219 |
|
220 private: // data for async call of QueryActionsL |
|
221 |
|
222 /** |
|
223 * Action list. Found actions are appended to the list. |
|
224 */ |
|
225 CFscContactActionList* iActionList; |
|
226 |
|
227 /** |
|
228 * Target contact set for which actions are queried. |
|
229 */ |
|
230 MFscContactSet* iContactSet; |
|
231 |
|
232 /** |
|
233 * Flag for stopping query when at least one action found. |
|
234 */ |
|
235 TBool iStopWhenOneActionFound; |
|
236 |
|
237 /** |
|
238 * Action type flags which are used to filter actions. |
|
239 */ |
|
240 TUint64 iActionTypeFlags; |
|
241 |
|
242 /** |
|
243 * Min allowed priority of returned actions. |
|
244 */ |
|
245 TInt iMinPriority; |
|
246 |
|
247 /** |
|
248 * Currently processed plugin in QueryActionsL. |
|
249 */ |
|
250 TInt iCurrentActionPlugin; |
|
251 |
|
252 /** |
|
253 * Currently processed action in QueryActionsL. |
|
254 */ |
|
255 TInt iCurrentAction; |
|
256 |
|
257 /** |
|
258 * Result of QueryActionsL. |
|
259 */ |
|
260 TFscContactActionQueryResult iContactActionQueryResult; |
|
261 |
|
262 }; |
|
263 |
|
264 #endif // C_FSCCONTACTACTIONPLUGINENGINE_H |