|
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: Process Manager to get process interfaces e.g. login,settings |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 // INCLUDE FILES |
|
21 #include "CCAProcessManager.h" |
|
22 |
|
23 #include "MCALoggerHeadersInterface.h" |
|
24 #include "CCARecordedChatsPC.h" |
|
25 #include "CCARecordedChatsArrayPC.h" |
|
26 #include "MCAProcessManager.h" |
|
27 #include "MCAMainViewArrayPC.h" |
|
28 #include "CCALoginPC.h" |
|
29 |
|
30 #include "CCASettingsPC.h" |
|
31 |
|
32 #include "CCAConversationPC.h" |
|
33 |
|
34 #include "CCAEngine.h" |
|
35 #include "CAPresenceManager.h" |
|
36 |
|
37 #include "MCAInvite.h" |
|
38 #include "MCAChatInterface.h" |
|
39 #include "CCAStorageManagerFactory.h" |
|
40 #include "mcamessageerrorinformer.h" |
|
41 #include "MCAStoredContact.h" |
|
42 #include "MCAStoredContacts.h" |
|
43 |
|
44 |
|
45 #include "CCAContactEditPC.h" |
|
46 #include "CCABlockingPC.h" |
|
47 #include "CCASearchDataPC.h" |
|
48 #include "CCASearchInterfacePC.h" |
|
49 #include "MCASearchInterface.h" |
|
50 #include "ccareactiveauthpc.h" |
|
51 #include "CCAMessageFlowHandlerPC.h" |
|
52 #include "CCAInvitationPC.h" |
|
53 #include "MCAInvitationPC.h" |
|
54 #include "CCAGroupPC.h" |
|
55 #include "CCAGroupUtilsPC.h" |
|
56 #include "CCAInviteEditorPC.h" |
|
57 #include "MCAInviteEditorPC.h" |
|
58 #include "CCAGlobalNotificationObserverPC.h" |
|
59 #include "MCAGlobalNotificationObserverPC.h" |
|
60 #include "MCAGroupPropertiesPC.h" |
|
61 #include "CCAGroupPropertiesPC.h" |
|
62 #include "CCAApplicationNGPC.h" |
|
63 |
|
64 #include "CCAOpenChatsPC.h" |
|
65 |
|
66 // FORWARD DECLARATIONS |
|
67 class MCABackgroundInterface; |
|
68 |
|
69 //const declarations |
|
70 const TUid KUidChatClient = {0x101F4673}; |
|
71 |
|
72 |
|
73 |
|
74 // ============================ MEMBER FUNCTIONS =============================== |
|
75 |
|
76 |
|
77 // ----------------------------------------------------------------------------- |
|
78 // CCAProcessManager::NewL |
|
79 // ----------------------------------------------------------------------------- |
|
80 // |
|
81 |
|
82 EXPORT_C CCAProcessManager* CCAProcessManager::NewL() |
|
83 { |
|
84 CCAProcessManager* self = new ( ELeave ) CCAProcessManager(); |
|
85 |
|
86 CleanupStack::PushL( self ); |
|
87 self->ConstructL(); |
|
88 CleanupStack::Pop( self ); |
|
89 |
|
90 return self; |
|
91 } |
|
92 |
|
93 // ----------------------------------------------------------------------------- |
|
94 // CCAProcessManager::CreateOpenChatsPCL |
|
95 // ----------------------------------------------------------------------------- |
|
96 // |
|
97 |
|
98 EXPORT_C MCAOpenChatsPC* CCAProcessManager::CreateOpenChatsPCL( |
|
99 const RPointerArray<MCAArrayItemPC>& aOpenChatsArray ) |
|
100 { |
|
101 |
|
102 MCAOpenChatsPC* openChatsPC = CCAOpenChatsPC::NewL( aOpenChatsArray ); |
|
103 |
|
104 //Ownership is transfered to the caller. |
|
105 return openChatsPC; |
|
106 } |
|
107 |
|
108 // ----------------------------------------------------------------------------- |
|
109 // CCAProcessManager::GetEngine |
|
110 // ----------------------------------------------------------------------------- |
|
111 // |
|
112 |
|
113 EXPORT_C CCAEngine* CCAProcessManager::GetEngine() const |
|
114 { |
|
115 return iEngine; |
|
116 } |
|
117 |
|
118 // ----------------------------------------------------------------------------- |
|
119 // CCAProcessManager::GetLogInInterface |
|
120 // ----------------------------------------------------------------------------- |
|
121 // |
|
122 |
|
123 EXPORT_C MCALoginPC* CCAProcessManager::GetLogInInterface( ) const |
|
124 { |
|
125 return iCCALogIn; |
|
126 } |
|
127 |
|
128 // ----------------------------------------------------------------------------- |
|
129 // CCAProcessManager::GetSettingsInterface |
|
130 // ----------------------------------------------------------------------------- |
|
131 // |
|
132 |
|
133 EXPORT_C MCASettingsPC* CCAProcessManager::GetSettingsInterface( ) const |
|
134 { |
|
135 return iSettingsPC; |
|
136 } |
|
137 |
|
138 // ----------------------------------------------------------------------------- |
|
139 // CCAProcessManager::GetInvitationsInterface |
|
140 // ----------------------------------------------------------------------------- |
|
141 // |
|
142 |
|
143 EXPORT_C MCAInvitationPC* CCAProcessManager::GetInvitationsInterface( ) const |
|
144 { |
|
145 return iInvitationsPC; |
|
146 } |
|
147 |
|
148 // ----------------------------------------------------------------------------- |
|
149 // CCAProcessManager::GetArrayInterface |
|
150 // ----------------------------------------------------------------------------- |
|
151 // |
|
152 |
|
153 EXPORT_C MCAMainViewArrayPC* CCAProcessManager::GetArrayInterface() const |
|
154 { |
|
155 return iCCALogIn->GetArrayInterface(); |
|
156 } |
|
157 |
|
158 // ----------------------------------------------------------------------------- |
|
159 // CCAProcessManager::GetConversationInterface |
|
160 // ----------------------------------------------------------------------------- |
|
161 // |
|
162 EXPORT_C MCAConversationPC* CCAProcessManager::GetConversationInterface( ) const |
|
163 { |
|
164 return iConversationPC; |
|
165 } |
|
166 |
|
167 // ----------------------------------------------------------------------------- |
|
168 // CCAProcessManager::GetGroupInterface |
|
169 // ----------------------------------------------------------------------------- |
|
170 // |
|
171 EXPORT_C MCAGroupPC* CCAProcessManager::GetGroupInterface( ) const |
|
172 { |
|
173 return iGroupPC; |
|
174 } |
|
175 // ----------------------------------------------------------------------------- |
|
176 // CCAProcessManager::GetGroupUtilsInterface |
|
177 // ----------------------------------------------------------------------------- |
|
178 // |
|
179 EXPORT_C MCAGroupUtilsPC* CCAProcessManager::GetGroupUtilsInterface( ) const |
|
180 { |
|
181 return iGroupUtilsPC; |
|
182 } |
|
183 |
|
184 |
|
185 // ----------------------------------------------------------------------------- |
|
186 // CCAProcessManager::GetContactEditInterface |
|
187 // ----------------------------------------------------------------------------- |
|
188 // |
|
189 EXPORT_C MCAContactEditPC* CCAProcessManager::GetContactEditInterface() const |
|
190 { |
|
191 return iCCAContactEditPC; |
|
192 } |
|
193 // ----------------------------------------------------------------------------- |
|
194 // CCAProcessManager::GetSearchDataInterface |
|
195 // ----------------------------------------------------------------------------- |
|
196 // |
|
197 EXPORT_C MCASearchDataPC* CCAProcessManager::GetSearchDataInterface() const |
|
198 { |
|
199 return iDataInterfacePC; |
|
200 } |
|
201 |
|
202 // ----------------------------------------------------------------------------- |
|
203 // CCAProcessManager::GetSearchInterface |
|
204 // ----------------------------------------------------------------------------- |
|
205 // |
|
206 EXPORT_C MCASearchInterfacePC* CCAProcessManager::GetSearchInterface() const |
|
207 { |
|
208 return iSearchInterfacePC; |
|
209 } |
|
210 |
|
211 // ----------------------------------------------------------------------------- |
|
212 // CCAProcessManager::GetReactiveAuthInterface |
|
213 // ----------------------------------------------------------------------------- |
|
214 // |
|
215 EXPORT_C MCAReactiveAuthPC* CCAProcessManager::GetReactiveAuthInterface() const |
|
216 { |
|
217 return iReactiveAuthPC; |
|
218 } |
|
219 // ----------------------------------------------------------------------------- |
|
220 // CCAProcessManager::GetBlockingPCInterface |
|
221 // ----------------------------------------------------------------------------- |
|
222 // |
|
223 |
|
224 EXPORT_C MCABlockingPC* CCAProcessManager::GetBlockingInterface( ) const |
|
225 { |
|
226 return iCCABlockingPC; |
|
227 } |
|
228 |
|
229 |
|
230 // ----------------------------------------------------------------------------- |
|
231 // CCAProcessManager::CreateInviteEditorPCL |
|
232 // ----------------------------------------------------------------------------- |
|
233 // |
|
234 |
|
235 EXPORT_C MCAInviteEditorPC* CCAProcessManager::CreateInviteEditorPCL() |
|
236 { |
|
237 |
|
238 MCAInviteEditorPC* inviteEditor = CCAInviteEditorPC::NewL( *iEngine->GetInvitationInterface(), |
|
239 *CAPresenceManager::InstanceL() ); |
|
240 //Ownership is transfered to the caller. |
|
241 return inviteEditor; |
|
242 } |
|
243 |
|
244 // ----------------------------------------------------------------------------- |
|
245 // CCAProcessManager::GetRecordedChatsPC |
|
246 // ----------------------------------------------------------------------------- |
|
247 // |
|
248 |
|
249 EXPORT_C MCARecordedChatsPC* CCAProcessManager::GetRecordedChatsPC() const |
|
250 { |
|
251 return iRecordedChatsPC; |
|
252 } |
|
253 // ----------------------------------------------------------------------------- |
|
254 // CCAProcessManager::GetRecordedChatsArrayPC |
|
255 // ----------------------------------------------------------------------------- |
|
256 // |
|
257 EXPORT_C MCARecordedChatsArrayPC* CCAProcessManager::GetRecordedChatsArrayPC() const |
|
258 { |
|
259 return iRecordedChatsArrayPC; |
|
260 } |
|
261 // ----------------------------------------------------------------------------- |
|
262 // CCAProcessManager::GetGlobalNotificationInterface |
|
263 // ----------------------------------------------------------------------------- |
|
264 // |
|
265 EXPORT_C MCAGlobalNotificationObserverPC* CCAProcessManager::GetGlobalNotificationInterface() const |
|
266 { |
|
267 return iGlobalNotificationObserverPC; |
|
268 } |
|
269 // ----------------------------------------------------------------------------- |
|
270 // CCAProcessManager::GetRecordedChatsArrayPC |
|
271 // ----------------------------------------------------------------------------- |
|
272 // |
|
273 EXPORT_C MCAGroupPropertiesPC* CCAProcessManager::GetGroupPropertiesPC() const |
|
274 { |
|
275 return iGroupPropertiesPC; |
|
276 } |
|
277 |
|
278 EXPORT_C MCAApplicationNGPC* CCAProcessManager::GetApplicationNGPC() const |
|
279 { |
|
280 return iApplicationNGPC; |
|
281 } |
|
282 |
|
283 // ----------------------------------------------------------------------------- |
|
284 // Default Constructor |
|
285 // ----------------------------------------------------------------------------- |
|
286 // |
|
287 CCAProcessManager::CCAProcessManager() |
|
288 { |
|
289 |
|
290 } |
|
291 |
|
292 // ----------------------------------------------------------------------------- |
|
293 // CCAProcessManager::FinalizeEngineConstructionL |
|
294 // ----------------------------------------------------------------------------- |
|
295 // |
|
296 |
|
297 EXPORT_C void CCAProcessManager::FinalizeEngineConstructionL() |
|
298 { |
|
299 iEngine->FinalizeEngineConstructionL(); |
|
300 |
|
301 } |
|
302 |
|
303 // ----------------------------------------------------------------------------- |
|
304 // Destructor |
|
305 // ----------------------------------------------------------------------------- |
|
306 // |
|
307 |
|
308 EXPORT_C CCAProcessManager::~CCAProcessManager() |
|
309 { |
|
310 delete iApplicationNGPC; |
|
311 delete iGroupPropertiesPC; |
|
312 delete iGlobalNotificationObserverPC; |
|
313 delete iRecordedChatsPC; |
|
314 delete iRecordedChatsArrayPC; |
|
315 delete iCCALogIn; |
|
316 delete iSettingsPC; |
|
317 delete iConversationPC; |
|
318 delete iMainViewItemArray; |
|
319 delete iCCAContactEditPC; |
|
320 delete iCCABlockingPC; |
|
321 delete iDataInterfacePC; |
|
322 delete iSearchInterfacePC; |
|
323 delete iReactiveAuthPC; |
|
324 delete iInvitationsPC; |
|
325 delete iGroupPC; |
|
326 delete iGroupUtilsPC; |
|
327 delete iEngine; |
|
328 |
|
329 } |
|
330 |
|
331 // ----------------------------------------------------------------------------- |
|
332 // CCAProcessManager::ConstructL |
|
333 // ----------------------------------------------------------------------------- |
|
334 // |
|
335 |
|
336 void CCAProcessManager::ConstructL() |
|
337 { |
|
338 |
|
339 |
|
340 iEngine = CCAEngine::NewL( KUidChatClient ); |
|
341 |
|
342 iEngine->FinalizeEngineConstructionL(); |
|
343 |
|
344 iCCALogIn = CCALoginPC::NewL( *iEngine ); |
|
345 |
|
346 iSettingsPC = CCASettingsPC::NewL( *iEngine ); |
|
347 |
|
348 iGlobalNotificationObserverPC = CCAGlobalNotificationObserverPC::NewL( |
|
349 iEngine->ContactListModel(), |
|
350 iEngine->ChatInterface(), |
|
351 *( iEngine->GetInvitationInterface() ), |
|
352 *( iEngine->GetInternalSettingsInterface() ), |
|
353 iEngine->MessageUtils() ); |
|
354 |
|
355 |
|
356 iConversationPC = CCAConversationPC::NewL( *iEngine ); |
|
357 iCCAContactEditPC = CCAContactEditPC::NewL( *iSettingsPC ); |
|
358 MCASearchInterface* searchInterface = iEngine->GetSearchInterface(); |
|
359 MCABackgroundInterface* backgrdinterface = iEngine->BackgroundInterface(); |
|
360 if ( searchInterface && backgrdinterface ) |
|
361 { |
|
362 MCAGroupManagerInterface* groupMgrInterface = iEngine->GetGroupInterface(); |
|
363 iSearchInterfacePC = CCASearchInterfacePC::NewL( |
|
364 searchInterface , *backgrdinterface, *groupMgrInterface ); |
|
365 } |
|
366 |
|
367 |
|
368 if ( searchInterface ) |
|
369 { |
|
370 iDataInterfacePC = CCASearchDataPC::NewL( searchInterface->SearchDataInterface() ); |
|
371 } |
|
372 |
|
373 |
|
374 iCCABlockingPC = CCABlockingPC::NewL( *iEngine ); |
|
375 |
|
376 iInvitationsPC = CCAInvitationPC::NewL( *iEngine, iEngine->ChatInterface() ); |
|
377 |
|
378 //specific interfaces can be passed in NewL later |
|
379 iGroupPC = CCAGroupPC::NewL( iEngine->GetGroupInterface(), |
|
380 iEngine->ChatInterface(), |
|
381 iEngine->MessageUtils() ); |
|
382 |
|
383 iGroupUtilsPC = CCAGroupUtilsPC::NewL( *iEngine ); |
|
384 |
|
385 MCALoggerHeadersInterface* loggerHeaderInterface = iEngine->GetLoggerHeadersInterface(); |
|
386 iRecordedChatsArrayPC = CCARecordedChatsArrayPC::NewL( *loggerHeaderInterface ); |
|
387 iRecordedChatsPC = CCARecordedChatsPC::NewL( *loggerHeaderInterface, *iRecordedChatsArrayPC ); |
|
388 |
|
389 iReactiveAuthPC = CCAReactiveAuthPC::NewL(); |
|
390 |
|
391 iGroupPropertiesPC = CCAGroupPropertiesPC::NewL( *iEngine->GetGroupInterface() ); |
|
392 |
|
393 |
|
394 iApplicationNGPC = CCAApplicationNGPC::NewL( *iEngine ); |
|
395 |
|
396 } |
|
397 |
|
398 // ----------------------------------------------------------------------------- |
|
399 // CCAProcessManager::HandleContactDelete |
|
400 // ----------------------------------------------------------------------------- |
|
401 // |
|
402 |
|
403 void CCAProcessManager::HandleContactDelete( const TDesC& /*aContactId*/ ) |
|
404 { |
|
405 //To be considered for CCAMainViewItemArray |
|
406 } |
|
407 |
|
408 // ----------------------------------------------------------------------------- |
|
409 // CCAProcessManager::HandleAddition |
|
410 // ----------------------------------------------------------------------------- |
|
411 // |
|
412 |
|
413 void CCAProcessManager::HandleAddition( MCAContactList& /*aList*/, MCAStoredContact& /*aContact*/ ) |
|
414 { |
|
415 //To be considered for CCAMainViewItemArray |
|
416 } |
|
417 |
|
418 // ----------------------------------------------------------------------------- |
|
419 // CCAProcessManager::HandleChange |
|
420 // ----------------------------------------------------------------------------- |
|
421 // |
|
422 |
|
423 void CCAProcessManager::HandleChange( MCAContactList* /*aList*/, MCAStoredContact* /*aContact*/, |
|
424 TStorageManagerGlobals::TCAObserverEventType aEventType, |
|
425 TBool /*aUserIdChanged*/ ) |
|
426 { |
|
427 if ( aEventType == TStorageManagerGlobals::EStorageEventOwnStatusChange || |
|
428 aEventType == TStorageManagerGlobals::EStorageEventMultipleChanges ) |
|
429 { |
|
430 //To be considered for CCAMainViewItemArray |
|
431 } |
|
432 } |
|
433 |
|
434 // ----------------------------------------------------------------------------- |
|
435 // CCAProcessManager::HandleMessageError |
|
436 // ----------------------------------------------------------------------------- |
|
437 // |
|
438 |
|
439 void CCAProcessManager::HandleMessageError( TInt aError, MCAMessage* /*aMessage*/ ) |
|
440 { |
|
441 if ( aError == KErrNoMemory ) |
|
442 { |
|
443 //To be considered later |
|
444 } |
|
445 } |
|
446 |
|
447 // ----------------------------------------------------------------------------- |
|
448 // CCAProcessManager::InitializeEngineObserversL |
|
449 // ----------------------------------------------------------------------------- |
|
450 // |
|
451 void CCAProcessManager::InitializeEngineObserversL() |
|
452 { |
|
453 |
|
454 // engine is valid before this is called |
|
455 iEngine->ChatInterface().RegisterChatObserver( this ); |
|
456 CCAStorageManagerFactory::ContactListInterfaceL()->AddObserverL( this ); |
|
457 iEngine->MessageUtils().MessageErrorInformer().RegisterObserver( this ); |
|
458 |
|
459 } |
|
460 |
|
461 // ----------------------------------------------------------------------------- |
|
462 // CCAProcessManager::HandleInvitationEventL |
|
463 // ----------------------------------------------------------------------------- |
|
464 // |
|
465 |
|
466 void CCAProcessManager::HandleInvitationEventL( TInviteEventType /*aEvent*/, |
|
467 const MCAInvitation* /*aInvitation*/ ) |
|
468 { |
|
469 //To be considered later |
|
470 } |
|
471 |
|
472 // --------------------------------------------------------- |
|
473 // CCAProcessManager::HandleInvitationResponse |
|
474 // (other items were commented in a header). |
|
475 // --------------------------------------------------------- |
|
476 // |
|
477 |
|
478 void CCAProcessManager::HandleInvitationResponse( TBool /*aAcceptance*/, |
|
479 const TDesC& /*aUserId*/, |
|
480 const TDesC& /*aGroupName*/, |
|
481 const TDesC& /*aResponse*/ ) |
|
482 { |
|
483 //To be considered later |
|
484 } |
|
485 |
|
486 |
|
487 // --------------------------------------------------------- |
|
488 // CCAProcessManager::HandleChatEvent |
|
489 // (other items were commented in a header). |
|
490 // --------------------------------------------------------- |
|
491 |
|
492 void CCAProcessManager::HandleChatEvent( TChatEventType /*aEvent*/, MCAMessage* /*aMessage*/ ) |
|
493 { |
|
494 //To be considered later |
|
495 } |
|
496 |
|
497 |
|
498 |
|
499 |
|
500 // End of file |