|
1 /* |
|
2 * Copyright (c) 2005-2007 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: Phonebook 2 contact info application view. |
|
15 * |
|
16 */ |
|
17 |
|
18 // INCLUDE FILES |
|
19 #include "cpbk2contactinfoappview.h" |
|
20 |
|
21 // Phonebook 2 |
|
22 #include "cpbk2appui.h" |
|
23 #include "cpbk2document.h" |
|
24 #include "cpbk2startupmonitor.h" |
|
25 #include "cpbk2viewexplorer.h" |
|
26 #include "cpbk2viewactivationtransaction.h" |
|
27 #include "pbk2internalcommands.hrh" |
|
28 #include "cpbk2viewloader.h" |
|
29 #include <phonebook2.rsg> |
|
30 #include <pbk2uicontrols.rsg> |
|
31 #include <pbk2commands.rsg> |
|
32 #include <cpbk2viewstate.h> |
|
33 #include <mpbk2contactnavigation.h> |
|
34 #include <cpbk2controlcontainer.h> |
|
35 #include <cpbk2contactinfocontrol.h> |
|
36 #include <mpbk2commandhandler.h> |
|
37 #include <mpbk2contactdetailscontrol.h> |
|
38 #include <cpbk2storeconfiguration.h> |
|
39 #include <cpbk2memoryentrycontactloader.h> |
|
40 #include <pbk2commands.hrh> |
|
41 #include <cpbk2viewstatetransformer.h> |
|
42 #include <tpbk2storecontactanalyzer.h> |
|
43 #include <cpbk2fieldpropertyarray.h> |
|
44 #include <cpbk2sortordermanager.h> |
|
45 #include <cpbk2viewgraph.h> |
|
46 #include <mpbk2pointereventinspector.h> |
|
47 #include <pbk2navigatorfactory.h> |
|
48 #include <mpbk2applicationservices.h> |
|
49 #include <mpbk2contactviewsupplier.h> |
|
50 #include <pbk2uid.h> |
|
51 #include <csxhelp/phob.hlp.hrh> |
|
52 |
|
53 // Virtual Phonebook |
|
54 #include <cvpbkcontactmanager.h> |
|
55 #include <mvpbkstorecontact.h> |
|
56 #include <mvpbkcontactlink.h> |
|
57 #include <mvpbkcontactviewbase.h> |
|
58 #include <mvpbkexpandable.h> |
|
59 #include <cvpbkcontactstoreuriarray.h> |
|
60 #include <mvpbkcontactstorelist.h> |
|
61 #include <tvpbkcontactstoreuriptr.h> |
|
62 |
|
63 // System includes |
|
64 #include <avkon.rsg> |
|
65 #include <aiwcommon.hrh> |
|
66 #include <eikmenub.h> |
|
67 #include <aknutils.h> |
|
68 #include <stringloader.h> |
|
69 |
|
70 // Debugging headers |
|
71 #include <pbk2debug.h> |
|
72 #include <pbk2profile.h> |
|
73 #include <pbk2config.hrh> |
|
74 |
|
75 /// Unnamed namespace for local definitions |
|
76 namespace { |
|
77 |
|
78 #ifdef _DEBUG |
|
79 enum TPanicCode |
|
80 { |
|
81 EPanicPostCond_DoActivateL = 1, |
|
82 EPanicPostCond_DoDeactivate, |
|
83 EPanicPreCond_HandleCommandL, |
|
84 EPanicPreCond_HandleCommandKeyL, |
|
85 EPanicPreCond_ConstructL, |
|
86 EPanicPostCond_ConstructL, |
|
87 EPanicPreCond_DynInitMenuPaneL, |
|
88 EPanicPreCond_ContactChangedL, |
|
89 EPanicPreCond_SetNavigatorViewL, |
|
90 EPanicPreCond_GetViewSpecificMenuFilteringFlagsL, |
|
91 EPanicPreCond_NULLPointer, |
|
92 EPanicPreCond_ViewLoaded, |
|
93 EPanicLogic_LoadContactL |
|
94 }; |
|
95 |
|
96 void Panic(TPanicCode aReason) |
|
97 { |
|
98 _LIT( KPanicText, "CPbk2ContactInfoAppView" ); |
|
99 User::Panic( KPanicText, aReason ); |
|
100 } |
|
101 #endif // _DEBUG |
|
102 |
|
103 } /// namespace |
|
104 |
|
105 |
|
106 // -------------------------------------------------------------------------- |
|
107 // CPbk2ContactInfoAppView::CPbk2ContactInfoAppView |
|
108 // -------------------------------------------------------------------------- |
|
109 // |
|
110 inline CPbk2ContactInfoAppView::CPbk2ContactInfoAppView |
|
111 ( CVPbkContactManager& aContactManager ) : |
|
112 iContactManager( aContactManager ) |
|
113 { |
|
114 } |
|
115 |
|
116 // -------------------------------------------------------------------------- |
|
117 // CPbk2ContactInfoAppView::~CPbk2ContactInfoAppView |
|
118 // -------------------------------------------------------------------------- |
|
119 // |
|
120 CPbk2ContactInfoAppView::~CPbk2ContactInfoAppView() |
|
121 { |
|
122 PBK2_DEBUG_PRINT(PBK2_DEBUG_STRING |
|
123 ("CPbk2ContactInfoAppView(%x)::~CPbk2ContactInfoAppView()"), this); |
|
124 |
|
125 delete iViewLoader; |
|
126 delete iControlState; |
|
127 delete iViewActivationTransaction; |
|
128 delete iNavigation; |
|
129 delete iContactLoader; |
|
130 iStoreList.Reset(); |
|
131 iStoreList.Close(); |
|
132 |
|
133 if (iContainer) |
|
134 { |
|
135 AppUi()->RemoveFromViewStack(*this, iContainer); |
|
136 delete iContainer; |
|
137 } |
|
138 } |
|
139 |
|
140 // -------------------------------------------------------------------------- |
|
141 // CPbk2ContactInfoAppView::NewL |
|
142 // -------------------------------------------------------------------------- |
|
143 // |
|
144 CPbk2ContactInfoAppView* CPbk2ContactInfoAppView::NewL |
|
145 ( CVPbkContactManager& aContactManager ) |
|
146 { |
|
147 CPbk2ContactInfoAppView* self = |
|
148 new ( ELeave ) CPbk2ContactInfoAppView( aContactManager ); |
|
149 CleanupStack::PushL(self); |
|
150 self->ConstructL(); |
|
151 CleanupStack::Pop(); // self |
|
152 return self; |
|
153 } |
|
154 |
|
155 // -------------------------------------------------------------------------- |
|
156 // CPbk2ContactInfoAppView::ConstructL |
|
157 // -------------------------------------------------------------------------- |
|
158 // |
|
159 inline void CPbk2ContactInfoAppView::ConstructL() |
|
160 { |
|
161 PBK2_PROFILE_START(Pbk2Profile::EContactInfoConstructL); |
|
162 |
|
163 // Init base class |
|
164 PBK2_PROFILE_START(Pbk2Profile::EContactInfoViewBaseConstruct); |
|
165 CAknView::BaseConstructL(R_PHONEBOOK2_CONTACTINFO_APPVIEW); |
|
166 PBK2_PROFILE_END(Pbk2Profile::EContactInfoViewBaseConstruct); |
|
167 |
|
168 iCommandHandler = Pbk2AppUi()->ApplicationServices().CommandHandlerL(); |
|
169 iStoreConfiguration = &Pbk2AppUi()->ApplicationServices(). |
|
170 StoreConfiguration(); |
|
171 |
|
172 PBK2_PROFILE_END(Pbk2Profile::EContactInfoConstructL); |
|
173 |
|
174 __ASSERT_DEBUG(iCommandHandler, |
|
175 Panic(EPanicPostCond_ConstructL)); |
|
176 } |
|
177 |
|
178 // -------------------------------------------------------------------------- |
|
179 // CPbk2ContactInfoAppView::HandleCommandL |
|
180 // -------------------------------------------------------------------------- |
|
181 // |
|
182 void CPbk2ContactInfoAppView::HandleCommandL |
|
183 (TInt aCommandId) |
|
184 { |
|
185 __ASSERT_DEBUG(iControl, |
|
186 Panic(EPanicPreCond_HandleCommandL)); |
|
187 |
|
188 switch (aCommandId) |
|
189 { |
|
190 case EAknSoftkeyBack: // FALLTHROUGH |
|
191 case EPbk2CmdOpenPreviousView: |
|
192 { |
|
193 // Set the focused contact according to control state -> NULL |
|
194 ReturnToPreviousViewL( NULL ); |
|
195 break; |
|
196 } |
|
197 default: |
|
198 { |
|
199 // No command handling in this class, forward to Commands |
|
200 if ( !iCommandHandler->HandleCommandL |
|
201 ( aCommandId, *iControl, this ) ) |
|
202 { |
|
203 iControl->ProcessCommandL(aCommandId); |
|
204 // Command was not handled in Pbk2Commands, |
|
205 // forward it to AppUi |
|
206 AppUi()->HandleCommandL(aCommandId); |
|
207 } |
|
208 break; |
|
209 } |
|
210 } |
|
211 } |
|
212 |
|
213 // -------------------------------------------------------------------------- |
|
214 // CPbk2ContactInfoAppView::DynInitMenuPaneL |
|
215 // -------------------------------------------------------------------------- |
|
216 // |
|
217 void CPbk2ContactInfoAppView::DynInitMenuPaneL |
|
218 (TInt aResourceId, CEikMenuPane* aMenuPane) |
|
219 { |
|
220 __ASSERT_DEBUG(iControl, |
|
221 Panic(EPanicPreCond_DynInitMenuPaneL)); |
|
222 |
|
223 if( aResourceId != R_PHONEBOOK2_SIND_INFOVIEW_MENU ) |
|
224 { |
|
225 // Ask the control to do control specific filtering |
|
226 iControl->DynInitMenuPaneL(aResourceId, aMenuPane); |
|
227 |
|
228 // Phonebook 2 menu filtering happens in Commands |
|
229 iCommandHandler->DynInitMenuPaneL( |
|
230 aResourceId, aMenuPane, *this, *iControl); |
|
231 } |
|
232 else |
|
233 { |
|
234 // SIND InfoView menu option should not be available |
|
235 aMenuPane->SetItemDimmed( KAiwCmdInfoView, ETrue ); |
|
236 } |
|
237 } |
|
238 |
|
239 // -------------------------------------------------------------------------- |
|
240 // CPbk2ContactInfoAppView::Id |
|
241 // -------------------------------------------------------------------------- |
|
242 // |
|
243 TUid CPbk2ContactInfoAppView::Id() const |
|
244 { |
|
245 return Phonebook2::KPbk2ContactInfoViewUid; |
|
246 } |
|
247 |
|
248 // -------------------------------------------------------------------------- |
|
249 // CPbk2ContactInfoAppView::HandleStatusPaneSizeChange |
|
250 // -------------------------------------------------------------------------- |
|
251 // |
|
252 void CPbk2ContactInfoAppView::HandleStatusPaneSizeChange() |
|
253 { |
|
254 // Resize the container to fill the client rectangle |
|
255 if (iContainer) |
|
256 { |
|
257 iContainer->SetRect(ClientRect()); |
|
258 } |
|
259 } |
|
260 |
|
261 // -------------------------------------------------------------------------- |
|
262 // CPbk2ContactInfoAppView::DoActivateL |
|
263 // -------------------------------------------------------------------------- |
|
264 // |
|
265 void CPbk2ContactInfoAppView::DoActivateL |
|
266 ( const TVwsViewId& aPrevViewId, |
|
267 TUid aCustomMessageId, const TDesC8& aCustomMessage ) |
|
268 { |
|
269 PBK2_DEBUG_PRINT(PBK2_DEBUG_STRING |
|
270 ("CPbk2ContactInfoAppView(%x)::DoActivateL()"), this); |
|
271 |
|
272 PBK2_PROFILE_START(Pbk2Profile::EContactInfoStartTime); |
|
273 PBK2_PROFILE_START(Pbk2Profile::EContactInfoDoActivateContactChanged); |
|
274 PBK2_PROFILE_START(Pbk2Profile::EContactInfoDoActivateL); |
|
275 |
|
276 UpdateViewGraphL( aPrevViewId ); |
|
277 |
|
278 iCommandHandler->AddMenuCommandObserver( *this ); |
|
279 iStoreConfiguration->AddObserverL( *this ); |
|
280 |
|
281 // Update application-wide state. UI control updates the title pane. |
|
282 delete iViewActivationTransaction; |
|
283 iViewActivationTransaction = NULL; |
|
284 iViewActivationTransaction = |
|
285 Pbk2AppUi()->Pbk2ViewExplorer()->HandleViewActivationLC |
|
286 ( Id(), aPrevViewId, NULL, NULL, |
|
287 Phonebook2::EUpdateNaviPane | Phonebook2::EUpdateContextPane ); |
|
288 CleanupStack::Pop(); // iViewActivationTransaction |
|
289 |
|
290 if (aCustomMessageId == CPbk2ViewState::Uid() || |
|
291 aCustomMessageId == TUid::Uid(KPbkViewStateUid)) |
|
292 { |
|
293 // Handles both new and legacy view state parameters |
|
294 UpdateViewStateL(aCustomMessageId, aCustomMessage); |
|
295 } |
|
296 else |
|
297 { |
|
298 // No UI state specified, restore in previous state |
|
299 if (!iControlState) |
|
300 { |
|
301 // No previous state |
|
302 User::Leave(KErrArgument); |
|
303 } |
|
304 } |
|
305 |
|
306 if ( !iControlState->FocusedContact() ) |
|
307 { |
|
308 User::Leave( KErrArgument ); |
|
309 } |
|
310 |
|
311 ConstructNavigatorL(); |
|
312 CreateControlsL(); |
|
313 AttachAIWProvidersL(); |
|
314 |
|
315 LoadContactViewL(aPrevViewId); |
|
316 iPreviousViewId = aPrevViewId; |
|
317 |
|
318 PBK2_PROFILE_END(Pbk2Profile::EContactInfoDoActivateL); |
|
319 } |
|
320 |
|
321 // -------------------------------------------------------------------------- |
|
322 // CPbk2ContactInfoAppView::DoDeactivate |
|
323 // -------------------------------------------------------------------------- |
|
324 // |
|
325 void CPbk2ContactInfoAppView::DoDeactivate() |
|
326 { |
|
327 PBK2_DEBUG_PRINT(PBK2_DEBUG_STRING |
|
328 ("CPbk2ContactInfoAppView(%x)::DoDeactivate()"), this); |
|
329 |
|
330 delete iViewLoader; |
|
331 iViewLoader = NULL; |
|
332 |
|
333 iCommandHandler->RemoveMenuCommandObserver( *this ); |
|
334 |
|
335 iStoreConfiguration->RemoveObserver( *this ); |
|
336 |
|
337 delete iViewActivationTransaction; |
|
338 iViewActivationTransaction = NULL; |
|
339 delete iNavigation; |
|
340 iNavigation = NULL; |
|
341 |
|
342 // Trash the old states |
|
343 delete iControlState; |
|
344 iControlState = NULL; |
|
345 |
|
346 // Reset store list |
|
347 iStoreList.Reset(); |
|
348 |
|
349 if (iContainer) |
|
350 { |
|
351 iContainer->Control()->HideThumbnail(); |
|
352 |
|
353 // Remove view and its control from the view stack |
|
354 AppUi()->RemoveFromViewStack(*this, iContainer); |
|
355 |
|
356 // Store current state, safe to ignore. There's no real harm, |
|
357 // if theres no stored state when activating this view again |
|
358 TRAP_IGNORE(StoreStateL()); |
|
359 |
|
360 // Destroy the container control |
|
361 delete iContainer; |
|
362 iContainer = NULL; |
|
363 iControl = NULL; |
|
364 } |
|
365 |
|
366 delete iContactLoader; |
|
367 iContactLoader = NULL; |
|
368 } |
|
369 |
|
370 // -------------------------------------------------------------------------- |
|
371 // CPbk2ContactInfoAppView::HandleForegroundEventL |
|
372 // -------------------------------------------------------------------------- |
|
373 // |
|
374 void CPbk2ContactInfoAppView::HandleForegroundEventL( TBool aForeground ) |
|
375 { |
|
376 CPbk2AppView::HandleForegroundEventL(aForeground); |
|
377 |
|
378 // If this view is gaining foreground, then make sure that thumbnail |
|
379 // gets drawn |
|
380 if (aForeground && iContainer && iContainer->Control()) |
|
381 { |
|
382 if ( iContainer->Control()->IsVisible() ) |
|
383 { |
|
384 iContainer->Control()->ShowThumbnail(); |
|
385 } |
|
386 } |
|
387 } |
|
388 |
|
389 // -------------------------------------------------------------------------- |
|
390 // CPbk2ContactInfoAppView::ViewStateLC |
|
391 // -------------------------------------------------------------------------- |
|
392 // |
|
393 CPbk2ViewState* CPbk2ContactInfoAppView::ViewStateLC() const |
|
394 { |
|
395 __ASSERT_DEBUG( iControl ,Panic(EPanicPreCond_NULLPointer)); |
|
396 |
|
397 CPbk2ViewState* state = iControl->ControlStateL(); |
|
398 CleanupStack::PushL(state); |
|
399 return state; |
|
400 } |
|
401 |
|
402 // -------------------------------------------------------------------------- |
|
403 // CPbk2ContactInfoAppView::HandleCommandKeyL |
|
404 // -------------------------------------------------------------------------- |
|
405 // |
|
406 TBool CPbk2ContactInfoAppView::HandleCommandKeyL |
|
407 (const TKeyEvent& aKeyEvent, TEventCode aType) |
|
408 { |
|
409 __ASSERT_DEBUG(iContainer && iNavigation, |
|
410 Panic(EPanicPreCond_HandleCommandKeyL)); |
|
411 |
|
412 // Pass the key event to the strategy |
|
413 TBool ret = iNavigation->HandleCommandKeyL(aKeyEvent, aType); |
|
414 |
|
415 if (!ret && aType == EEventKey) |
|
416 { |
|
417 switch (aKeyEvent.iCode) |
|
418 { |
|
419 case EKeyOK: |
|
420 { |
|
421 LaunchPopupMenuL(R_PHONEBOOK2_CONTACTINFO_CONTEXTBAR); |
|
422 ret = ETrue; |
|
423 break; |
|
424 } |
|
425 case EKeyBackspace: // Clear key |
|
426 { |
|
427 HandleCommandL(EPbk2CmdDeleteMe); |
|
428 ret = ETrue; |
|
429 break; |
|
430 } |
|
431 case EKeyPhoneSend: |
|
432 { |
|
433 // If focused field is either url or email field |
|
434 // the proper context menu should be launched. |
|
435 if ( IsFocusedFieldTypeL( R_PHONEBOOK2_URL_SELECTOR ) |
|
436 || IsFocusedFieldTypeL( R_PHONEBOOK2_EMAIL_SELECTOR ) ) |
|
437 { |
|
438 LaunchPopupMenuL( R_PHONEBOOK2_CONTACTINFO_CONTEXTBAR ); |
|
439 } |
|
440 else |
|
441 { |
|
442 // Use the EPbk2CmdCall id to identify that |
|
443 // call is being launched with send key |
|
444 HandleCommandL( EPbk2CmdCall ); |
|
445 } |
|
446 ret = ETrue; |
|
447 break; |
|
448 } |
|
449 case EKeyPoC: |
|
450 { |
|
451 // Use the EPbk2CmdPoC id to identify that |
|
452 // call is being launched with PoC key |
|
453 HandleCommandL( EPbk2CmdPoC ); |
|
454 ret = ETrue; |
|
455 break; |
|
456 } |
|
457 default: |
|
458 { |
|
459 break; |
|
460 } |
|
461 } |
|
462 } |
|
463 return ret; |
|
464 } |
|
465 |
|
466 // -------------------------------------------------------------------------- |
|
467 // CPbk2ContactInfoAppView::HandlePointerEventL |
|
468 // -------------------------------------------------------------------------- |
|
469 // |
|
470 void CPbk2ContactInfoAppView::HandlePointerEventL( |
|
471 const TPointerEvent& aPointerEvent ) |
|
472 { |
|
473 if ( AknLayoutUtils::PenEnabled() ) |
|
474 { |
|
475 CPbk2AppView::HandlePointerEventL( aPointerEvent ); |
|
476 |
|
477 switch ( aPointerEvent.iType ) |
|
478 { |
|
479 case TPointerEvent::EButton1Up: |
|
480 { |
|
481 if ( iPointerInspector && |
|
482 iPointerInspector->FocusedItemPointed() ) |
|
483 { |
|
484 // launch context menu if user tapped a focused detail |
|
485 LaunchPopupMenuL( R_PHONEBOOK2_CONTACTINFO_CONTEXTBAR ); |
|
486 } |
|
487 break; |
|
488 } |
|
489 default:; |
|
490 } |
|
491 } |
|
492 } |
|
493 |
|
494 // -------------------------------------------------------------------------- |
|
495 // CPbk2ContactInfoAppView::GetViewSpecificMenuFilteringFlagsL |
|
496 // -------------------------------------------------------------------------- |
|
497 // |
|
498 TInt CPbk2ContactInfoAppView::GetViewSpecificMenuFilteringFlagsL() const |
|
499 { |
|
500 __ASSERT_DEBUG( iControl, |
|
501 Panic( EPanicPreCond_GetViewSpecificMenuFilteringFlagsL ) ); |
|
502 |
|
503 return iControl->GetMenuFilteringFlagsL(); |
|
504 } |
|
505 |
|
506 |
|
507 // -------------------------------------------------------------------------- |
|
508 // CPbk2ContactInfoAppView::PrepareForContactChangeL |
|
509 // -------------------------------------------------------------------------- |
|
510 // |
|
511 void CPbk2ContactInfoAppView::PrepareForContactChangeL() |
|
512 { |
|
513 StoreStateL(); |
|
514 } |
|
515 |
|
516 // -------------------------------------------------------------------------- |
|
517 // CPbk2ContactInfoAppView::ContactChangedL |
|
518 // -------------------------------------------------------------------------- |
|
519 // |
|
520 void CPbk2ContactInfoAppView::ContactChangedL( MVPbkStoreContact* aContact ) |
|
521 { |
|
522 PBK2_PROFILE_END(Pbk2Profile::EContactInfoDoActivateContactChanged); |
|
523 |
|
524 PBK2_PROFILE_START(Pbk2Profile::EContactInfoContactChangedL); |
|
525 |
|
526 PBK2_DEBUG_PRINT(PBK2_DEBUG_STRING |
|
527 ("CPbk2ContactInfoAppView(%x)::ContactChangedL() begin"), this); |
|
528 |
|
529 if ( !iContainer ) |
|
530 { |
|
531 // It is possible that this method get called before |
|
532 // the container and control get constructed. |
|
533 // In that case, ignore the given contact by deleting |
|
534 // it and do not continue the contact changed process. |
|
535 delete aContact; |
|
536 |
|
537 // iViewActivationTransaction should not be deleted here |
|
538 // since it is not tied to this ContactChangedL request |
|
539 |
|
540 PBK2_DEBUG_PRINT(PBK2_DEBUG_STRING |
|
541 ("CPbk2ContactInfoAppView(%x)::ContactChangedL() controls not ready"), |
|
542 this); |
|
543 } |
|
544 else |
|
545 { |
|
546 __ASSERT_DEBUG(iViewActivationTransaction, |
|
547 Panic(EPanicPreCond_ContactChangedL)); |
|
548 __ASSERT_DEBUG(iNavigation, Panic(EPanicPreCond_ContactChangedL)); |
|
549 |
|
550 PBK2_PROFILE_START(Pbk2Profile::EContactInfoContactChangedLUpdateControls); |
|
551 |
|
552 // Update controls |
|
553 if (aContact) |
|
554 { |
|
555 CleanupDeletePushL( aContact ); |
|
556 iContainer->Control()->UpdateL(aContact); |
|
557 CleanupStack::Pop(aContact); // ownership was taken |
|
558 } |
|
559 SetEmptyTextL( R_QTN_PHOB_NO_ITEMS ); |
|
560 |
|
561 PBK2_PROFILE_END(Pbk2Profile::EContactInfoContactChangedLUpdateControls); |
|
562 |
|
563 PBK2_PROFILE_START(Pbk2Profile::EContactInfoContactChangedLSetFocusedField); |
|
564 |
|
565 if ( iControlState->FocusedContact() ) |
|
566 { |
|
567 if ( !iControlState->FocusedContact()->RefersTo( *aContact ) ) |
|
568 { |
|
569 iContainer->Control()->SetFocusedFieldIndex( KErrNotFound ); |
|
570 iControlState->SetFocusedFieldIndex( KErrNotFound ); |
|
571 } |
|
572 } |
|
573 PBK2_PROFILE_END(Pbk2Profile::EContactInfoContactChangedLSetFocusedField); |
|
574 |
|
575 PBK2_PROFILE_START(Pbk2Profile::EContactInfoContactChangedLRestoreControlState); |
|
576 iContainer->Control()->RestoreControlStateL(iControlState); |
|
577 PBK2_PROFILE_END(Pbk2Profile::EContactInfoContactChangedLRestoreControlState); |
|
578 |
|
579 // Commit application-wide state changes |
|
580 PBK2_PROFILE_START(Pbk2Profile::EContactInfoContactChangedLCommitViewTransaction); |
|
581 iViewActivationTransaction->Commit(); |
|
582 PBK2_PROFILE_END(Pbk2Profile::EContactInfoContactChangedLCommitViewTransaction); |
|
583 |
|
584 // notifies startup monitor of view activation |
|
585 PBK2_PROFILE_START(Pbk2Profile::EContactInfoContactChangedLNotifyStartupMonitor); |
|
586 if (Pbk2AppUi()->Pbk2StartupMonitor()) |
|
587 { |
|
588 Pbk2AppUi()->Pbk2StartupMonitor()->NotifyViewActivationL(Id()); |
|
589 } |
|
590 PBK2_PROFILE_END(Pbk2Profile::EContactInfoContactChangedLNotifyStartupMonitor); |
|
591 } |
|
592 |
|
593 PBK2_PROFILE_END(Pbk2Profile::EContactInfoContactChangedL); |
|
594 |
|
595 PBK2_DEBUG_PRINT(PBK2_DEBUG_STRING |
|
596 ("CPbk2ContactInfoAppView(%x)::ContactChangedL() end"), this); |
|
597 } |
|
598 |
|
599 // -------------------------------------------------------------------------- |
|
600 // CPbk2ContactInfoAppView::ContactChangeFailed |
|
601 // -------------------------------------------------------------------------- |
|
602 // |
|
603 void CPbk2ContactInfoAppView::ContactChangeFailed() |
|
604 { |
|
605 PBK2_DEBUG_PRINT(PBK2_DEBUG_STRING |
|
606 ("CPbk2ContactInfoAppView(%x)::ContactChangeFailed()"), this); |
|
607 |
|
608 TInt err = KErrNone; |
|
609 |
|
610 TRAP( err, SetEmptyTextL( R_QTN_PHOB_NO_ITEMS ) ); |
|
611 if ( err != KErrNone ) |
|
612 { |
|
613 CEikonEnv::Static()->HandleError( err ); |
|
614 } |
|
615 |
|
616 // Rollback |
|
617 if ( iViewActivationTransaction ) |
|
618 { |
|
619 // Rollback by force |
|
620 TRAP( err, iViewActivationTransaction->RollbackL() ); |
|
621 delete iViewActivationTransaction; |
|
622 iViewActivationTransaction = NULL; |
|
623 |
|
624 if ( err != KErrNone ) |
|
625 { |
|
626 CEikonEnv::Static()->HandleError( err ); |
|
627 } |
|
628 } |
|
629 } |
|
630 |
|
631 // -------------------------------------------------------------------------- |
|
632 // CPbk2ContactInfoAppView::Contact |
|
633 // -------------------------------------------------------------------------- |
|
634 // |
|
635 const MVPbkStoreContact* CPbk2ContactInfoAppView::Contact() const |
|
636 { |
|
637 const MVPbkStoreContact* result = NULL; |
|
638 if (iControl) |
|
639 { |
|
640 result = iControl->FocusedStoreContact(); |
|
641 } |
|
642 return result; |
|
643 } |
|
644 |
|
645 // -------------------------------------------------------------------------- |
|
646 // CPbk2ContactInfoAppView::HandleControlEventL |
|
647 // -------------------------------------------------------------------------- |
|
648 // |
|
649 void CPbk2ContactInfoAppView::HandleControlEventL |
|
650 ( MPbk2ContactUiControl& /*aControl*/, |
|
651 const TPbk2ControlEvent& aEvent) |
|
652 { |
|
653 switch (aEvent.iEventType) |
|
654 { |
|
655 case TPbk2ControlEvent::EReady: |
|
656 { |
|
657 UpdateCbasL(); |
|
658 break; |
|
659 } |
|
660 |
|
661 default: |
|
662 { |
|
663 // Do nothing |
|
664 break; |
|
665 } |
|
666 } |
|
667 } |
|
668 |
|
669 // -------------------------------------------------------------------------- |
|
670 // CPbk2ContactInfoAppView::ConfigurationChanged |
|
671 // -------------------------------------------------------------------------- |
|
672 // |
|
673 void CPbk2ContactInfoAppView::ConfigurationChanged() |
|
674 { |
|
675 if (iPreviousViewId.iViewUid != KNullUid) |
|
676 { |
|
677 TRAPD(err, LoadContactViewL(iPreviousViewId)); |
|
678 if (err != KErrNone) |
|
679 { |
|
680 CCoeEnv::Static()->HandleError(err); |
|
681 } |
|
682 } |
|
683 } |
|
684 |
|
685 // -------------------------------------------------------------------------- |
|
686 // CPbk2ContactInfoAppView::ConfigurationChangedComplete |
|
687 // -------------------------------------------------------------------------- |
|
688 // |
|
689 void CPbk2ContactInfoAppView::ConfigurationChangedComplete() |
|
690 { |
|
691 // Do nothing |
|
692 } |
|
693 |
|
694 // -------------------------------------------------------------------------- |
|
695 // CPbk2ContactInfoAppView::PreCommandExecutionL |
|
696 // -------------------------------------------------------------------------- |
|
697 // |
|
698 void CPbk2ContactInfoAppView::PreCommandExecutionL |
|
699 ( const MPbk2Command& /*aCommand*/ ) |
|
700 { |
|
701 if (iContainer && iContainer->Control()) |
|
702 { |
|
703 iContainer->Control()->HideThumbnail(); |
|
704 } |
|
705 } |
|
706 |
|
707 // -------------------------------------------------------------------------- |
|
708 // CPbk2ContactInfoAppView::PostCommandExecutionL |
|
709 // -------------------------------------------------------------------------- |
|
710 // |
|
711 void CPbk2ContactInfoAppView::PostCommandExecutionL |
|
712 ( const MPbk2Command& /*aCommand*/ ) |
|
713 { |
|
714 if (iContainer && iContainer->Control()) |
|
715 { |
|
716 iContainer->Control()->ShowThumbnail(); |
|
717 } |
|
718 } |
|
719 |
|
720 // -------------------------------------------------------------------------- |
|
721 // CPbk2ContactInfoAppView::CreateControlsL |
|
722 // -------------------------------------------------------------------------- |
|
723 // |
|
724 inline void CPbk2ContactInfoAppView::CreateControlsL() |
|
725 { |
|
726 PBK2_PROFILE_START(Pbk2Profile::EContactInfoCreateControlsL); |
|
727 |
|
728 if (!iContainer) |
|
729 { |
|
730 // Create the container and control |
|
731 CContainer* container = CContainer::NewLC(this, this, *this); |
|
732 |
|
733 container->SetHelpContext( TCoeHelpContext( ApplicationUid(), |
|
734 KPHOB_HLP_CONTACT_INFO_VIEW )); |
|
735 |
|
736 CPbk2ContactInfoControl* control = CPbk2ContactInfoControl::NewL |
|
737 ( container, iContactManager, |
|
738 Pbk2AppUi()->ApplicationServices().NameFormatter(), |
|
739 Pbk2AppUi()->ApplicationServices().FieldProperties(), |
|
740 Pbk2AppUi()->ApplicationServices().StoreProperties(), |
|
741 iNavigation ); |
|
742 |
|
743 container->SetControl(control, ClientRect()); // takes ownership |
|
744 control->AddObserverL(*this); |
|
745 |
|
746 // Add this view and container to the view stack |
|
747 AppUi()->AddToViewStackL(*this, container); |
|
748 CleanupStack::Pop(container); |
|
749 iContainer = container; |
|
750 iControl = control; |
|
751 |
|
752 // Assign pointer event inspector |
|
753 iPointerInspector = |
|
754 AknLayoutUtils::PenEnabled() ? control : NULL; |
|
755 |
|
756 iContainer->ActivateL(); |
|
757 iContainer->Control()->MakeVisible( ETrue ); |
|
758 } |
|
759 |
|
760 PBK2_PROFILE_END(Pbk2Profile::EContactInfoCreateControlsL); |
|
761 } |
|
762 |
|
763 // -------------------------------------------------------------------------- |
|
764 // CPbk2ContactInfoAppView::HandleNavigationEvent |
|
765 // -------------------------------------------------------------------------- |
|
766 // |
|
767 void CPbk2ContactInfoAppView::HandleNavigationEvent |
|
768 ( const TEventType& aEventType ) |
|
769 { |
|
770 if ( aEventType == MPbk2NavigationObserver::EContactDeleted ) |
|
771 { |
|
772 // Contact was deleted which means that we must go back to previous |
|
773 // view. The previous view must know the contact to focus and it |
|
774 // obviously can not be the deleted contact. The navigator works |
|
775 // in a same logic as the focus in the previous view. It knows the |
|
776 // the contact after deletion. |
|
777 TRAPD( err, |
|
778 { |
|
779 MVPbkContactLink* curContact = CurrentContactInNavigatorLC(); |
|
780 CleanupStack::Pop(); // curContact |
|
781 // Give ownership of curContact |
|
782 ReturnToPreviousViewL( curContact ); |
|
783 }); |
|
784 if ( err != KErrNone ) |
|
785 { |
|
786 CCoeEnv::Static()->HandleError( err ); |
|
787 } |
|
788 } |
|
789 } |
|
790 |
|
791 // -------------------------------------------------------------------------- |
|
792 // CPbk2ContactInfoAppView::ViewLoaded |
|
793 // -------------------------------------------------------------------------- |
|
794 // |
|
795 void CPbk2ContactInfoAppView::ViewLoaded( MVPbkContactViewBase& aView ) |
|
796 { |
|
797 __ASSERT_DEBUG(iContactLoader && iControlState, |
|
798 Panic(EPanicPreCond_ViewLoaded)); |
|
799 |
|
800 if ( &aView == iContactView ) |
|
801 { |
|
802 TRAPD( error, HandleViewLoadedL() ); |
|
803 if ( error != KErrNone ) |
|
804 { |
|
805 ViewError( aView, error ); |
|
806 } |
|
807 } |
|
808 delete iViewLoader; |
|
809 iViewLoader = NULL; |
|
810 |
|
811 PBK2_PROFILE_END(Pbk2Profile::EContactInfoStartTime); |
|
812 } |
|
813 |
|
814 // -------------------------------------------------------------------------- |
|
815 // CPbk2ContactInfoAppView::ViewError |
|
816 // -------------------------------------------------------------------------- |
|
817 // |
|
818 void CPbk2ContactInfoAppView::ViewError |
|
819 ( MVPbkContactViewBase& aView, TInt /*aError*/ ) |
|
820 { |
|
821 delete iViewLoader; |
|
822 iViewLoader = NULL; |
|
823 |
|
824 if ( &aView == iContactView ) |
|
825 { |
|
826 TRAPD( error, iViewActivationTransaction->RollbackL() ); |
|
827 if ( error != KErrNone ) |
|
828 { |
|
829 CCoeEnv::Static()->HandleError(error); |
|
830 } |
|
831 } |
|
832 } |
|
833 |
|
834 // -------------------------------------------------------------------------- |
|
835 // CPbk2ContactInfoAppView::UpdateViewStateL |
|
836 // -------------------------------------------------------------------------- |
|
837 // |
|
838 inline void CPbk2ContactInfoAppView::UpdateViewStateL |
|
839 ( const TUid aCustomMessageId, |
|
840 const TDesC8& aCustomMessage) |
|
841 { |
|
842 CPbk2ViewState* viewState = NULL; |
|
843 if (aCustomMessageId == TUid::Uid(KPbkViewStateUid)) |
|
844 { |
|
845 // handle legacy view state |
|
846 CPbk2ViewStateTransformer* transformer = |
|
847 CPbk2ViewStateTransformer::NewLC( iContactManager ); |
|
848 viewState = transformer-> |
|
849 TransformLegacyViewStateToPbk2ViewStateLC( aCustomMessage ); |
|
850 CleanupStack::Pop(); |
|
851 CleanupStack::PopAndDestroy(transformer); |
|
852 } |
|
853 else if (aCustomMessageId == CPbk2ViewState::Uid()) |
|
854 { |
|
855 // Read the desired UI state from aCustomMessage |
|
856 viewState = CPbk2ViewState::NewL(aCustomMessage); |
|
857 } |
|
858 else |
|
859 { |
|
860 // a parameter must be passed to this view |
|
861 User::Leave(KErrNotSupported); |
|
862 } |
|
863 |
|
864 if (iControlState) |
|
865 { |
|
866 // Merge parameter view state with the stored state |
|
867 if ( viewState->FocusedContact() && |
|
868 !viewState->FocusedContact()->IsSame |
|
869 ( *iControlState->FocusedContact() )) |
|
870 { |
|
871 iControlState->SetFocusedContact( |
|
872 viewState->TakeFocusedContact()); |
|
873 iControlState->SetFocusedFieldIndex(KErrNotFound); |
|
874 iControlState->SetTopFieldIndex(KErrNotFound); |
|
875 } |
|
876 if (viewState->FocusedFieldIndex() >= 0) |
|
877 { |
|
878 iControlState->SetFocusedFieldIndex( |
|
879 viewState->FocusedFieldIndex()); |
|
880 } |
|
881 if (viewState->TopFieldIndex() >= 0) |
|
882 { |
|
883 iControlState->SetTopFieldIndex( |
|
884 viewState->TopFieldIndex()); |
|
885 } |
|
886 if ( viewState->ParentContact() ) |
|
887 { |
|
888 iControlState->SetParentContact( |
|
889 viewState->TakeParentContact()); |
|
890 } |
|
891 // Delete parameter view state |
|
892 delete viewState; |
|
893 } |
|
894 else |
|
895 { |
|
896 // No stored state, use the parameter supplied one |
|
897 iControlState = viewState; |
|
898 } |
|
899 } |
|
900 |
|
901 // -------------------------------------------------------------------------- |
|
902 // CPbk2ContactInfoAppView::SetNavigatorViewL |
|
903 // -------------------------------------------------------------------------- |
|
904 // |
|
905 void CPbk2ContactInfoAppView::SetNavigatorViewL() |
|
906 { |
|
907 __ASSERT_DEBUG(iNavigation, |
|
908 Panic(EPanicPreCond_SetNavigatorViewL)); |
|
909 |
|
910 // Set default navigation |
|
911 iNavigation->SetScrollViewL( iContactView, EFalse ); |
|
912 |
|
913 // Inspect if the parent contact is set and if the parent |
|
914 // contact is expandable. In that case set the navigation |
|
915 // view to the expandable view. |
|
916 const MVPbkContactLink* parentLink = iControlState->ParentContact(); |
|
917 if ( parentLink ) |
|
918 { |
|
919 // Find parent index in the contact view |
|
920 const TInt parentIndex = |
|
921 iContactView->IndexOfLinkL( *parentLink ); |
|
922 // Get the view contact by view index |
|
923 const MVPbkViewContact& viewContact = |
|
924 iContactView->ContactAtL( parentIndex ); |
|
925 |
|
926 // Expand the scroll view from the view contact |
|
927 MVPbkExpandable* expandable = viewContact.Expandable(); |
|
928 if ( expandable ) |
|
929 { |
|
930 MVPbkContactViewBase* scrollView = expandable->ExpandLC |
|
931 ( *iNavigation, Pbk2AppUi()->ApplicationServices(). |
|
932 SortOrderManager().SortOrder() ); |
|
933 CleanupStack::Pop(); // scrollView |
|
934 |
|
935 // Set the navigation scroll view, transfer ownership |
|
936 iNavigation->SetScrollViewL( scrollView, ETrue ); |
|
937 } |
|
938 } |
|
939 } |
|
940 |
|
941 // -------------------------------------------------------------------------- |
|
942 // CPbk2ContactInfoAppView::StoreStateL |
|
943 // -------------------------------------------------------------------------- |
|
944 // |
|
945 void CPbk2ContactInfoAppView::StoreStateL() |
|
946 { |
|
947 CPbk2ViewState* state = ViewStateLC(); |
|
948 CleanupStack::Pop(); // state |
|
949 |
|
950 // state should be always created, but valid state |
|
951 // has focusedContact |
|
952 if ( state && state->FocusedContact() ) |
|
953 { |
|
954 delete iControlState; |
|
955 iControlState = state; |
|
956 } |
|
957 else |
|
958 { |
|
959 delete state; |
|
960 state = NULL; |
|
961 } |
|
962 } |
|
963 |
|
964 // -------------------------------------------------------------------------- |
|
965 // CPbk2ContactInfoAppView::IsFocusedFieldTypeL |
|
966 // -------------------------------------------------------------------------- |
|
967 // |
|
968 TBool CPbk2ContactInfoAppView::IsFocusedFieldTypeL( TInt aSelectorResId ) |
|
969 { |
|
970 TPbk2StoreContactAnalyzer analyzer( iContactManager, NULL ); |
|
971 const MVPbkBaseContactField* field = iContainer->Control()->FocusedField(); |
|
972 |
|
973 if ( field ) |
|
974 { |
|
975 return analyzer.IsFieldTypeIncludedL( *field, aSelectorResId ); |
|
976 } |
|
977 else |
|
978 { |
|
979 return EFalse; |
|
980 } |
|
981 } |
|
982 |
|
983 // -------------------------------------------------------------------------- |
|
984 // CPbk2ContactInfoAppView::UpdateCbasL |
|
985 // -------------------------------------------------------------------------- |
|
986 // |
|
987 void CPbk2ContactInfoAppView::UpdateCbasL() |
|
988 { |
|
989 if ( iControl ) |
|
990 { |
|
991 // Set cba command set "Options - Context Menu - Back" |
|
992 Cba()->SetCommandSetL( R_PBK2_SOFTKEYS_OPTIONS_BACK_CONTEXT ); |
|
993 Cba()->DrawDeferred(); |
|
994 // Set context menu |
|
995 MenuBar()->SetContextMenuTitleResourceId |
|
996 ( R_PHONEBOOK2_CONTACTINFO_CONTEXTBAR ); |
|
997 } |
|
998 } |
|
999 |
|
1000 // -------------------------------------------------------------------------- |
|
1001 // CPbk2ContactInfoAppView::AttachAIWProvidersL |
|
1002 // -------------------------------------------------------------------------- |
|
1003 // |
|
1004 inline void CPbk2ContactInfoAppView::AttachAIWProvidersL() |
|
1005 { |
|
1006 PBK2_PROFILE_START(Pbk2Profile::EContactInfoAttachAIWProvidersL); |
|
1007 |
|
1008 iCommandHandler->RegisterAiwInterestL |
|
1009 ( KAiwCmdCall, R_PHONEBOOK2_CALL_MENU, |
|
1010 R_PHONEBOOK2_CALLUI_AIW_INTEREST, ETrue ); |
|
1011 |
|
1012 iCommandHandler->RegisterAiwInterestL |
|
1013 (KAiwCmdCall, R_PHONEBOOK2_CALL_CONTEXT_MENU, |
|
1014 R_PHONEBOOK2_CALLUI_AIW_INTEREST, EFalse); |
|
1015 |
|
1016 iCommandHandler->RegisterAiwInterestL |
|
1017 ( KAiwCmdPoC, R_PHONEBOOK2_POC_MENU, |
|
1018 R_PHONEBOOK2_POCUI_AIW_INTEREST, ETrue ); |
|
1019 |
|
1020 iCommandHandler->RegisterAiwInterestL |
|
1021 (KAiwCmdPoC, R_PHONEBOOK2_POC_CONTEXT_MENU, |
|
1022 R_PHONEBOOK2_POCUI_AIW_INTEREST, EFalse); |
|
1023 |
|
1024 PBK2_PROFILE_END(Pbk2Profile::EContactInfoAttachAIWProvidersL); |
|
1025 } |
|
1026 |
|
1027 // -------------------------------------------------------------------------- |
|
1028 // CPbk2ContactInfoAppView::HandleLongTapEventL |
|
1029 // -------------------------------------------------------------------------- |
|
1030 // |
|
1031 void CPbk2ContactInfoAppView::HandleLongTapEventL |
|
1032 ( const TPoint& /*aPenEventLocation*/, |
|
1033 const TPoint& /*aPenEventScreenLocation*/ ) |
|
1034 { |
|
1035 // Do nothing |
|
1036 } |
|
1037 |
|
1038 // -------------------------------------------------------------------------- |
|
1039 // CPbk2ContactInfoAppView::CurrentContactInNavigatorLC |
|
1040 // -------------------------------------------------------------------------- |
|
1041 // |
|
1042 MVPbkContactLink* CPbk2ContactInfoAppView::CurrentContactInNavigatorLC() |
|
1043 { |
|
1044 if ( iNavigation ) |
|
1045 { |
|
1046 return iNavigation->CurrentContactLC(); |
|
1047 } |
|
1048 else |
|
1049 { |
|
1050 MVPbkContactLink* link = NULL; |
|
1051 // LC semantics also in NULL case. |
|
1052 CleanupStack::PushL( link ); |
|
1053 return link; |
|
1054 } |
|
1055 } |
|
1056 |
|
1057 // -------------------------------------------------------------------------- |
|
1058 // CPbk2ContactInfoAppView::ReturnToPreviousViewL |
|
1059 // -------------------------------------------------------------------------- |
|
1060 // |
|
1061 void CPbk2ContactInfoAppView::ReturnToPreviousViewL |
|
1062 ( MVPbkContactLink* aFocusedContact ) const |
|
1063 { |
|
1064 // Ownership of aFocusedContact is taken by this function |
|
1065 CleanupDeletePushL( aFocusedContact ); |
|
1066 |
|
1067 CPbk2ViewState* state = ViewStateLC(); |
|
1068 CleanupStack::Pop( state ); |
|
1069 |
|
1070 // aFocusedContact contact overwrites the focused contact from control's |
|
1071 // state. |
|
1072 if ( aFocusedContact ) |
|
1073 { |
|
1074 // state takes the ownership if aFocusedContact |
|
1075 state->SetFocusedContact( aFocusedContact ); |
|
1076 CleanupStack::Pop(); // aFocusedContact |
|
1077 } |
|
1078 else |
|
1079 { |
|
1080 CleanupStack::PopAndDestroy(); // aFocusedContact |
|
1081 } |
|
1082 |
|
1083 CleanupStack::PushL( state ); |
|
1084 |
|
1085 Pbk2AppUi()->Pbk2ViewExplorer()->ActivatePreviousViewL( state ); |
|
1086 CleanupStack::PopAndDestroy( state ); |
|
1087 } |
|
1088 |
|
1089 // -------------------------------------------------------------------------- |
|
1090 // CPbk2ContactInfoAppView::LoadContactViewL |
|
1091 // -------------------------------------------------------------------------- |
|
1092 // |
|
1093 void CPbk2ContactInfoAppView::LoadContactViewL |
|
1094 ( const TVwsViewId& aPrevViewId ) |
|
1095 { |
|
1096 delete iViewLoader; |
|
1097 iViewLoader = NULL; |
|
1098 |
|
1099 if ( Pbk2AppUi()->Pbk2ViewExplorer()-> |
|
1100 IsPhonebook2View( aPrevViewId ) && |
|
1101 ( aPrevViewId.iViewUid == TUid::Uid |
|
1102 ( EPbk2GroupMembersListViewId ) ) ) |
|
1103 { |
|
1104 iContactView = Phonebook2::Pbk2AppUi()->ApplicationServices(). |
|
1105 ViewSupplier().AllGroupsViewL(); |
|
1106 } |
|
1107 else |
|
1108 { |
|
1109 iContactView = Phonebook2::Pbk2AppUi()->ApplicationServices(). |
|
1110 ViewSupplier().AllContactsViewL(); |
|
1111 } |
|
1112 |
|
1113 iViewLoader = CPbk2ViewLoader::NewL( *iContactView, *this ); |
|
1114 } |
|
1115 |
|
1116 // -------------------------------------------------------------------------- |
|
1117 // CPbk2ContactInfoAppView::HandleViewLoadedL |
|
1118 // -------------------------------------------------------------------------- |
|
1119 // |
|
1120 void CPbk2ContactInfoAppView::HandleViewLoadedL() |
|
1121 { |
|
1122 SetNavigatorViewL(); |
|
1123 LoadContactL(); |
|
1124 } |
|
1125 |
|
1126 // -------------------------------------------------------------------------- |
|
1127 // CPbk2ContactInfoAppView::LoadContactL |
|
1128 // -------------------------------------------------------------------------- |
|
1129 // |
|
1130 void CPbk2ContactInfoAppView::LoadContactL() |
|
1131 { |
|
1132 const MVPbkContactLink* link = iControlState->FocusedContact(); |
|
1133 __ASSERT_DEBUG( link, Panic( EPanicLogic_LoadContactL ) ); |
|
1134 __ASSERT_DEBUG( iContactLoader, Panic( EPanicLogic_LoadContactL ) ); |
|
1135 |
|
1136 // Load the contact from view state, this is asynchronous |
|
1137 iContactLoader->ChangeContactL( *link ); |
|
1138 } |
|
1139 |
|
1140 // -------------------------------------------------------------------------- |
|
1141 // CPbk2ContactInfoAppView::ConstructNavigatorL |
|
1142 // -------------------------------------------------------------------------- |
|
1143 // |
|
1144 void CPbk2ContactInfoAppView::ConstructNavigatorL() |
|
1145 { |
|
1146 CVPbkContactStoreUriArray* uriList = |
|
1147 Pbk2AppUi()->ApplicationServices().StoreConfiguration(). |
|
1148 CurrentConfigurationL(); |
|
1149 CleanupStack::PushL( uriList ); |
|
1150 MVPbkContactStoreList& fullStoreList = |
|
1151 iContactManager.ContactStoresL(); |
|
1152 for (TInt i = 0; i < uriList->Count(); ++i) |
|
1153 { |
|
1154 // Add all the contact stores to the store list |
|
1155 TVPbkContactStoreUriPtr uri = (*uriList)[i]; |
|
1156 MVPbkContactStore* store = fullStoreList.Find(uri); |
|
1157 iStoreList.AppendL(store); |
|
1158 } |
|
1159 CleanupStack::PopAndDestroy( uriList ); |
|
1160 |
|
1161 /// Create contact loader and contact info scroll navigator |
|
1162 delete iContactLoader; |
|
1163 iContactLoader = NULL; |
|
1164 iContactLoader = CPbk2MemoryEntryContactLoader::NewL( *this ); |
|
1165 |
|
1166 MVPbkContactStore& storeFromState = |
|
1167 iControlState->FocusedContact()->ContactStore(); |
|
1168 TBool storeNotInConfiguration = EFalse; |
|
1169 if ( iStoreList.Find( &storeFromState ) == KErrNotFound ) |
|
1170 { |
|
1171 storeNotInConfiguration = ETrue; |
|
1172 // Do not add store into list, opening of this lone |
|
1173 // store is not navigator's responsibility |
|
1174 } |
|
1175 |
|
1176 if ( !storeNotInConfiguration ) |
|
1177 { |
|
1178 iNavigation = Pbk2NavigatorFactory::CreateContactNavigatorL |
|
1179 ( Id(), *this, *iContactLoader, iStoreList.Array(), |
|
1180 R_QTN_PHOB_NAVI_POS_INDICATOR_CONTACT_INFO_VIEW ); |
|
1181 } |
|
1182 else |
|
1183 { |
|
1184 // Store was not in configuration --> contact to be shown is not |
|
1185 // included in the scroll view --> no point to use sideways |
|
1186 // navigation strategy |
|
1187 iNavigation = Pbk2NavigatorFactory::CreateVoidNavigatorL |
|
1188 ( Id(), *this, *iContactLoader, iStoreList.Array() ); |
|
1189 } |
|
1190 } |
|
1191 |
|
1192 // -------------------------------------------------------------------------- |
|
1193 // CPbk2ContactInfoAppView::UpdateViewGraphL |
|
1194 // Sets previous view node. Previous node should be set dynamically |
|
1195 // because it could be some extension view. |
|
1196 // Default is names list view. |
|
1197 // -------------------------------------------------------------------------- |
|
1198 // |
|
1199 void CPbk2ContactInfoAppView::UpdateViewGraphL |
|
1200 ( const TVwsViewId& aPrevViewId ) |
|
1201 { |
|
1202 CPbk2ViewGraph& viewGraph = static_cast<CPbk2ViewExplorer*> |
|
1203 ( Pbk2AppUi()->Pbk2ViewExplorer() )->ViewGraph(); |
|
1204 CPbk2ViewNode* prevNode = |
|
1205 viewGraph.FindNodeWithViewId( aPrevViewId.iViewUid ); |
|
1206 if ( prevNode ) |
|
1207 { |
|
1208 CPbk2ViewNode* thisNode = viewGraph.FindNodeWithViewId( Id() ); |
|
1209 if ( thisNode ) |
|
1210 { |
|
1211 thisNode->SetPreviousNode( prevNode ); |
|
1212 } |
|
1213 } |
|
1214 } |
|
1215 |
|
1216 // -------------------------------------------------------------------------- |
|
1217 // CPbk2ContactInfoAppView::SetEmptyTextL |
|
1218 // Sets empty text for contact info list box from given resource id. |
|
1219 // -------------------------------------------------------------------------- |
|
1220 // |
|
1221 void CPbk2ContactInfoAppView::SetEmptyTextL( |
|
1222 TInt aResourceId ) |
|
1223 { |
|
1224 HBufC* emptyText = StringLoader::LoadLC( aResourceId ); |
|
1225 iContainer->Control()->SetTextL( *emptyText ); |
|
1226 CleanupStack::PopAndDestroy( emptyText ); |
|
1227 } |
|
1228 |
|
1229 |
|
1230 // End of File |