|
1 /* |
|
2 * Copyright (c) 2002-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: A base class for sim name list views |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #include "CPsu2NameListViewBase.h" |
|
20 |
|
21 // Phonebook2 |
|
22 #include "CPsu2ViewManager.h" |
|
23 #include <CPbk2AppUiBase.h> |
|
24 #include <CPbk2ControlContainer.h> |
|
25 #include <CPbk2NamesListControl.h> |
|
26 #include <CPbk2UIExtensionView.h> |
|
27 #include <MPbk2CommandHandler.h> |
|
28 #include <CPbk2ViewState.h> |
|
29 #include <CPbk2IconInfoContainer.h> |
|
30 #include <CPbk2IconFactory.h> |
|
31 #include <Pbk2USimUIRes.rsg> |
|
32 #include <Pbk2CommonUi.rsg> |
|
33 #include <Pbk2UIControls.rsg> |
|
34 #include <MPbk2ViewExplorer.h> |
|
35 #include <csxhelp/phob.hlp.hrh> |
|
36 #include <CPbk2SortOrderManager.h> |
|
37 #include <Pbk2ContactNameFormatterFactory.h> |
|
38 #include <MPbk2ContactNameFormatter.h> |
|
39 #include <MPbk2PointerEventInspector.h> |
|
40 #include <MPbk2ApplicationServices.h> |
|
41 #include <Pbk2MenuFilteringFlags.hrh> |
|
42 |
|
43 // Virtual Phonebook |
|
44 #include <MVPbkContactViewBase.h> |
|
45 #include <CVPbkContactManager.h> |
|
46 #include <MVPbkViewContact.h> |
|
47 |
|
48 // System includes |
|
49 #include <avkon.rsg> |
|
50 #include <eikbtgpc.h> |
|
51 #include <AknsUtils.h> |
|
52 #include <AknUtils.h> |
|
53 #include <AknIconUtils.h> |
|
54 #include <aknlayout.cdl.h> |
|
55 #include <StringLoader.h> |
|
56 #include <barsread.h> |
|
57 |
|
58 |
|
59 /// Unnamed namespace for local definitions |
|
60 namespace { |
|
61 |
|
62 /** |
|
63 * Returns ETrue if either Shift or Control key is depressed. |
|
64 * |
|
65 * @param aKeyEvent Key event. |
|
66 * @return ETrue if shift or control is down. |
|
67 */ |
|
68 inline TBool IsShiftOrControlDown( const TKeyEvent& aKeyEvent ) |
|
69 { |
|
70 return ( aKeyEvent.iModifiers & |
|
71 ( EModifierShift | EModifierLeftShift | EModifierRightShift | |
|
72 EModifierCtrl | EModifierLeftCtrl | EModifierRightCtrl ) ) != 0; |
|
73 } |
|
74 |
|
75 } /// namespace |
|
76 |
|
77 |
|
78 // ============================ MEMBER FUNCTIONS =============================== |
|
79 |
|
80 // ----------------------------------------------------------------------------- |
|
81 // CPsu2NameListViewBase::TContextPaneIcon::TContextPaneIcon |
|
82 // C++ default constructor can NOT contain any code, that |
|
83 // might leave. |
|
84 // ----------------------------------------------------------------------------- |
|
85 // |
|
86 CPsu2NameListViewBase::TContextPaneIcon::TContextPaneIcon(TPsu2SimIconId aIconId) |
|
87 : iIconId( aIconId ) |
|
88 { |
|
89 } |
|
90 |
|
91 // ----------------------------------------------------------------------------- |
|
92 // CPsu2NameListViewBase::TContextPaneIcon::CreateLC |
|
93 // ----------------------------------------------------------------------------- |
|
94 // |
|
95 CEikImage* CPsu2NameListViewBase::TContextPaneIcon::CreateLC() |
|
96 { |
|
97 CEikImage* image = new(ELeave) CEikImage; |
|
98 CleanupStack::PushL( image ); |
|
99 |
|
100 CPbk2IconInfoContainer* iconInfoContainer = |
|
101 CPbk2IconInfoContainer::NewL( R_PSU2_ICON_INFO_ARRAY ); |
|
102 CleanupStack::PushL( iconInfoContainer ); |
|
103 CPbk2IconFactory* factory = CPbk2IconFactory::NewLC( *iconInfoContainer ); |
|
104 |
|
105 CFbsBitmap* bitmap = NULL; |
|
106 CFbsBitmap* mask = NULL; |
|
107 factory->CreateIconL( iIconId, *AknsUtils::SkinInstance(), bitmap, mask ); |
|
108 SetSize( *bitmap, *mask ); |
|
109 image->SetNewBitmaps( bitmap, mask ); |
|
110 |
|
111 CleanupStack::PopAndDestroy(2); // factory, iconInfoContainer |
|
112 return image; |
|
113 } |
|
114 |
|
115 // ----------------------------------------------------------------------------- |
|
116 // CPsu2NameListViewBase::TContextPaneIcon::SetSize |
|
117 // ----------------------------------------------------------------------------- |
|
118 // |
|
119 void CPsu2NameListViewBase::TContextPaneIcon::SetSize(CFbsBitmap& aBitmap, |
|
120 CFbsBitmap& aMask ) |
|
121 { |
|
122 TAknLayoutRect statuspane; |
|
123 statuspane.LayoutRect(iAvkonAppUi->ApplicationRect(), |
|
124 AknLayout::status_pane(iAvkonAppUi->ApplicationRect(),0)); |
|
125 |
|
126 // context pane |
|
127 TAknWindowLineLayout contextPaneLayout = |
|
128 AknLayout::context_pane(statuspane.Rect(), 0); |
|
129 TAknLayoutRect contextPaneLayoutRect; |
|
130 contextPaneLayoutRect.LayoutRect(statuspane.Rect(), contextPaneLayout); |
|
131 TRect contextPaneRect = contextPaneLayoutRect.Rect(); |
|
132 |
|
133 AknIconUtils::SetSize( &aBitmap, contextPaneRect.Size() ); |
|
134 AknIconUtils::SetSize( &aMask, contextPaneRect.Size() ); |
|
135 } |
|
136 |
|
137 // ----------------------------------------------------------------------------- |
|
138 // CPsu2NameListViewBase::CPsu2NameListViewBase |
|
139 // C++ default constructor can NOT contain any code, that |
|
140 // might leave. |
|
141 // ----------------------------------------------------------------------------- |
|
142 // |
|
143 CPsu2NameListViewBase::CPsu2NameListViewBase |
|
144 ( CPbk2UIExtensionView& aExtensionView, |
|
145 CPsu2ViewManager& aViewManager) : |
|
146 iExtensionView( aExtensionView ), |
|
147 iViewManager( aViewManager ), |
|
148 iFocusIndex( KErrNotFound ) |
|
149 { |
|
150 } |
|
151 |
|
152 // ----------------------------------------------------------------------------- |
|
153 // CPsu2NameListViewBase::~CPsu2NameListViewBase |
|
154 // ----------------------------------------------------------------------------- |
|
155 // |
|
156 CPsu2NameListViewBase::~CPsu2NameListViewBase() |
|
157 { |
|
158 delete iControlState; |
|
159 |
|
160 if (iContainer) |
|
161 { |
|
162 CCoeEnv::Static()->AppUi()->RemoveFromStack( iContainer ); |
|
163 delete iContainer; |
|
164 } |
|
165 delete iNameFormatter; |
|
166 delete iSortOrderManager; |
|
167 } |
|
168 |
|
169 |
|
170 // ----------------------------------------------------------------------------- |
|
171 // CPsu2NameListViewBase::UpdateListEmptyTextL |
|
172 // ----------------------------------------------------------------------------- |
|
173 // |
|
174 void CPsu2NameListViewBase::UpdateListEmptyTextL( TInt aListState ) |
|
175 { |
|
176 switch ( aListState ) |
|
177 { |
|
178 case CPbk2NamesListControl::EStateEmpty: |
|
179 { |
|
180 HBufC* text = StringLoader::LoadLC( R_QTN_SELEC_EMPTY_LIST ); |
|
181 if ( iControl ) |
|
182 { |
|
183 iControl->SetTextL( *text ); |
|
184 } |
|
185 CleanupStack::PopAndDestroy( text ); |
|
186 break; |
|
187 } |
|
188 case CPbk2NamesListControl::EStateReady: // FALLTHROUGH |
|
189 case CPbk2NamesListControl::EStateFiltered: |
|
190 { |
|
191 HBufC* text = StringLoader::LoadLC( R_PBK2_FIND_NO_MATCHES ); |
|
192 if ( iControl ) |
|
193 { |
|
194 iControl->SetTextL( *text ); |
|
195 } |
|
196 CleanupStack::PopAndDestroy( text ); |
|
197 break; |
|
198 } |
|
199 case CPbk2NamesListControl::EStateNotReady: // FALLTHROUGH |
|
200 default: |
|
201 { |
|
202 if ( iControl ) |
|
203 { |
|
204 iControl->SetTextL( KNullDesC ); |
|
205 } |
|
206 break; |
|
207 } |
|
208 } |
|
209 } |
|
210 |
|
211 // ----------------------------------------------------------------------------- |
|
212 // CPsu2NameListViewBase::HandleStatusPaneSizeChange |
|
213 // ----------------------------------------------------------------------------- |
|
214 // |
|
215 void CPsu2NameListViewBase::HandleStatusPaneSizeChange() |
|
216 { |
|
217 // Resize the container to fill the client rectangle |
|
218 if (iContainer) |
|
219 { |
|
220 iContainer->SetRect(iExtensionView.ClientRect()); |
|
221 } |
|
222 } |
|
223 |
|
224 // ----------------------------------------------------------------------------- |
|
225 // CPsu2NameListViewBase::ViewStateLC |
|
226 // ----------------------------------------------------------------------------- |
|
227 // |
|
228 CPbk2ViewState* CPsu2NameListViewBase::ViewStateLC() const |
|
229 { |
|
230 CPbk2ViewState* state = NULL; |
|
231 if (iControl) |
|
232 { |
|
233 state = iControl->ControlStateL(); |
|
234 } |
|
235 |
|
236 CleanupStack::PushL(state); |
|
237 return state; |
|
238 } |
|
239 |
|
240 // ----------------------------------------------------------------------------- |
|
241 // CPsu2NameListViewBase::HandleCommandKeyL |
|
242 // ----------------------------------------------------------------------------- |
|
243 // |
|
244 TBool CPsu2NameListViewBase::HandleCommandKeyL(const TKeyEvent& aKeyEvent, |
|
245 TEventCode aType) |
|
246 { |
|
247 // Update selection modifier key state |
|
248 iSelectionModifierUsed = IsShiftOrControlDown( aKeyEvent ) || |
|
249 ( (aType == EEventKeyDown) && (aKeyEvent.iCode == EStdKeyHash) ); |
|
250 |
|
251 return EFalse; |
|
252 } |
|
253 |
|
254 // ----------------------------------------------------------------------------- |
|
255 // CPsu2NameListViewBase::HandlePointerEventL |
|
256 // ----------------------------------------------------------------------------- |
|
257 // |
|
258 void CPsu2NameListViewBase::HandlePointerEventL( |
|
259 const TPointerEvent& /*aPointerEvent*/ ) |
|
260 { |
|
261 // Do nothing |
|
262 } |
|
263 |
|
264 // ----------------------------------------------------------------------------- |
|
265 // CPsu2NameListViewBase::GetViewSpecificMenuFilteringFlagsL |
|
266 // ----------------------------------------------------------------------------- |
|
267 // |
|
268 TInt CPsu2NameListViewBase::GetViewSpecificMenuFilteringFlagsL() const |
|
269 { |
|
270 TInt flags = 0; |
|
271 if ( iControl ) |
|
272 { |
|
273 flags = iControl->GetMenuFilteringFlagsL(); |
|
274 const MVPbkViewContact* contact = iControl->FocusedViewContactL(); |
|
275 if( contact && contact->Expandable() ) |
|
276 { |
|
277 flags |= KPbk2FocusedItemIsExpandable; |
|
278 } |
|
279 } |
|
280 |
|
281 return flags; |
|
282 } |
|
283 |
|
284 // ----------------------------------------------------------------------------- |
|
285 // CPsu2NameListViewBase::DoActivateL |
|
286 // ----------------------------------------------------------------------------- |
|
287 // |
|
288 void CPsu2NameListViewBase::DoActivateL(const TVwsViewId& aPrevViewId, |
|
289 TUid /*aCustomMessageId*/, const TDesC8& /*aCustomMessage*/) |
|
290 { |
|
291 MPbk2ApplicationServices& appServices = |
|
292 Phonebook2::Pbk2AppUi()->ApplicationServices(); |
|
293 |
|
294 iSortOrderManager = CPbk2SortOrderManager::NewL |
|
295 ( appServices.ContactManager().FieldTypes() ); |
|
296 |
|
297 HBufC* unnamedBuf = StringLoader::LoadLC( R_QTN_PHOB_UNNAMED ); |
|
298 |
|
299 TResourceReader reader; |
|
300 CCoeEnv::Static()->CreateResourceReaderLC( reader, |
|
301 R_PSU2_FDN_TITLE_FIELD_SELECTOR); |
|
302 iNameFormatter = Pbk2ContactNameFormatterFactory::CreateL |
|
303 ( appServices.ContactManager().FieldTypes(), |
|
304 *iSortOrderManager, |
|
305 reader, |
|
306 unnamedBuf, |
|
307 &appServices.ContactManager().FsSession() ); |
|
308 CleanupStack::PopAndDestroy(); // reader |
|
309 CleanupStack::PopAndDestroy( unnamedBuf ); |
|
310 iSortOrderManager->SetContactViewL( iViewManager.CurrentSimView() ); |
|
311 |
|
312 // Add this view to observe command events |
|
313 appServices.CommandHandlerL()->AddMenuCommandObserver(*this); |
|
314 |
|
315 CreateControlsL(); |
|
316 iContainer->ActivateL(); |
|
317 UpdateListEmptyTextL( CPbk2NamesListControl::EStateNotReady ); |
|
318 if( aPrevViewId.iViewUid != TUid::Uid( EPsu2FixedDialingInfoViewId ) ) |
|
319 { |
|
320 // Clean up the old view control state |
|
321 // so that it will be a brand new control |
|
322 // when the FD view is activated from non-fix dialling area |
|
323 delete iControlState; |
|
324 iControlState = NULL; |
|
325 iFocusIndex = KErrNotFound; |
|
326 } |
|
327 iViewManager.CurrentSimView().AddObserverL(*iControl); |
|
328 iViewManager.RegisterStoreAndView(); |
|
329 } |
|
330 |
|
331 // ----------------------------------------------------------------------------- |
|
332 // CPsu2NameListViewBase::DoDeactivate |
|
333 // ----------------------------------------------------------------------------- |
|
334 // |
|
335 void CPsu2NameListViewBase::DoDeactivate() |
|
336 { |
|
337 delete iNameFormatter; |
|
338 iNameFormatter = NULL; |
|
339 delete iSortOrderManager; |
|
340 iSortOrderManager = NULL; |
|
341 |
|
342 TRAP_IGNORE( |
|
343 Phonebook2::Pbk2AppUi()->ApplicationServices().CommandHandlerL()-> |
|
344 RemoveMenuCommandObserver(*this) ); |
|
345 |
|
346 delete iControlState; |
|
347 iControlState = NULL; |
|
348 |
|
349 if (iContainer) |
|
350 { |
|
351 iViewManager.CurrentSimView().RemoveObserver(*iControl); |
|
352 CCoeEnv::Static()->AppUi()->RemoveFromStack(iContainer); |
|
353 // Store current state, safe to ignore. There's no real harm, |
|
354 // if theres no stored state when activating this view again |
|
355 TRAP_IGNORE(StoreStateL()); |
|
356 delete iContainer; |
|
357 iContainer = NULL; |
|
358 // iControl is owned by iContainer it is deleted with container |
|
359 iControl = NULL; |
|
360 } |
|
361 |
|
362 iViewManager.DeregisterStoreAndView(); |
|
363 } |
|
364 |
|
365 // ----------------------------------------------------------------------------- |
|
366 // CPsu2NameListViewBase::HandleCommandL |
|
367 // ----------------------------------------------------------------------------- |
|
368 // |
|
369 void CPsu2NameListViewBase::HandleCommandL(TInt aCommand) |
|
370 { |
|
371 if ( aCommand == EPbk2CmdExit || aCommand == EAknSoftkeyBack |
|
372 || aCommand == EPbk2CmdOpenPreviousView || aCommand == EAknCmdHideInBackground ) |
|
373 { |
|
374 // Initialize this view control state |
|
375 delete iControlState; |
|
376 iControlState = NULL; |
|
377 iControlState = CPbk2ViewState::NewL(); |
|
378 iControlState->SetFlags( CPbk2ViewState::EInitialized ); |
|
379 iFocusIndex = KErrNotFound; |
|
380 RestoreStateL(); |
|
381 } |
|
382 |
|
383 if ( iControl ) |
|
384 { |
|
385 // No command handling in this class, forward to Commands |
|
386 if ( !Phonebook2::Pbk2AppUi()->ApplicationServices(). |
|
387 CommandHandlerL()->HandleCommandL |
|
388 (aCommand, *iControl, &iExtensionView)) |
|
389 { |
|
390 iControl->ProcessCommandL(aCommand); |
|
391 Phonebook2::Pbk2AppUi()->HandleCommandL(aCommand); |
|
392 // Update cbas, if command handler is consuming the command |
|
393 // postcommandexecution is updating cbas |
|
394 UpdateCbasL(); |
|
395 } |
|
396 } |
|
397 } |
|
398 |
|
399 // ----------------------------------------------------------------------------- |
|
400 // CPsu2NameListViewBase::DynInitMenuPaneL |
|
401 // ----------------------------------------------------------------------------- |
|
402 // |
|
403 void CPsu2NameListViewBase::DynInitMenuPaneL(TInt aResourceId, |
|
404 CEikMenuPane* aMenuPane) |
|
405 { |
|
406 if ( iControl ) |
|
407 { |
|
408 // Ask the control do control specific filtering |
|
409 // (for example call HandleMarkableListDynInitMenuPane if needed) |
|
410 iControl->DynInitMenuPaneL(aResourceId, aMenuPane); |
|
411 |
|
412 // Phonebook 2 menu filtering happens in Commands |
|
413 Phonebook2::Pbk2AppUi()->ApplicationServices(). |
|
414 CommandHandlerL()->DynInitMenuPaneL |
|
415 ( aResourceId, aMenuPane, iExtensionView, *iControl ); |
|
416 } |
|
417 } |
|
418 |
|
419 // ----------------------------------------------------------------------------- |
|
420 // CPsu2NameListViewBase::HandleLongTapEventL |
|
421 // ----------------------------------------------------------------------------- |
|
422 // |
|
423 void CPsu2NameListViewBase::HandleLongTapEventL( |
|
424 const TPoint& /*aPenEventLocation*/, |
|
425 const TPoint& /*aPenEventScreenLocation*/) |
|
426 { |
|
427 // Do nothing |
|
428 } |
|
429 |
|
430 // ----------------------------------------------------------------------------- |
|
431 // CPsu2NameListViewBase::HandleControlEventL |
|
432 // ----------------------------------------------------------------------------- |
|
433 // |
|
434 void CPsu2NameListViewBase::HandleControlEventL( |
|
435 MPbk2ContactUiControl& /*aControl*/, |
|
436 const TPbk2ControlEvent& aEvent) |
|
437 { |
|
438 switch (aEvent.iEventType) |
|
439 { |
|
440 case TPbk2ControlEvent::EReady: |
|
441 { |
|
442 UpdateCbasL(); |
|
443 UpdateListEmptyTextL( aEvent.iInt ); |
|
444 // Restore control state |
|
445 RestoreStateL(); |
|
446 break; |
|
447 } |
|
448 |
|
449 case TPbk2ControlEvent::EContactSetChanged: |
|
450 { |
|
451 if ( iControl ) |
|
452 { |
|
453 iControl->DrawNow(); |
|
454 } |
|
455 break; |
|
456 } |
|
457 |
|
458 case TPbk2ControlEvent::EControlStateChanged: // FALLTHROUGH |
|
459 case TPbk2ControlEvent::EContactSelected: // FALLTHROUGH |
|
460 case TPbk2ControlEvent::EContactUnselected: // FALLTHROUGH |
|
461 case TPbk2ControlEvent::EContactUnselectedAll: // FALLTHROUGH |
|
462 case TPbk2ControlEvent::EItemRemoved: |
|
463 { |
|
464 UpdateCbasL(); |
|
465 UpdateListEmptyTextL( aEvent.iInt ); |
|
466 if ( iControl ) |
|
467 { |
|
468 iControl->DrawDeferred(); |
|
469 } |
|
470 break; |
|
471 } |
|
472 |
|
473 default: |
|
474 { |
|
475 // Do nothing |
|
476 break; |
|
477 } |
|
478 } |
|
479 } |
|
480 |
|
481 // -------------------------------------------------------------------------- |
|
482 // CPsu2NameListViewBase::PreCommandExecutionL |
|
483 // -------------------------------------------------------------------------- |
|
484 // |
|
485 void CPsu2NameListViewBase::PreCommandExecutionL |
|
486 ( const MPbk2Command& /*aCommand*/ ) |
|
487 { |
|
488 iCommandBetweenPreAndPostExecution = ETrue; |
|
489 } |
|
490 |
|
491 // -------------------------------------------------------------------------- |
|
492 // CPsu2NameListViewBase::PostCommandExecutionL |
|
493 // -------------------------------------------------------------------------- |
|
494 // |
|
495 void CPsu2NameListViewBase::PostCommandExecutionL |
|
496 ( const MPbk2Command& /*aCommand*/ ) |
|
497 { |
|
498 iCommandBetweenPreAndPostExecution = EFalse; |
|
499 UpdateCbasL(); |
|
500 } |
|
501 |
|
502 // ----------------------------------------------------------------------------- |
|
503 // CPsu2NameListViewBase::CreateControlsL |
|
504 // ----------------------------------------------------------------------------- |
|
505 // |
|
506 void CPsu2NameListViewBase::CreateControlsL() |
|
507 { |
|
508 if (!iContainer) |
|
509 { |
|
510 // Create the container and control |
|
511 CContainer* container = CContainer::NewLC( |
|
512 &iExtensionView, |
|
513 &iExtensionView, |
|
514 iExtensionView); |
|
515 |
|
516 container->SetHelpContext( |
|
517 TCoeHelpContext( iExtensionView.ApplicationUid(), |
|
518 KPHOB_HLP_NAME_LIST )); |
|
519 |
|
520 CPbk2NamesListControl* control = CPbk2NamesListControl::NewL( |
|
521 NameListControlResourceId(), container, |
|
522 Phonebook2::Pbk2AppUi()->ApplicationServices(). |
|
523 ContactManager(), |
|
524 iViewManager.CurrentSimView(), |
|
525 *iNameFormatter, |
|
526 Phonebook2::Pbk2AppUi()->ApplicationServices(). |
|
527 StoreProperties() ); |
|
528 CleanupStack::PushL(control); |
|
529 control->AddObserverL(*this); |
|
530 |
|
531 // takes ownership of the control |
|
532 container->SetControl(control, iExtensionView.ClientRect()); |
|
533 CleanupStack::Pop(control); |
|
534 |
|
535 CCoeEnv::Static()->AppUi()->AddToStackL(iExtensionView, container); |
|
536 CleanupStack::Pop(container); |
|
537 iContainer = container; |
|
538 iControl = control; |
|
539 iPointerEventInspector = control; |
|
540 } |
|
541 } |
|
542 |
|
543 // ----------------------------------------------------------------------------- |
|
544 // CPsu2NameListViewBase::StoreStateL |
|
545 // ----------------------------------------------------------------------------- |
|
546 // |
|
547 void CPsu2NameListViewBase::StoreStateL() |
|
548 { |
|
549 CPbk2ViewState* state = NULL; |
|
550 if ( iControl ) |
|
551 { |
|
552 state = iControl->ControlStateL(); |
|
553 } |
|
554 |
|
555 if ( state ) |
|
556 { |
|
557 delete iControlState; |
|
558 iControlState = state; |
|
559 } |
|
560 if ( iControl ) |
|
561 { |
|
562 // If contact is deleted in other view |
|
563 // this will keep focus correct |
|
564 iFocusIndex = iControl->FocusedContactIndex(); |
|
565 } |
|
566 } |
|
567 |
|
568 // ----------------------------------------------------------------------------- |
|
569 // CPsu2NameListViewBase::RestoreStateL |
|
570 // ----------------------------------------------------------------------------- |
|
571 // |
|
572 void CPsu2NameListViewBase::RestoreStateL() |
|
573 { |
|
574 if ( iControl ) |
|
575 { |
|
576 iControl->RestoreControlStateL(iControlState); |
|
577 } |
|
578 |
|
579 if ( iFocusIndex != KErrNotFound && iControlState ) |
|
580 { |
|
581 // If contact has been deleted in other view |
|
582 // this will keep focus correct |
|
583 if ( iControlState->FocusedContact() ) |
|
584 { |
|
585 TInt indexOfContact( |
|
586 iViewManager.CurrentSimView().IndexOfLinkL( |
|
587 *iControlState->FocusedContact() ) ); |
|
588 if ( iControl && indexOfContact == KErrNotFound ) |
|
589 { |
|
590 iControl->SetFocusedContactIndexL( iFocusIndex ); |
|
591 } |
|
592 } |
|
593 } |
|
594 delete iControlState; |
|
595 iControlState = NULL; |
|
596 } |
|
597 |
|
598 // End of File |