phonebookui/Phonebook2/UIControls/src/CPbk2NamesListControl.cpp
branchRCL_3
changeset 58 d4f567ce2e7c
parent 32 2828b4d142c0
child 64 c1e8ba0c2b16
equal deleted inserted replaced
57:2666d9724c76 58:d4f567ce2e7c
   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 )
   881     {
   882     {
   882     }
   883     }
   883 
   884 
   884 // --------------------------------------------------------------------------
   885 // --------------------------------------------------------------------------
   885 // CPbk2NamesListControl::CPbk2NamesListControl
   886 // CPbk2NamesListControl::CPbk2NamesListControl
   933         // inform the command that the control is deleted
   934         // inform the command that the control is deleted
   934         iCommand->ResetUiControl(*this);
   935         iCommand->ResetUiControl(*this);
   935         }
   936         }
   936     iObservers.Reset();
   937     iObservers.Reset();
   937     iCommandItems.ResetAndDestroy();
   938     iCommandItems.ResetAndDestroy();
   938 	delete iCheckMassUpdate;
   939     delete iCheckMassUpdate;
   939     delete iListBoxSelectionObserver;
   940     delete iListBoxSelectionObserver;
   940     delete iStateFactory;
   941     delete iStateFactory;
   941     delete iListBox;
   942     delete iListBox;
   942     delete iFindBox;
   943     delete iFindBox;
   943     delete iThumbnailLoader;
   944     delete iThumbnailLoader;
  1109         }
  1110         }
  1110 
  1111 
  1111     iListBox->SetObserver( this );
  1112     iListBox->SetObserver( this );
  1112     iListBox->SetScrollEventObserver( this );
  1113     iListBox->SetScrollEventObserver( this );
  1113     iListBox->SetListBoxObserver(this);
  1114     iListBox->SetListBoxObserver(this);
       
  1115     
       
  1116     iListBox->SetMarkingModeObserver( this );
       
  1117     
  1114     iUiExtension->SetContactUiControlUpdate( this );
  1118     iUiExtension->SetContactUiControlUpdate( this );
  1115     // set command item updater
  1119     // set command item updater
  1116     TAny* ext = iUiExtension->ContactUiControlExtensionExtension(
  1120     TAny* ext = iUiExtension->ContactUiControlExtensionExtension(
  1117         TUid::Uid( KPbk2ContactUiControlExtensionExtensionUID ) );
  1121         TUid::Uid( KPbk2ContactUiControlExtensionExtensionUID ) );
  1118     if( ext )
  1122     if( ext )
  1199 EXPORT_C void CPbk2NamesListControl::Reset()
  1203 EXPORT_C void CPbk2NamesListControl::Reset()
  1200     {
  1204     {
  1201     PBK2_DEBUG_PRINT(PBK2_DEBUG_STRING("CPbk2NamesListControl::Reset(0x%x) - IN"),
  1205     PBK2_DEBUG_PRINT(PBK2_DEBUG_STRING("CPbk2NamesListControl::Reset(0x%x) - IN"),
  1202         this );
  1206         this );
  1203 
  1207 
  1204     // Unmark all contacts and reset the toolbar so that the Call button
       
  1205     // won't be dimmed
       
  1206     TRAP_IGNORE( ProcessCommandL( EAknUnmarkAll ) );
       
  1207     // Reset find box
  1208     // Reset find box
  1208     TRAP_IGNORE( ResetFindL() );
  1209     TRAP_IGNORE( ResetFindL() );
  1209     // Destroy all the filtered views from the stack
  1210     // Destroy all the filtered views from the stack
  1210     iViewStack->Reset();
  1211     iViewStack->Reset();
  1211     // Refresh observer to get the view state
  1212     // Refresh observer to get the view state
  1218     const TInt firstContactIndex = 0;
  1219     const TInt firstContactIndex = 0;
  1219     // Best effort: try to reset the focus.
  1220     // Best effort: try to reset the focus.
  1220     TRAP_IGNORE( iCurrentState->SetFocusedContactIndexL( firstContactIndex ) );
  1221     TRAP_IGNORE( iCurrentState->SetFocusedContactIndexL( firstContactIndex ) );
  1221     //scroll listbox into beginning (ignore focus that may be below promotion items)
  1222     //scroll listbox into beginning (ignore focus that may be below promotion items)
  1222     iListBox->SetTopItemIndex(firstContactIndex);
  1223     iListBox->SetTopItemIndex(firstContactIndex);
       
  1224     
       
  1225     //cancel the marking mode
       
  1226     iListBox->SetMarkingMode( EFalse );
  1223 
  1227 
  1224     // Switch to the background state. This enables the next state to avtivate fully (ActivateStateL()) once phonebook
  1228     // Switch to the background state. This enables the next state to avtivate fully (ActivateStateL()) once phonebook
  1225     // comes from the background.
  1229     // comes from the background.
  1226     TRAP_IGNORE( iCurrentState = &iStateFactory->ActivateHiddenStateL( iCurrentState ); );
  1230     TRAP_IGNORE( iCurrentState = &iStateFactory->ActivateHiddenStateL( iCurrentState ); );
  1227 
  1231 
  1485 void CPbk2NamesListControl::HandlePointerEventL(
  1489 void CPbk2NamesListControl::HandlePointerEventL(
  1486     const TPointerEvent& aPointerEvent )
  1490     const TPointerEvent& aPointerEvent )
  1487     {
  1491     {
  1488     if( !iAllowPointerEvents )
  1492     if( !iAllowPointerEvents )
  1489         {
  1493         {
  1490 		//Passing event to listbox needed even if iCurrentState would be skipped (fix for ou1cimx1#316139)
  1494         //Passing event to listbox needed even if iCurrentState would be skipped (fix for ou1cimx1#316139)
  1491         iListBox->HandlePointerEventL( aPointerEvent ); 
  1495         iListBox->HandlePointerEventL( aPointerEvent ); 
  1492         return;
  1496         return;
  1493         }
  1497         }
  1494     if ( AknLayoutUtils::PenEnabled() )
  1498     if ( AknLayoutUtils::PenEnabled() )
  1495         {
  1499         {
  1683 // --------------------------------------------------------------------------
  1687 // --------------------------------------------------------------------------
  1684 //
  1688 //
  1685 void CPbk2NamesListControl::ClearMarks()
  1689 void CPbk2NamesListControl::ClearMarks()
  1686     {
  1690     {
  1687     iCurrentState->ClearMarks();
  1691     iCurrentState->ClearMarks();
  1688 	ClearMarkedContactsInfo();
  1692     ClearMarkedContactsInfo();
  1689     }
  1693     }
  1690 
  1694 
  1691 // --------------------------------------------------------------------------
  1695 // --------------------------------------------------------------------------
  1692 // CPbk2NamesListControl::SetSelectedContactL
  1696 // CPbk2NamesListControl::SetSelectedContactL
  1693 // --------------------------------------------------------------------------
  1697 // --------------------------------------------------------------------------
  2087 // --------------------------------------------------------------------------
  2091 // --------------------------------------------------------------------------
  2088 // CPbk2NamesListControl::FilteredContactRemovedFromView
  2092 // CPbk2NamesListControl::FilteredContactRemovedFromView
  2089 // --------------------------------------------------------------------------
  2093 // --------------------------------------------------------------------------
  2090 //
  2094 //
  2091 void CPbk2NamesListControl::FilteredContactRemovedFromView(
  2095 void CPbk2NamesListControl::FilteredContactRemovedFromView(
  2092 		MVPbkContactViewBase& /*aView*/ )
  2096         MVPbkContactViewBase& /*aView*/ )
  2093     {    
  2097     {    
  2094     DrawDeferred();
  2098     DrawDeferred();
  2095     }
  2099     }
  2096 
  2100 
  2097 // --------------------------------------------------------------------------
  2101 // --------------------------------------------------------------------------
  2245 //       CPbk2NamesListControl::DoContactAddedToBaseView
  2249 //       CPbk2NamesListControl::DoContactAddedToBaseView
  2246 // --------------------------------------------------------------------------
  2250 // --------------------------------------------------------------------------
  2247 //
  2251 //
  2248 void CPbk2NamesListControl::DoHandleContactAdditionL( TInt aIndex )
  2252 void CPbk2NamesListControl::DoHandleContactAdditionL( TInt aIndex )
  2249     {
  2253     {
  2250 	//Prevent messing with focus with always-on when Phonebook hidden in
  2254     //Prevent messing with focus with always-on when Phonebook hidden in
  2251 	//reseted state. Otherwise background-added contacts will change focus.
  2255     //reseted state. Otherwise background-added contacts will change focus.
  2252 	//This would cause Phonebook not to look like freshly started when opened again.
  2256     //This would cause Phonebook not to look like freshly started when opened again.
  2253 	//And also make sure foreground-added contact will show the new contact
  2257     //And also make sure foreground-added contact will show the new contact
  2254 	//even though the focus is not seen.
  2258     //even though the focus is not seen.
  2255     if( (static_cast<CPbk2AppUi*>(
  2259     if( (static_cast<CPbk2AppUi*>(
  2256             CEikonEnv::Static()->AppUi()))->IsForeground() )
  2260             CEikonEnv::Static()->AppUi()))->IsForeground() )
  2257         {
  2261         {
  2258         SelectAndChangeReadyStateL();
  2262         SelectAndChangeReadyStateL();
  2259         }
  2263         }
  2402     // result (subset of contacts) of the previous find criteria must be
  2406     // result (subset of contacts) of the previous find criteria must be
  2403     // reset too. So, we reset both the find box and the view stack.
  2407     // reset too. So, we reset both the find box and the view stack.
  2404     TRAPD( res,
  2408     TRAPD( res,
  2405         {
  2409         {
  2406         // This will reset back to base view, however retain original view
  2410         // This will reset back to base view, however retain original view
  2407 		//when opening CCA
  2411         //when opening CCA
  2408         if( !iOpeningCca ) 
  2412         if( !iOpeningCca ) 
  2409             {
  2413             {
  2410             iCurrentState->ResetFindL(); 
  2414             iCurrentState->ResetFindL(); 
  2411             }
  2415             }
  2412         });
  2416         });
  2426                 SelectAndChangeReadyStateL();
  2430                 SelectAndChangeReadyStateL();
  2427                 }
  2431                 }
  2428             }
  2432             }
  2429         else
  2433         else
  2430             {              
  2434             {              
  2431             Reset();
  2435             if( !iMarkingModeOn )
  2432             }	
  2436                 {
       
  2437                 Reset();
       
  2438                 }
       
  2439             }
  2433         }
  2440         }
  2434 
  2441 
  2435     // Do not handle contact addition here (DoHandleContactAdditionL),
  2442     // Do not handle contact addition here (DoHandleContactAdditionL),
  2436     // ContactAddedToView to notification is sent separately
  2443     // ContactAddedToView to notification is sent separately
  2437     }
  2444     }
  2540     //send event to current state
  2547     //send event to current state
  2541     //ETrue means that the event came from adaptvie search grid.
  2548     //ETrue means that the event came from adaptvie search grid.
  2542     TRAP_IGNORE(iCurrentState->HandleControlEventL( aSearchField, MCoeControlObserver::EEventStateChanged, ETrue));
  2549     TRAP_IGNORE(iCurrentState->HandleControlEventL( aSearchField, MCoeControlObserver::EEventStateChanged, ETrue));
  2543     }
  2550     }
  2544 
  2551 
       
  2552 
       
  2553 // -----------------------------------------------------------------------------
       
  2554 // CPbk2NamesListControl::MarkingModeStatusChanged
       
  2555 // -----------------------------------------------------------------------------
       
  2556 //
       
  2557 void CPbk2NamesListControl::MarkingModeStatusChanged( TBool /*aActivated*/ )
       
  2558     {
       
  2559     }
       
  2560 
       
  2561 // -----------------------------------------------------------------------------
       
  2562 // CPbk2NamesListControl::ExitMarkingMode
       
  2563 // Called by avkon, if the return value is ETrue, 
       
  2564 // the Marking mode will be canceled after any operation, 
       
  2565 // otherwise the Marking mode keep active.
       
  2566 // -----------------------------------------------------------------------------
       
  2567 //
       
  2568 TBool CPbk2NamesListControl::ExitMarkingMode() const
       
  2569     {
       
  2570     return ETrue;
       
  2571     }
       
  2572     
  2545 // --------------------------------------------------------------------------
  2573 // --------------------------------------------------------------------------
  2546 // CPbk2NamesListControl::HandleForegroundEventL
  2574 // CPbk2NamesListControl::HandleForegroundEventL
  2547 //
       
  2548 // --------------------------------------------------------------------------
  2575 // --------------------------------------------------------------------------
  2549 //
  2576 //
  2550 void CPbk2NamesListControl::HandleForegroundEventL(TBool aForeground)
  2577 void CPbk2NamesListControl::HandleForegroundEventL(TBool aForeground)
  2551     {
  2578     {
  2552     if ( iSearchFilter )
  2579     if ( iSearchFilter )
  2626 // ---------------------------------------------------------------------------
  2653 // ---------------------------------------------------------------------------
  2627 // CPbk2NamesListControl::SetOpeningCca
  2654 // CPbk2NamesListControl::SetOpeningCca
  2628 // ---------------------------------------------------------------------------
  2655 // ---------------------------------------------------------------------------
  2629 //
  2656 //
  2630 EXPORT_C void CPbk2NamesListControl::SetOpeningCca( TBool aIsOpening )
  2657 EXPORT_C void CPbk2NamesListControl::SetOpeningCca( TBool aIsOpening )
  2631 	{
  2658     {
  2632 	iOpeningCca = aIsOpening;
  2659     iOpeningCca = aIsOpening;
  2633 	}
  2660     }
  2634 
  2661 
  2635 // ---------------------------------------------------------------------------
  2662 // ---------------------------------------------------------------------------
  2636 // CPbk2NamesListControlBgTask::CPbk2NamesListControlBgTask
  2663 // CPbk2NamesListControlBgTask::CPbk2NamesListControlBgTask
  2637 // ---------------------------------------------------------------------------
  2664 // ---------------------------------------------------------------------------
  2638 //
  2665 //