40 #include <Pbk2Commands.hrh> |
40 #include <Pbk2Commands.hrh> |
41 #include <Pbk2InternalUID.h> |
41 #include <Pbk2InternalUID.h> |
42 #include "CPbk2PredictiveSearchFilter.h" |
42 #include "CPbk2PredictiveSearchFilter.h" |
43 #include "cpbk2contactviewdoublelistbox.h" |
43 #include "cpbk2contactviewdoublelistbox.h" |
44 #include <CPbk2ThumbnailManager.h> |
44 #include <CPbk2ThumbnailManager.h> |
45 #include <pbk2commonui.rsg> |
45 #include <Pbk2CommonUi.rsg> |
46 #include <pbk2uicontrols.rsg> |
46 #include <Pbk2UIControls.rsg> |
47 #include "CPbk2AppUi.h" |
47 #include "CPbk2AppUi.h" |
48 |
48 |
49 // Virtual Phonebook |
49 // Virtual Phonebook |
50 #include <MVPbkContactViewBase.h> |
50 #include <MVPbkContactViewBase.h> |
51 #include <MVPbkViewContact.h> |
51 #include <MVPbkViewContact.h> |
329 */ |
329 */ |
330 TBool MassUpdateDetected(); |
330 TBool MassUpdateDetected(); |
331 |
331 |
332 /** |
332 /** |
333 * Call this function to skip the showing of blocking progress note. |
333 * Call this function to skip the showing of blocking progress note. |
334 * When done MassUpdateSkipProgressNote( EFalse ) must be called to reset. |
334 * When done MassUpdateSkipProgressNote( EFalse ) must be called to reset. |
335 */ |
335 */ |
336 void MassUpdateSkipProgressNote( TBool aSkip ); |
336 void MassUpdateSkipProgressNote( TBool aSkip ); |
337 |
337 |
338 private: |
338 private: |
339 CPbk2HandleMassUpdate(CEikListBox& iListBox); |
339 CPbk2HandleMassUpdate(CEikListBox& iListBox); |
345 void HandleMassUpdateResetCounters(); |
345 void HandleMassUpdateResetCounters(); |
346 void HandleMassUpdateDone(); |
346 void HandleMassUpdateDone(); |
347 static TInt HandleMassUpdateTimerCallBack(TAny* aAny); |
347 static TInt HandleMassUpdateTimerCallBack(TAny* aAny); |
348 |
348 |
349 private: |
349 private: |
350 CEikListBox& iListBox; |
350 CEikListBox& iListBox; |
351 TBool iHandleMassUpdateDetected; |
351 TBool iHandleMassUpdateDetected; |
352 TTime iHandleMassUpdateFirst; |
352 TTime iHandleMassUpdateFirst; |
353 TTime iHandleMassUpdatePrev; |
353 TTime iHandleMassUpdatePrev; |
354 TInt iHandleMassUpdateCount; |
354 TInt iHandleMassUpdateCount; |
355 TBool iHandleMassUpdateSkipDialog; |
355 TBool iHandleMassUpdateSkipDialog; |
356 CPeriodic* iHandleMassUpdateTimer; |
356 CPeriodic* iHandleMassUpdateTimer; |
357 CAknWaitDialog* iHandleMassUpdateDialog; |
357 CAknWaitDialog* iHandleMassUpdateDialog; |
358 }; |
358 }; |
359 |
359 |
360 // -------------------------------------------------------------------------- |
360 // -------------------------------------------------------------------------- |
361 // CPbk2UiControlEventSender::CPbk2UiControlEventSender |
361 // CPbk2UiControlEventSender::CPbk2UiControlEventSender |
362 // -------------------------------------------------------------------------- |
362 // -------------------------------------------------------------------------- |
712 // CPbk2HandleMassUpdate::MassUpdateDetected |
712 // CPbk2HandleMassUpdate::MassUpdateDetected |
713 // -------------------------------------------------------------------------- |
713 // -------------------------------------------------------------------------- |
714 // |
714 // |
715 TBool CPbk2HandleMassUpdate::MassUpdateDetected() |
715 TBool CPbk2HandleMassUpdate::MassUpdateDetected() |
716 { |
716 { |
717 return iHandleMassUpdateDetected; |
717 return iHandleMassUpdateDetected; |
718 } |
718 } |
719 |
719 |
720 // -------------------------------------------------------------------------- |
720 // -------------------------------------------------------------------------- |
721 // CPbk2HandleMassUpdate::MassUpdateSkipProgressNote |
721 // CPbk2HandleMassUpdate::MassUpdateSkipProgressNote |
722 // -------------------------------------------------------------------------- |
722 // -------------------------------------------------------------------------- |
723 // |
723 // |
875 iBaseView( &aView ), |
875 iBaseView( &aView ), |
876 iContainer( aContainer ), |
876 iContainer( aContainer ), |
877 iNameFormatter( aNameFormatter ), |
877 iNameFormatter( aNameFormatter ), |
878 iStoreProperties( aStoreProperties ), |
878 iStoreProperties( aStoreProperties ), |
879 iAllowPointerEvents( ETrue ), |
879 iAllowPointerEvents( ETrue ), |
880 iOpeningCca( EFalse ), |
880 iOpeningCca( EFalse ) |
881 iMarkingModeOn( EFalse ) |
|
882 { |
881 { |
883 } |
882 } |
884 |
883 |
885 // -------------------------------------------------------------------------- |
884 // -------------------------------------------------------------------------- |
886 // CPbk2NamesListControl::CPbk2NamesListControl |
885 // CPbk2NamesListControl::CPbk2NamesListControl |
934 // inform the command that the control is deleted |
933 // inform the command that the control is deleted |
935 iCommand->ResetUiControl(*this); |
934 iCommand->ResetUiControl(*this); |
936 } |
935 } |
937 iObservers.Reset(); |
936 iObservers.Reset(); |
938 iCommandItems.ResetAndDestroy(); |
937 iCommandItems.ResetAndDestroy(); |
939 delete iCheckMassUpdate; |
938 delete iCheckMassUpdate; |
940 delete iListBoxSelectionObserver; |
939 delete iListBoxSelectionObserver; |
941 delete iStateFactory; |
940 delete iStateFactory; |
942 delete iListBox; |
941 delete iListBox; |
943 delete iFindBox; |
942 delete iFindBox; |
944 delete iThumbnailLoader; |
943 delete iThumbnailLoader; |
1110 } |
1109 } |
1111 |
1110 |
1112 iListBox->SetObserver( this ); |
1111 iListBox->SetObserver( this ); |
1113 iListBox->SetScrollEventObserver( this ); |
1112 iListBox->SetScrollEventObserver( this ); |
1114 iListBox->SetListBoxObserver(this); |
1113 iListBox->SetListBoxObserver(this); |
1115 |
|
1116 iListBox->SetMarkingModeObserver( this ); |
|
1117 |
|
1118 iUiExtension->SetContactUiControlUpdate( this ); |
1114 iUiExtension->SetContactUiControlUpdate( this ); |
1119 // set command item updater |
1115 // set command item updater |
1120 TAny* ext = iUiExtension->ContactUiControlExtensionExtension( |
1116 TAny* ext = iUiExtension->ContactUiControlExtensionExtension( |
1121 TUid::Uid( KPbk2ContactUiControlExtensionExtensionUID ) ); |
1117 TUid::Uid( KPbk2ContactUiControlExtensionExtensionUID ) ); |
1122 if( ext ) |
1118 if( ext ) |
1203 EXPORT_C void CPbk2NamesListControl::Reset() |
1199 EXPORT_C void CPbk2NamesListControl::Reset() |
1204 { |
1200 { |
1205 PBK2_DEBUG_PRINT(PBK2_DEBUG_STRING("CPbk2NamesListControl::Reset(0x%x) - IN"), |
1201 PBK2_DEBUG_PRINT(PBK2_DEBUG_STRING("CPbk2NamesListControl::Reset(0x%x) - IN"), |
1206 this ); |
1202 this ); |
1207 |
1203 |
|
1204 // Unmark all contacts and reset the toolbar so that the Call button |
|
1205 // won't be dimmed |
|
1206 TRAP_IGNORE( ProcessCommandL( EAknUnmarkAll ) ); |
1208 // Reset find box |
1207 // Reset find box |
1209 TRAP_IGNORE( ResetFindL() ); |
1208 TRAP_IGNORE( ResetFindL() ); |
1210 // Destroy all the filtered views from the stack |
1209 // Destroy all the filtered views from the stack |
1211 iViewStack->Reset(); |
1210 iViewStack->Reset(); |
1212 // Refresh observer to get the view state |
1211 // Refresh observer to get the view state |
1219 const TInt firstContactIndex = 0; |
1218 const TInt firstContactIndex = 0; |
1220 // Best effort: try to reset the focus. |
1219 // Best effort: try to reset the focus. |
1221 TRAP_IGNORE( iCurrentState->SetFocusedContactIndexL( firstContactIndex ) ); |
1220 TRAP_IGNORE( iCurrentState->SetFocusedContactIndexL( firstContactIndex ) ); |
1222 //scroll listbox into beginning (ignore focus that may be below promotion items) |
1221 //scroll listbox into beginning (ignore focus that may be below promotion items) |
1223 iListBox->SetTopItemIndex(firstContactIndex); |
1222 iListBox->SetTopItemIndex(firstContactIndex); |
1224 |
|
1225 //cancel the marking mode |
|
1226 iListBox->SetMarkingMode( EFalse ); |
|
1227 |
1223 |
1228 // Switch to the background state. This enables the next state to avtivate fully (ActivateStateL()) once phonebook |
1224 // Switch to the background state. This enables the next state to avtivate fully (ActivateStateL()) once phonebook |
1229 // comes from the background. |
1225 // comes from the background. |
1230 TRAP_IGNORE( iCurrentState = &iStateFactory->ActivateHiddenStateL( iCurrentState ); ); |
1226 TRAP_IGNORE( iCurrentState = &iStateFactory->ActivateHiddenStateL( iCurrentState ); ); |
1231 |
1227 |
1439 // -------------------------------------------------------------------------- |
1435 // -------------------------------------------------------------------------- |
1440 // |
1436 // |
1441 void CPbk2NamesListControl::SizeChanged() |
1437 void CPbk2NamesListControl::SizeChanged() |
1442 { |
1438 { |
1443 iCurrentState->SizeChanged(); |
1439 iCurrentState->SizeChanged(); |
1444 // Reset the popup char flag so that the char will not be shown. |
|
1445 iListBox->ResetShowPopupChar(); |
|
1446 } |
1440 } |
1447 |
1441 |
1448 // -------------------------------------------------------------------------- |
1442 // -------------------------------------------------------------------------- |
1449 // CPbk2NamesListControl::Draw |
1443 // CPbk2NamesListControl::Draw |
1450 // -------------------------------------------------------------------------- |
1444 // -------------------------------------------------------------------------- |
1491 void CPbk2NamesListControl::HandlePointerEventL( |
1485 void CPbk2NamesListControl::HandlePointerEventL( |
1492 const TPointerEvent& aPointerEvent ) |
1486 const TPointerEvent& aPointerEvent ) |
1493 { |
1487 { |
1494 if( !iAllowPointerEvents ) |
1488 if( !iAllowPointerEvents ) |
1495 { |
1489 { |
1496 //Passing event to listbox needed even if iCurrentState would be skipped (fix for ou1cimx1#316139) |
1490 //Passing event to listbox needed even if iCurrentState would be skipped (fix for ou1cimx1#316139) |
1497 iListBox->HandlePointerEventL( aPointerEvent ); |
1491 iListBox->HandlePointerEventL( aPointerEvent ); |
1498 return; |
1492 return; |
1499 } |
1493 } |
1500 if ( AknLayoutUtils::PenEnabled() ) |
1494 if ( AknLayoutUtils::PenEnabled() ) |
1501 { |
1495 { |
1689 // -------------------------------------------------------------------------- |
1683 // -------------------------------------------------------------------------- |
1690 // |
1684 // |
1691 void CPbk2NamesListControl::ClearMarks() |
1685 void CPbk2NamesListControl::ClearMarks() |
1692 { |
1686 { |
1693 iCurrentState->ClearMarks(); |
1687 iCurrentState->ClearMarks(); |
1694 ClearMarkedContactsInfo(); |
1688 ClearMarkedContactsInfo(); |
1695 } |
1689 } |
1696 |
1690 |
1697 // -------------------------------------------------------------------------- |
1691 // -------------------------------------------------------------------------- |
1698 // CPbk2NamesListControl::SetSelectedContactL |
1692 // CPbk2NamesListControl::SetSelectedContactL |
1699 // -------------------------------------------------------------------------- |
1693 // -------------------------------------------------------------------------- |
2093 // -------------------------------------------------------------------------- |
2087 // -------------------------------------------------------------------------- |
2094 // CPbk2NamesListControl::FilteredContactRemovedFromView |
2088 // CPbk2NamesListControl::FilteredContactRemovedFromView |
2095 // -------------------------------------------------------------------------- |
2089 // -------------------------------------------------------------------------- |
2096 // |
2090 // |
2097 void CPbk2NamesListControl::FilteredContactRemovedFromView( |
2091 void CPbk2NamesListControl::FilteredContactRemovedFromView( |
2098 MVPbkContactViewBase& /*aView*/ ) |
2092 MVPbkContactViewBase& /*aView*/ ) |
2099 { |
2093 { |
2100 DrawDeferred(); |
2094 DrawDeferred(); |
2101 } |
2095 } |
2102 |
2096 |
2103 // -------------------------------------------------------------------------- |
2097 // -------------------------------------------------------------------------- |
2251 // CPbk2NamesListControl::DoContactAddedToBaseView |
2245 // CPbk2NamesListControl::DoContactAddedToBaseView |
2252 // -------------------------------------------------------------------------- |
2246 // -------------------------------------------------------------------------- |
2253 // |
2247 // |
2254 void CPbk2NamesListControl::DoHandleContactAdditionL( TInt aIndex ) |
2248 void CPbk2NamesListControl::DoHandleContactAdditionL( TInt aIndex ) |
2255 { |
2249 { |
2256 //Prevent messing with focus with always-on when Phonebook hidden in |
2250 //Prevent messing with focus with always-on when Phonebook hidden in |
2257 //reseted state. Otherwise background-added contacts will change focus. |
2251 //reseted state. Otherwise background-added contacts will change focus. |
2258 //This would cause Phonebook not to look like freshly started when opened again. |
2252 //This would cause Phonebook not to look like freshly started when opened again. |
2259 //And also make sure foreground-added contact will show the new contact |
2253 //And also make sure foreground-added contact will show the new contact |
2260 //even though the focus is not seen. |
2254 //even though the focus is not seen. |
2261 if( (static_cast<CPbk2AppUi*>( |
2255 if( (static_cast<CPbk2AppUi*>( |
2262 CEikonEnv::Static()->AppUi()))->IsForeground() ) |
2256 CEikonEnv::Static()->AppUi()))->IsForeground() ) |
2263 { |
2257 { |
2264 SelectAndChangeReadyStateL(); |
2258 SelectAndChangeReadyStateL(); |
2265 } |
2259 } |
2408 // result (subset of contacts) of the previous find criteria must be |
2402 // result (subset of contacts) of the previous find criteria must be |
2409 // reset too. So, we reset both the find box and the view stack. |
2403 // reset too. So, we reset both the find box and the view stack. |
2410 TRAPD( res, |
2404 TRAPD( res, |
2411 { |
2405 { |
2412 // This will reset back to base view, however retain original view |
2406 // This will reset back to base view, however retain original view |
2413 //when opening CCA |
2407 //when opening CCA |
2414 if( !iOpeningCca ) |
2408 if( !iOpeningCca ) |
2415 { |
2409 { |
2416 iCurrentState->ResetFindL(); |
2410 iCurrentState->ResetFindL(); |
2417 } |
2411 } |
2418 }); |
2412 }); |
2427 // flag to avoid this reset of ui control. |
2421 // flag to avoid this reset of ui control. |
2428 if( iOpeningCca ) |
2422 if( iOpeningCca ) |
2429 { |
2423 { |
2430 if( iCurrentState->NamesListState() == EStateEmpty ) |
2424 if( iCurrentState->NamesListState() == EStateEmpty ) |
2431 { |
2425 { |
2432 // Trap the function because it may leave. |
2426 SelectAndChangeReadyStateL(); |
2433 TRAPD( res, SelectAndChangeReadyStateL() ); |
|
2434 HandleError( res ); |
|
2435 } |
2427 } |
2436 } |
2428 } |
2437 else |
2429 else |
2438 { |
2430 { |
2439 if( !iMarkingModeOn ) |
2431 Reset(); |
2440 { |
2432 } |
2441 Reset(); |
|
2442 } |
|
2443 } |
|
2444 } |
2433 } |
2445 |
2434 |
2446 // Do not handle contact addition here (DoHandleContactAdditionL), |
2435 // Do not handle contact addition here (DoHandleContactAdditionL), |
2447 // ContactAddedToView to notification is sent separately |
2436 // ContactAddedToView to notification is sent separately |
2448 } |
2437 } |
2551 //send event to current state |
2540 //send event to current state |
2552 //ETrue means that the event came from adaptvie search grid. |
2541 //ETrue means that the event came from adaptvie search grid. |
2553 TRAP_IGNORE(iCurrentState->HandleControlEventL( aSearchField, MCoeControlObserver::EEventStateChanged, ETrue)); |
2542 TRAP_IGNORE(iCurrentState->HandleControlEventL( aSearchField, MCoeControlObserver::EEventStateChanged, ETrue)); |
2554 } |
2543 } |
2555 |
2544 |
2556 |
|
2557 // ----------------------------------------------------------------------------- |
|
2558 // CPbk2NamesListControl::MarkingModeStatusChanged |
|
2559 // ----------------------------------------------------------------------------- |
|
2560 // |
|
2561 void CPbk2NamesListControl::MarkingModeStatusChanged( TBool /*aActivated*/ ) |
|
2562 { |
|
2563 } |
|
2564 |
|
2565 // ----------------------------------------------------------------------------- |
|
2566 // CPbk2NamesListControl::ExitMarkingMode |
|
2567 // Called by avkon, if the return value is ETrue, |
|
2568 // the Marking mode will be canceled after any operation, |
|
2569 // otherwise the Marking mode keep active. |
|
2570 // ----------------------------------------------------------------------------- |
|
2571 // |
|
2572 TBool CPbk2NamesListControl::ExitMarkingMode() const |
|
2573 { |
|
2574 return ETrue; |
|
2575 } |
|
2576 |
|
2577 // -------------------------------------------------------------------------- |
2545 // -------------------------------------------------------------------------- |
2578 // CPbk2NamesListControl::HandleForegroundEventL |
2546 // CPbk2NamesListControl::HandleForegroundEventL |
|
2547 // |
2579 // -------------------------------------------------------------------------- |
2548 // -------------------------------------------------------------------------- |
2580 // |
2549 // |
2581 void CPbk2NamesListControl::HandleForegroundEventL(TBool aForeground) |
2550 void CPbk2NamesListControl::HandleForegroundEventL(TBool aForeground) |
2582 { |
2551 { |
2583 if ( iSearchFilter ) |
2552 if ( iSearchFilter ) |
2657 // --------------------------------------------------------------------------- |
2626 // --------------------------------------------------------------------------- |
2658 // CPbk2NamesListControl::SetOpeningCca |
2627 // CPbk2NamesListControl::SetOpeningCca |
2659 // --------------------------------------------------------------------------- |
2628 // --------------------------------------------------------------------------- |
2660 // |
2629 // |
2661 EXPORT_C void CPbk2NamesListControl::SetOpeningCca( TBool aIsOpening ) |
2630 EXPORT_C void CPbk2NamesListControl::SetOpeningCca( TBool aIsOpening ) |
2662 { |
2631 { |
2663 iOpeningCca = aIsOpening; |
2632 iOpeningCca = aIsOpening; |
2664 } |
2633 } |
2665 |
2634 |
2666 // --------------------------------------------------------------------------- |
2635 // --------------------------------------------------------------------------- |
2667 // CPbk2NamesListControlBgTask::CPbk2NamesListControlBgTask |
2636 // CPbk2NamesListControlBgTask::CPbk2NamesListControlBgTask |
2668 // --------------------------------------------------------------------------- |
2637 // --------------------------------------------------------------------------- |
2669 // |
2638 // |