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