|
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: Implementation of details view plugin |
|
15 * Version : %version: he1s60#23.1.1.2.16 % |
|
16 * |
|
17 */ |
|
18 |
|
19 |
|
20 #include <bautils.h> |
|
21 #include <AknIconUtils.h> |
|
22 #include <AiwServiceHandler.h> |
|
23 #include <AknsUtils.h> |
|
24 #include <aknViewAppUi.h> |
|
25 |
|
26 #include <mccapppluginparameter.h> |
|
27 #include "ccaparameter.h" |
|
28 #include "mccaparameter.h" |
|
29 |
|
30 #include <CVPbkContactManager.h> |
|
31 #include <CPbk2StoreConfiguration.h> |
|
32 #include <CVPbkContactStoreUriArray.h> |
|
33 #include <CVPbkContactLinkArray.h> |
|
34 #include <CPbk2ApplicationServices.h> |
|
35 #include <CPbk2StoreManager.h> |
|
36 #include <TVPbkContactStoreUriPtr.h> |
|
37 #include <VPbkContactStoreUris.h> |
|
38 #include <mccappengine.h> |
|
39 #include <ccacontactorservice.h> |
|
40 |
|
41 #include <Pbk2DataCaging.hrh> |
|
42 |
|
43 #include "ccappdetailsviewplugin.h" |
|
44 #include "ccappdetailsviewlistboxmodel.h" |
|
45 #include "ccappdetailsviewcontainer.h" |
|
46 #include "ccappdetailsviewmenuhandler.h" |
|
47 #include "ccappdetailsviewdefs.h" |
|
48 #include "ccappdetailsviewpluginuids.hrh" |
|
49 #include "ccappdetailsview.hrh" |
|
50 |
|
51 #include <ccappdetailsviewpluginrsc.rsg> |
|
52 #include <ccappdetailsviewplugin.mbg> |
|
53 |
|
54 #include <CVPbkContactManager.h> |
|
55 |
|
56 // cms engine |
|
57 #include "cmscontactfield.h" |
|
58 #include "cmscontactfieldinfo.h" |
|
59 #include "cmscontactfielditem.h" |
|
60 #include "cmssession.h" |
|
61 #include "cmscontact.h" |
|
62 #include "ccacontactorservice.h" |
|
63 #include <VPbkFieldTypeSelectorFactory.h> |
|
64 #include "cmspresencedata.h" |
|
65 |
|
66 #include "ccacmscontactfetcherwrapper.h" |
|
67 |
|
68 // Consts |
|
69 _LIT(KCCAppDetailsViewResourceFileName, "\\resource\\ccappdetailsviewpluginrsc.rsc"); |
|
70 _LIT(KCCAppDetailsViewIconFileName, "\\resource\\apps\\ccappdetailsviewplugin.mif"); |
|
71 |
|
72 _LIT(KPbk2CommandsDllResFileName, "Pbk2Commands.rsc"); |
|
73 _LIT(KPbk2UiControlsDllResFileName, "Pbk2UiControls.rsc"); |
|
74 _LIT(KPbk2CommonUiDllResFileName, "Pbk2CommonUi.rsc" ); |
|
75 |
|
76 // ======== MEMBER FUNCTIONS ======== |
|
77 |
|
78 // --------------------------------------------------------------------------- |
|
79 // CCCAppDetailsViewPlugin::NewL |
|
80 // --------------------------------------------------------------------------- |
|
81 // |
|
82 CCCAppDetailsViewPlugin* CCCAppDetailsViewPlugin::NewL() |
|
83 { |
|
84 CCCAppDetailsViewPlugin* self = new(ELeave) CCCAppDetailsViewPlugin(); |
|
85 CleanupStack::PushL(self); |
|
86 self->ConstructL(); |
|
87 CleanupStack::Pop(self); |
|
88 |
|
89 return self; |
|
90 } |
|
91 |
|
92 // --------------------------------------------------------------------------- |
|
93 // CCCAppDetailsViewPlugin::~CCCAppDetailsViewPlugin |
|
94 // --------------------------------------------------------------------------- |
|
95 // |
|
96 CCCAppDetailsViewPlugin::~CCCAppDetailsViewPlugin() |
|
97 { |
|
98 //CCA_DP(KDetailsViewLogFile, CCA_L(">>> CCCAppDetailsViewPlugin::~CCCAppDetailsViewPlugin()")); |
|
99 |
|
100 //BG task for checking the visibility of this plugin |
|
101 if (iBgTaskForCheckingVisibility) |
|
102 { |
|
103 iBgTaskForCheckingVisibility->Cancel(); |
|
104 delete iBgTaskForCheckingVisibility; |
|
105 } |
|
106 |
|
107 if (AppEngine()) |
|
108 { |
|
109 AppEngine()->RemoveObserver(*this); |
|
110 } |
|
111 |
|
112 if (iAppServices) |
|
113 { |
|
114 iAppServices->StoreManager().DeregisterStoreEvents(*this); |
|
115 } |
|
116 |
|
117 delete iMenuHandler; |
|
118 delete iContactorService; |
|
119 |
|
120 Release(iAppServices); |
|
121 |
|
122 iCommandsResourceFile.Close(); |
|
123 iUiControlsResourceFile.Close(); |
|
124 iCommonUiResourceFile.Close(); |
|
125 |
|
126 if(iCmsWrapper) |
|
127 { |
|
128 iCmsWrapper->Release(); |
|
129 } |
|
130 |
|
131 //CCA_DP(KDetailsViewLogFile, CCA_L("<<< CCCAppDetailsViewPlugin::~CCCAppDetailsViewPlugin()")); |
|
132 } |
|
133 |
|
134 // --------------------------------------------------------------------------- |
|
135 // CCCAppDetailsViewPlugin::CCCAppDetailsViewPlugin() |
|
136 // --------------------------------------------------------------------------- |
|
137 // |
|
138 CCCAppDetailsViewPlugin::CCCAppDetailsViewPlugin() : |
|
139 iFocusedListIndex(0), |
|
140 iCommandsResourceFile(*iCoeEnv), |
|
141 iUiControlsResourceFile(*iCoeEnv), |
|
142 iCommonUiResourceFile(*iCoeEnv), |
|
143 iVisible(EFalse) // By default this plugin is not visible |
|
144 { |
|
145 } |
|
146 |
|
147 // --------------------------------------------------------------------------- |
|
148 // CCCAppDetailsViewPlugin::ConstructL |
|
149 // --------------------------------------------------------------------------- |
|
150 // |
|
151 void CCCAppDetailsViewPlugin::ConstructL() |
|
152 { |
|
153 CCA_DP(KDetailsViewLogFile, CCA_L(">>> CCCAppDetailsViewPlugin::ConstructL()")); |
|
154 |
|
155 // ConstructL should be as light as possible. |
|
156 |
|
157 /* |
|
158 CPbk2ApplicationServices& pbk2AppServices = GetPbk2AppServicesL(); |
|
159 // Add phone memory to cnt manager loaded stores even if current configuration |
|
160 // contains only SIM memory so that top contacts can be opened |
|
161 // from e.g. home screen widget. |
|
162 pbk2AppServices.ContactManager().LoadContactStoreL( |
|
163 VPbkContactStoreUris::DefaultCntDbUri() ); |
|
164 */ |
|
165 |
|
166 iCmsWrapper = CCCAppCmsContactFetcherWrapper::InstanceL(); |
|
167 // Create the BG Task which will help us in checking the visibility of this plugin |
|
168 iBgTaskForCheckingVisibility = CIdle::NewL(CActive::EPriorityStandard); |
|
169 |
|
170 CCA_DP(KDetailsViewLogFile, CCA_L("iFocusedListIndex = %d"), iFocusedListIndex); |
|
171 |
|
172 CCA_DP(KDetailsViewLogFile, CCA_L("<<< CCCAppDetailsViewPlugin::ConstructL()")); |
|
173 } |
|
174 |
|
175 // --------------------------------------------------------------------------- |
|
176 // CCCAppDetailsViewPlugin::PreparePluginViewL |
|
177 // --------------------------------------------------------------------------- |
|
178 // |
|
179 void CCCAppDetailsViewPlugin::PreparePluginViewL( |
|
180 MCCAppPluginParameter& /*aPluginParameter*/) |
|
181 { |
|
182 |
|
183 PrepareViewResourcesL(); |
|
184 |
|
185 // Get the PBK2AppServices |
|
186 CPbk2ApplicationServices& pbk2AppServices = GetPbk2AppServicesL(); |
|
187 |
|
188 if (AppEngine()) |
|
189 { |
|
190 AppEngine()->AddObserverL(*this); |
|
191 } |
|
192 CPbk2StoreManager& storeManager = pbk2AppServices.StoreManager(); |
|
193 storeManager.RegisterStoreEventsL(*this); |
|
194 storeManager.OpenStoresL(); |
|
195 |
|
196 iSchedulerWait.Start(); |
|
197 |
|
198 BaseConstructL(R_CCAPPDETAILSVIEW_MAINVIEW); |
|
199 } |
|
200 |
|
201 // --------------------------------------------------------------------------- |
|
202 // CCCAppDetailsViewPlugin::ProvideBitmapL |
|
203 // --------------------------------------------------------------------------- |
|
204 // |
|
205 void CCCAppDetailsViewPlugin::ProvideBitmapL( |
|
206 TCCAppIconType aIconType, CAknIcon& aIcon) |
|
207 { |
|
208 if (ECCAppTabIcon == aIconType) |
|
209 { |
|
210 CFbsBitmap* bmp = NULL; |
|
211 CFbsBitmap* bmpMask = NULL; |
|
212 |
|
213 AknsUtils::CreateIconL( |
|
214 AknsUtils::SkinInstance(), |
|
215 KAknsIIDDefault,//todo; get a proper skin |
|
216 bmp, |
|
217 bmpMask, |
|
218 KCCAppDetailsViewIconFileName, |
|
219 EMbmCcappdetailsviewpluginQgn_prop_contact_detail_tab2, |
|
220 EMbmCcappdetailsviewpluginQgn_prop_contact_detail_tab2_mask); |
|
221 |
|
222 aIcon.SetBitmap(bmp); |
|
223 aIcon.SetMask(bmpMask); |
|
224 } |
|
225 } |
|
226 |
|
227 // --------------------------------------------------------------------------- |
|
228 // CCCAppDetailsViewPlugin::NewContainerL |
|
229 // --------------------------------------------------------------------------- |
|
230 // |
|
231 void CCCAppDetailsViewPlugin::NewContainerL() |
|
232 { |
|
233 iContainer = new(ELeave) CCCAppDetailsViewContainer(Id(), *this); |
|
234 |
|
235 // Get the PBK2AppServices |
|
236 CPbk2ApplicationServices& pbk2AppServices = GetPbk2AppServicesL(); |
|
237 |
|
238 static_cast<CCCAppDetailsViewContainer*> |
|
239 (iContainer)->SetApplicationServices(&pbk2AppServices); |
|
240 } |
|
241 |
|
242 // -------------------------------------------------------------------------- |
|
243 // CCCAppDetailsViewPlugin::HandleStatusPaneSizeChange |
|
244 // -------------------------------------------------------------------------- |
|
245 // |
|
246 void CCCAppDetailsViewPlugin::HandleStatusPaneSizeChange() |
|
247 { |
|
248 // Resize the container to fill the client rectangle |
|
249 if (iContainer) |
|
250 { |
|
251 iContainer->SetRect(ClientRect()); |
|
252 } |
|
253 } |
|
254 |
|
255 // --------------------------------------------------------------------------- |
|
256 // CCCAppDetailsViewPlugin::DynInitMenuPaneL |
|
257 // --------------------------------------------------------------------------- |
|
258 // |
|
259 void CCCAppDetailsViewPlugin::DynInitMenuPaneL(TInt aResourceId, |
|
260 CEikMenuPane* aMenuPane) |
|
261 { |
|
262 EnsureMenuHandlerCreatedL(); |
|
263 iMenuHandler->DynInitMenuPaneL(aResourceId, aMenuPane); |
|
264 } |
|
265 |
|
266 // --------------------------------------------------------------------------- |
|
267 // CCCAppDetailsViewPlugin::EnsureMenuHandlerCreatedL |
|
268 // --------------------------------------------------------------------------- |
|
269 // |
|
270 void CCCAppDetailsViewPlugin::EnsureMenuHandlerCreatedL() |
|
271 { |
|
272 if (!iMenuHandler) |
|
273 { |
|
274 iMenuHandler = CCCAppDetailsViewMenuHandler::NewL(*this); |
|
275 iMenuHandler->SetAppEngine(AppEngine()); |
|
276 } |
|
277 } |
|
278 |
|
279 // --------------------------------------------------------------------------- |
|
280 // CCCAppDetailsViewPlugin::HandleEditRequestL |
|
281 // --------------------------------------------------------------------------- |
|
282 // |
|
283 void CCCAppDetailsViewPlugin::HandleEditRequestL() |
|
284 { |
|
285 /* Note: We do not need to check if contact is editable, as this is called |
|
286 * from CCCAppDetailsViewListBoxModel::HandleEditRequestL(), which checks |
|
287 * if the contact is editable or not. |
|
288 */ |
|
289 EnsureMenuHandlerCreatedL(); |
|
290 iMenuHandler->HandleCommandL(ECCAppDetailsViewEditItemCmd); |
|
291 } |
|
292 |
|
293 // --------------------------------------------------------------------------- |
|
294 // CCCAppDetailsViewPlugin::HandleDeleteRequestL |
|
295 // --------------------------------------------------------------------------- |
|
296 // |
|
297 void CCCAppDetailsViewPlugin::HandleDeleteRequestL() |
|
298 { |
|
299 /* Note: We do not need to check if contact is editable, as this is called |
|
300 * from CCCAppDetailsViewListBoxModel::HandleDeleteRequestL(), which checks |
|
301 * if the contact is editable or not. |
|
302 */ |
|
303 EnsureMenuHandlerCreatedL(); |
|
304 iMenuHandler->HandleCommandL(ECCAppDetailsViewDeleteCmd); |
|
305 } |
|
306 |
|
307 // --------------------------------------------------------------------------- |
|
308 // CCCAppDetailsViewPlugin::HandleCommandL |
|
309 // --------------------------------------------------------------------------- |
|
310 // |
|
311 void CCCAppDetailsViewPlugin::HandleCommandL(TInt aCommand) |
|
312 { |
|
313 // CCApp handles the "Exit"- and "Back"-commands, |
|
314 // rest to menuhandler |
|
315 CCCAppViewPluginAknView::HandleCommandL(aCommand); |
|
316 |
|
317 if (iContainer) |
|
318 { |
|
319 iFocusedListIndex = static_cast<CCCAppDetailsViewContainer*> |
|
320 (iContainer)->ListBoxModel().FocusedListIndex(); |
|
321 } |
|
322 |
|
323 // Rest to menuhandler |
|
324 EnsureMenuHandlerCreatedL(); |
|
325 iMenuHandler->HandleCommandL(aCommand); |
|
326 } |
|
327 |
|
328 // --------------------------------------------------------------------------- |
|
329 // CCCAppDetailsViewPlugin::Id |
|
330 // --------------------------------------------------------------------------- |
|
331 // |
|
332 TUid CCCAppDetailsViewPlugin::Id() const |
|
333 { |
|
334 return TUid::Uid(KCCADetailsViewPluginImplmentationUid); |
|
335 } |
|
336 |
|
337 // --------------------------------------------------------------------------- |
|
338 // CCCAppDetailsViewPlugin::PrepareViewResourcesL |
|
339 // --------------------------------------------------------------------------- |
|
340 // |
|
341 void CCCAppDetailsViewPlugin::PrepareViewResourcesL() |
|
342 { |
|
343 // preparing resources for use |
|
344 TFileName fileName(KCCAppDetailsViewResourceFileName); |
|
345 BaflUtils::NearestLanguageFile(iCoeEnv->FsSession(), fileName); |
|
346 iResourceLoader.OpenL(fileName); |
|
347 } |
|
348 |
|
349 // --------------------------------------------------------------------------- |
|
350 // CCCAppDetailsViewPlugin::DoActivateL |
|
351 // --------------------------------------------------------------------------- |
|
352 // |
|
353 void CCCAppDetailsViewPlugin::DoActivateL( |
|
354 const TVwsViewId& aPrevViewId, |
|
355 TUid aCustomMessageId, |
|
356 const TDesC8& aCustomMessage) |
|
357 { |
|
358 CCCAppViewPluginAknView::DoActivateL(aPrevViewId, aCustomMessageId, |
|
359 aCustomMessage); |
|
360 |
|
361 GetContactDataL(); |
|
362 |
|
363 static_cast<CCCAppDetailsViewContainer*> |
|
364 (iContainer)->SetAppEngine(AppEngine()); |
|
365 |
|
366 if ( iMenuHandler != NULL ) |
|
367 { |
|
368 iMenuHandler->Activate(); |
|
369 } |
|
370 |
|
371 if ( iContactorService == NULL ) |
|
372 { |
|
373 iContactorService = CCAContactorService::NewL(); |
|
374 } |
|
375 } |
|
376 |
|
377 // --------------------------------------------------------------------------- |
|
378 // CCCAppDetailsViewPlugin::DoDeactivate |
|
379 // --------------------------------------------------------------------------- |
|
380 // |
|
381 void CCCAppDetailsViewPlugin::DoDeactivate() |
|
382 { |
|
383 if (iContainer) |
|
384 { |
|
385 iFocusedListIndex = static_cast<CCCAppDetailsViewContainer*> |
|
386 (iContainer)->ListBoxModel().FocusedListIndex(); |
|
387 } |
|
388 |
|
389 if ( iMenuHandler != NULL ) |
|
390 { |
|
391 iMenuHandler->Reset(); |
|
392 } |
|
393 |
|
394 CCCAppViewPluginAknView::DoDeactivate(); |
|
395 } |
|
396 |
|
397 // -------------------------------------------------------------------------- |
|
398 // CCCAppDetailsViewPlugin::GetContactDataL |
|
399 // -------------------------------------------------------------------------- |
|
400 // |
|
401 void CCCAppDetailsViewPlugin::GetContactDataL() |
|
402 { |
|
403 CCA_DP(KDetailsViewLogFile, CCA_L(">>> CCCAppDetailsViewPlugin::GetContactDataL()")); |
|
404 |
|
405 if (iContainer) |
|
406 { |
|
407 // Get the PBK2AppServices |
|
408 CPbk2ApplicationServices& pbk2AppServices = GetPbk2AppServicesL(); |
|
409 |
|
410 HBufC8* contactLinkArrayDes = iCmsWrapper->ContactIdentifierLC(); |
|
411 CVPbkContactLinkArray* links = CVPbkContactLinkArray::NewLC(*contactLinkArrayDes, |
|
412 pbk2AppServices.ContactManager().ContactStoresL()); |
|
413 |
|
414 CCA_DP(KDetailsViewLogFile, CCA_L("iFocusedListIndex = %d"), iFocusedListIndex); |
|
415 |
|
416 |
|
417 static_cast<CCCAppDetailsViewContainer*> |
|
418 (iContainer)->ListBoxModel().SetLinks(links); // takes ownership of links. |
|
419 CleanupStack::Pop(links); |
|
420 CleanupStack::PopAndDestroy(contactLinkArrayDes); |
|
421 |
|
422 static_cast<CCCAppDetailsViewContainer*> |
|
423 (iContainer)->ListBoxModel().SetInitialFocusIndex(iFocusedListIndex); |
|
424 iContainer->DrawDeferred(); |
|
425 } |
|
426 |
|
427 CCA_DP(KDetailsViewLogFile, CCA_L("<<< CCCAppDetailsViewPlugin::GetContactDataL()")); |
|
428 } |
|
429 |
|
430 // -------------------------------------------------------------------------- |
|
431 // CCCAppDetailsViewPlugin::OpenComplete |
|
432 // -------------------------------------------------------------------------- |
|
433 // |
|
434 void CCCAppDetailsViewPlugin::OpenComplete() |
|
435 { |
|
436 if (iSchedulerWait.IsStarted()) |
|
437 { |
|
438 iSchedulerWait.AsyncStop(); |
|
439 } |
|
440 } |
|
441 |
|
442 // -------------------------------------------------------------------------- |
|
443 // CCCAppDetailsViewPlugin::StoreReady |
|
444 // -------------------------------------------------------------------------- |
|
445 // |
|
446 void CCCAppDetailsViewPlugin::StoreReady(MVPbkContactStore& /*aContactStore*/) |
|
447 { |
|
448 if (iSchedulerWait.IsStarted()) |
|
449 { |
|
450 iSchedulerWait.AsyncStop(); |
|
451 } |
|
452 } |
|
453 |
|
454 // -------------------------------------------------------------------------- |
|
455 // CCCAppDetailsViewPlugin::StoreUnavailable |
|
456 // -------------------------------------------------------------------------- |
|
457 // |
|
458 void CCCAppDetailsViewPlugin::StoreUnavailable( |
|
459 MVPbkContactStore& /*aContactStore*/, |
|
460 TInt /*aReason*/) |
|
461 { |
|
462 if (iSchedulerWait.IsStarted()) |
|
463 { |
|
464 iSchedulerWait.AsyncStop(); |
|
465 } |
|
466 } |
|
467 |
|
468 // -------------------------------------------------------------------------- |
|
469 // CCCAppDetailsViewPlugin::HandleStoreEventL |
|
470 // -------------------------------------------------------------------------- |
|
471 // |
|
472 void CCCAppDetailsViewPlugin::HandleStoreEventL( |
|
473 MVPbkContactStore& /*aContactStore*/, |
|
474 TVPbkContactStoreEvent aStoreEvent) |
|
475 { |
|
476 if (iSchedulerWait.IsStarted()) |
|
477 { |
|
478 iSchedulerWait.AsyncStop(); |
|
479 } |
|
480 |
|
481 switch (aStoreEvent.iEventType) |
|
482 { |
|
483 case TVPbkContactStoreEvent::EContactChanged: |
|
484 GetContactDataL(); |
|
485 break; |
|
486 |
|
487 case TVPbkContactStoreEvent::EContactDeleted: |
|
488 break; |
|
489 |
|
490 default: |
|
491 break; |
|
492 } |
|
493 } |
|
494 |
|
495 // --------------------------------------------------------------------------- |
|
496 // CCCAppDetailsViewPlugin::SetTitleL |
|
497 // --------------------------------------------------------------------------- |
|
498 // |
|
499 void CCCAppDetailsViewPlugin::SetTitleL(const TDesC& aTitle) |
|
500 { |
|
501 // Forward the SetTitleL-call to base-class |
|
502 CCCAppViewPluginAknView::SetTitleL(aTitle); |
|
503 } |
|
504 |
|
505 // --------------------------------------------------------------------------- |
|
506 // CCCAppDetailsViewPlugin::CheckVisibilityL |
|
507 // --------------------------------------------------------------------------- |
|
508 // |
|
509 TBool CCCAppDetailsViewPlugin::CheckVisibilityL(MCCAppPluginParameter& /*aPluginParameter*/) |
|
510 { |
|
511 // Start checking the visibility of this plugin in the background |
|
512 CheckVisibilityInBackgroundL(); |
|
513 return iVisible; |
|
514 } |
|
515 |
|
516 // --------------------------------------------------------------------------- |
|
517 // CCCAppDetailsViewPlugin::CCCAppViewPluginBaseExtension |
|
518 // --------------------------------------------------------------------------- |
|
519 // |
|
520 TAny* CCCAppDetailsViewPlugin::CCCAppViewPluginBaseExtension( TUid aExtensionUid ) |
|
521 { |
|
522 if ( aExtensionUid == KMCCAppViewPluginBaseExtension2Uid ) |
|
523 { |
|
524 return static_cast<MCCAppViewPluginBase2*>( this ); |
|
525 } |
|
526 return NULL; |
|
527 } |
|
528 |
|
529 // -------------------------------------------------------------------------- |
|
530 // CCCAppDetailsViewPlugin::UpdateMSKinCbaL |
|
531 // Sets CBA with empty MSK or MSK with text "Edit" when contact is editable. |
|
532 // -------------------------------------------------------------------------- |
|
533 // |
|
534 void CCCAppDetailsViewPlugin::UpdateMSKinCbaL(TBool aEditable) |
|
535 { |
|
536 CEikButtonGroupContainer* cba = Cba(); |
|
537 |
|
538 if (cba) |
|
539 { |
|
540 cba->SetCommandSetL(aEditable |
|
541 ? R_CCAPPDETAILSVIEW_SOFTKEYS_OPTIONS_BACK_EDIT |
|
542 : R_CCAPPDETAILSVIEW_SOFTKEYS_OPTIONS_BACK_EMPTY); |
|
543 |
|
544 cba->DrawDeferred(); |
|
545 } |
|
546 } |
|
547 |
|
548 // --------------------------------------------------------------------------- |
|
549 // CCCAppDetailsViewPlugin::CheckValidityOfContactInfoL |
|
550 // --------------------------------------------------------------------------- |
|
551 // |
|
552 void CCCAppDetailsViewPlugin::CheckValidityOfContactInfoL() |
|
553 { |
|
554 TBool validContact = EFalse; |
|
555 HBufC8* contactLinkArrayDes = iCmsWrapper->ContactIdentifierLC(); |
|
556 |
|
557 if (contactLinkArrayDes) |
|
558 { |
|
559 // Get the PBK2AppServices |
|
560 CPbk2ApplicationServices& pbk2AppServices = GetPbk2AppServicesL(); |
|
561 CVPbkContactLinkArray* contactLinkArray = CVPbkContactLinkArray::NewLC(*contactLinkArrayDes, |
|
562 pbk2AppServices.ContactManager().ContactStoresL()); |
|
563 if (contactLinkArray->Count()) |
|
564 { |
|
565 // Valid contact |
|
566 validContact = ETrue; |
|
567 } |
|
568 CleanupStack::PopAndDestroy(contactLinkArray); |
|
569 } |
|
570 CleanupStack::PopAndDestroy(contactLinkArrayDes); |
|
571 |
|
572 if (validContact) |
|
573 { |
|
574 MakeMeVisibleL(); |
|
575 } |
|
576 } |
|
577 |
|
578 // --------------------------------------------------------------------------- |
|
579 // CCCAppDetailsViewPlugin::CheckVisibilityInBackgroundL |
|
580 // --------------------------------------------------------------------------- |
|
581 // |
|
582 void CCCAppDetailsViewPlugin::CheckVisibilityInBackgroundL() |
|
583 { |
|
584 // Start checking the visibility of this plugin in the background |
|
585 if (!iBgTaskForCheckingVisibility->IsActive()) |
|
586 { |
|
587 iBgTaskForCheckingVisibility->Start(TCallBack(CheckVisibilityCallbackL , this)); |
|
588 } |
|
589 } |
|
590 |
|
591 // --------------------------------------------------------------------------- |
|
592 // CCCAppDetailsViewPlugin::CheckVisibilityCallbackL |
|
593 // --------------------------------------------------------------------------- |
|
594 // |
|
595 |
|
596 TInt CCCAppDetailsViewPlugin::CheckVisibilityCallbackL(TAny* aContainer) |
|
597 { |
|
598 CCCAppDetailsViewPlugin* container = static_cast<CCCAppDetailsViewPlugin*>(aContainer); |
|
599 container->CheckValidityOfContactInfoL(); |
|
600 return KErrNone; |
|
601 } |
|
602 |
|
603 |
|
604 // --------------------------------------------------------------------------- |
|
605 // CCCAppDetailsViewPlugin::MakeMeVisibleL |
|
606 // --------------------------------------------------------------------------- |
|
607 // |
|
608 void CCCAppDetailsViewPlugin::MakeMeVisibleL() |
|
609 { |
|
610 // Set this plugin as visible |
|
611 iVisible = ETrue; |
|
612 // Call the below API to make yourself visible in the CCA Tabs |
|
613 ShowPluginL(); |
|
614 } |
|
615 |
|
616 |
|
617 // --------------------------------------------------------------------------- |
|
618 // CCCAppDetailsViewPlugin::GetPbk2AppServicesL |
|
619 // --------------------------------------------------------------------------- |
|
620 // |
|
621 CPbk2ApplicationServices& CCCAppDetailsViewPlugin::GetPbk2AppServicesL() |
|
622 { |
|
623 // create only if iAppServices is NULL |
|
624 if (!iAppServices) |
|
625 { |
|
626 //Required for creating the instance of CPbk2ApplicationServices |
|
627 iCommandsResourceFile.OpenL( |
|
628 KPbk2RomFileDrive, KDC_RESOURCE_FILES_DIR, KPbk2CommandsDllResFileName); |
|
629 iUiControlsResourceFile.OpenL( |
|
630 KPbk2RomFileDrive, KDC_RESOURCE_FILES_DIR, KPbk2UiControlsDllResFileName); |
|
631 iCommonUiResourceFile.OpenL( |
|
632 KPbk2RomFileDrive, KDC_RESOURCE_FILES_DIR, KPbk2CommonUiDllResFileName); |
|
633 |
|
634 iAppServices = CPbk2ApplicationServices::InstanceL(); |
|
635 } |
|
636 |
|
637 return *iAppServices; |
|
638 } |
|
639 |
|
640 // --------------------------------------------------------------------------- |
|
641 // CCCAppDetailsViewPlugin::NotifyPluginOfContactEventL |
|
642 // --------------------------------------------------------------------------- |
|
643 // |
|
644 void CCCAppDetailsViewPlugin::NotifyPluginOfContactEventL() |
|
645 { |
|
646 //If a contact has e.g. relocated from sim to phone memory we need to |
|
647 //continue using relocated contact instead of old |
|
648 iCmsWrapper->RefetchContactL(); |
|
649 } |
|
650 |
|
651 // --------------------------------------------------------------------------- |
|
652 // CCCAppDetailsViewPlugin::ContactorService() |
|
653 // --------------------------------------------------------------------------- |
|
654 // |
|
655 CCAContactorService* CCCAppDetailsViewPlugin::ContactorService() |
|
656 { |
|
657 return iContactorService; |
|
658 } |
|
659 |
|
660 // --------------------------------------------------------------------------- |
|
661 // CCCAppDetailsViewPlugin::PluginBusy() |
|
662 // --------------------------------------------------------------------------- |
|
663 // |
|
664 TBool CCCAppDetailsViewPlugin::PluginBusy() |
|
665 { |
|
666 TBool ret = EFalse; |
|
667 |
|
668 if ( iContactorService != NULL ) |
|
669 { |
|
670 ret = iContactorService->IsBusy(); |
|
671 } |
|
672 return ret; |
|
673 } |
|
674 |
|
675 |
|
676 // End of File |