263 CEikListBox& iListBox; |
268 CEikListBox& iListBox; |
264 /// Ref: Event sender |
269 /// Ref: Event sender |
265 MPbk2UiControlEventSender& iEventSender; |
270 MPbk2UiControlEventSender& iEventSender; |
266 }; |
271 }; |
267 |
272 |
|
273 |
|
274 /** |
|
275 * Background Task Handler. |
|
276 */ |
|
277 NONSHARABLE_CLASS(CPbk2NamesListControlBgTask) : public CActive |
|
278 { |
|
279 |
|
280 public: |
|
281 CPbk2NamesListControlBgTask( CPbk2NamesListControl& aControl ); |
|
282 ~CPbk2NamesListControlBgTask(); |
|
283 |
|
284 void AddEvent( CPbk2NamesListControl::TPbk2NamesListBgEvents aEvent ); |
|
285 void ClearAllEvents(); |
|
286 void RemoveEvent( CPbk2NamesListControl::TPbk2NamesListBgEvents aEvent ); |
|
287 |
|
288 private: // From CActive |
|
289 void DoCancel(); |
|
290 void RunL(); |
|
291 TInt RunError(TInt aError); |
|
292 |
|
293 private: |
|
294 //Owns |
|
295 RArray <CPbk2NamesListControl::TPbk2NamesListBgEvents> iEventQueue; |
|
296 |
|
297 //doesnt Own |
|
298 CPbk2NamesListControl& iControl; |
|
299 }; |
|
300 |
|
301 /** |
|
302 * A helper class for mass update cases. |
|
303 */ |
|
304 NONSHARABLE_CLASS( CPbk2HandleMassUpdate ) : public CBase |
|
305 { |
|
306 public: // Construction and destruction |
|
307 /** |
|
308 * Creates new instance of this class. |
|
309 * @return new instance of this class. |
|
310 */ |
|
311 static CPbk2HandleMassUpdate* NewL(CEikListBox& iListBox); |
|
312 |
|
313 /** |
|
314 * Destructor. |
|
315 */ |
|
316 ~CPbk2HandleMassUpdate(); |
|
317 |
|
318 public: |
|
319 /** |
|
320 * Call this function after each update event. |
|
321 * @return ETrue if this event is part of a mass update. |
|
322 */ |
|
323 TBool MassUpdateCheckThis(); |
|
324 |
|
325 /** |
|
326 * Call this function to check if mass update process is ongoing. |
|
327 * @return ETrue if mass update process is ongoing. |
|
328 */ |
|
329 TBool MassUpdateDetected(); |
|
330 |
|
331 private: |
|
332 CPbk2HandleMassUpdate(CEikListBox& iListBox); |
|
333 void ConstructL(); |
|
334 TBool HandleMassUpdateCheckL(); |
|
335 void HandleMassUpdateCheckReset(); |
|
336 void HandleMassUpdateDone(); |
|
337 static TInt HandleMassUpdateTimerCallBack(TAny* aAny); |
|
338 |
|
339 private: |
|
340 CEikListBox& iListBox; |
|
341 TBool iHandleMassUpdate; |
|
342 TTime iHandleMassUpdateFirst; |
|
343 TTime iHandleMassUpdatePrev; |
|
344 TInt iHandleMassUpdateCount; |
|
345 CPeriodic* iHandleMassUpdateTimer; |
|
346 CAknWaitDialog* iHandleMassUpdateDialog; |
|
347 }; |
|
348 |
268 // -------------------------------------------------------------------------- |
349 // -------------------------------------------------------------------------- |
269 // CPbk2UiControlEventSender::CPbk2UiControlEventSender |
350 // CPbk2UiControlEventSender::CPbk2UiControlEventSender |
270 // -------------------------------------------------------------------------- |
351 // -------------------------------------------------------------------------- |
271 // |
352 // |
272 CPbk2UiControlEventSender::CPbk2UiControlEventSender |
353 CPbk2UiControlEventSender::CPbk2UiControlEventSender |
537 { |
618 { |
538 iControl.Reset(); |
619 iControl.Reset(); |
539 } |
620 } |
540 } |
621 } |
541 } |
622 } |
|
623 |
|
624 // -------------------------------------------------------------------------- |
|
625 // CPbk2HandleMassUpdate::NewL |
|
626 // -------------------------------------------------------------------------- |
|
627 // |
|
628 CPbk2HandleMassUpdate* CPbk2HandleMassUpdate::NewL(CEikListBox& aListBox) |
|
629 { |
|
630 CPbk2HandleMassUpdate* self = |
|
631 new( ELeave ) CPbk2HandleMassUpdate(aListBox); |
|
632 CleanupStack::PushL( self ); |
|
633 self->ConstructL(); |
|
634 CleanupStack::Pop( self ); |
|
635 return self; |
|
636 } |
|
637 |
|
638 // -------------------------------------------------------------------------- |
|
639 // CPbk2HandleMassUpdate::~CPbk2HandleMassUpdate |
|
640 // -------------------------------------------------------------------------- |
|
641 // |
|
642 CPbk2HandleMassUpdate::~CPbk2HandleMassUpdate() |
|
643 { |
|
644 delete iHandleMassUpdateDialog; |
|
645 delete iHandleMassUpdateTimer; |
|
646 } |
|
647 |
|
648 // -------------------------------------------------------------------------- |
|
649 // CPbk2HandleMassUpdate::CPbk2HandleMassUpdate |
|
650 // -------------------------------------------------------------------------- |
|
651 // |
|
652 CPbk2HandleMassUpdate::CPbk2HandleMassUpdate(CEikListBox& aListBox) : |
|
653 iListBox(aListBox) |
|
654 { |
|
655 } |
|
656 |
|
657 // -------------------------------------------------------------------------- |
|
658 // CPbk2HandleMassUpdate::ConstructL |
|
659 // -------------------------------------------------------------------------- |
|
660 // |
|
661 void CPbk2HandleMassUpdate::ConstructL() |
|
662 { |
|
663 iHandleMassUpdateTimer = CPeriodic::NewL( CActive::EPriorityIdle ); |
|
664 } |
|
665 |
|
666 // -------------------------------------------------------------------------- |
|
667 // CPbk2HandleMassUpdate::HandleMassUpdateCheckThis |
|
668 // |
|
669 // Functionality to detect mass updates done to contact database and to prevent |
|
670 // e.g nameslist flickering when constant updates are happening in background |
|
671 // when pc sync etc is adding hundreds of contacts in line |
|
672 // -------------------------------------------------------------------------- |
|
673 // |
|
674 TBool CPbk2HandleMassUpdate::MassUpdateCheckThis() |
|
675 { |
|
676 TBool ret(EFalse); |
|
677 const TInt KNbrUpdBeforeMassCheck(5); |
|
678 iHandleMassUpdateTimer->Cancel(); |
|
679 |
|
680 if( iHandleMassUpdateCount > KNbrUpdBeforeMassCheck ) |
|
681 { |
|
682 //candidates to be checked are they continual of a mass update |
|
683 TRAP_IGNORE(ret = HandleMassUpdateCheckL()); |
|
684 } |
|
685 else if( iHandleMassUpdateCount > 0 ) |
|
686 { |
|
687 //Subsequent updates that are handled normally even if |
|
688 // they would be first ones in a mass update burst |
|
689 iHandleMassUpdateCount++; |
|
690 iHandleMassUpdatePrev.UniversalTime(); |
|
691 } |
|
692 else |
|
693 { |
|
694 //very first update, set time & counter |
|
695 HandleMassUpdateCheckReset(); |
|
696 } |
|
697 return ret; |
|
698 } |
|
699 |
|
700 // -------------------------------------------------------------------------- |
|
701 // CPbk2HandleMassUpdate::MassUpdateDetected |
|
702 // -------------------------------------------------------------------------- |
|
703 // |
|
704 TBool CPbk2HandleMassUpdate::MassUpdateDetected() |
|
705 { |
|
706 return iHandleMassUpdate; |
|
707 } |
|
708 |
|
709 // -------------------------------------------------------------------------- |
|
710 // CPbk2HandleMassUpdate::HandleMassUpdateCheckL |
|
711 // -------------------------------------------------------------------------- |
|
712 // |
|
713 TBool CPbk2HandleMassUpdate::HandleMassUpdateCheckL() |
|
714 { |
|
715 //KDeltaAverage time per update to be considered as mass |
|
716 //update. One occasional update can take KDeltaMax time as long as |
|
717 //average time not exeeded (therefore timeout for the very first updates in |
|
718 //practice is also KDeltaAverage). |
|
719 const TInt64 KDeltaAverage(2000000); |
|
720 const TInt64 KDeltaMax(KDeltaAverage * 2); |
|
721 const TTimeIntervalMicroSeconds KMaxPrev(KDeltaMax); |
|
722 TBool ret(EFalse); |
|
723 |
|
724 TTime now; |
|
725 now.UniversalTime(); |
|
726 TTimeIntervalMicroSeconds fs = now.MicroSecondsFrom(iHandleMassUpdateFirst); |
|
727 TTimeIntervalMicroSeconds ps = now.MicroSecondsFrom(iHandleMassUpdatePrev); |
|
728 TTimeIntervalMicroSeconds maxCumu(KDeltaAverage * iHandleMassUpdateCount); |
|
729 |
|
730 if( fs < maxCumu && ps < KMaxPrev ) |
|
731 { |
|
732 //mass update burst ongoing |
|
733 iHandleMassUpdate=ETrue; |
|
734 iHandleMassUpdateCount++; |
|
735 iHandleMassUpdatePrev.UniversalTime(); |
|
736 iListBox.UpdateScrollBarsL(); |
|
737 |
|
738 if( !iHandleMassUpdateDialog ) |
|
739 { |
|
740 iHandleMassUpdateDialog = new(ELeave) CAknWaitDialog |
|
741 (reinterpret_cast<CEikDialog**>(&iHandleMassUpdateDialog), EFalse); |
|
742 iHandleMassUpdateDialog->SetTone(CAknNoteDialog::ENoTone); |
|
743 iHandleMassUpdateDialog->ExecuteLD(R_QTN_GEN_NOTE_SYNCHRONIZING_PROGRESS); |
|
744 //ExecuteLD above handles validity of pointer iHandleMassUpdateDialog plus |
|
745 //cleanupstack |
|
746 } |
|
747 |
|
748 TCallBack callback(HandleMassUpdateTimerCallBack, this); |
|
749 TTimeIntervalMicroSeconds32 delta32(KDeltaMax); |
|
750 iHandleMassUpdateTimer->Start( delta32, delta32, callback ); |
|
751 ret = ETrue; |
|
752 } |
|
753 else if(iHandleMassUpdate) |
|
754 { |
|
755 //mass update burst ended |
|
756 HandleMassUpdateDone(); |
|
757 ret = ETrue; |
|
758 } |
|
759 else |
|
760 { |
|
761 //just normal update, set time & counter |
|
762 HandleMassUpdateCheckReset(); |
|
763 } |
|
764 return ret; |
|
765 } |
|
766 |
|
767 // ---------------------------------------------------------------------------- |
|
768 // CPbk2HandleMassUpdate::HandleMassUpdateCheckReset |
|
769 // ---------------------------------------------------------------------------- |
|
770 // |
|
771 void CPbk2HandleMassUpdate::HandleMassUpdateCheckReset() |
|
772 { |
|
773 iHandleMassUpdate=EFalse; |
|
774 iHandleMassUpdateCount = 1; //set as first candidate for next burst |
|
775 iHandleMassUpdateFirst.UniversalTime(); |
|
776 iHandleMassUpdatePrev=iHandleMassUpdateFirst; |
|
777 } |
|
778 |
|
779 // ---------------------------------------------------------------------------- |
|
780 // CPbk2HandleMassUpdate::HandleMassUpdateTimerCallBack |
|
781 // ---------------------------------------------------------------------------- |
|
782 // |
|
783 TInt CPbk2HandleMassUpdate::HandleMassUpdateTimerCallBack(TAny* aAny) |
|
784 { |
|
785 CPbk2HandleMassUpdate* self = static_cast<CPbk2HandleMassUpdate*>( aAny ); |
|
786 self->iHandleMassUpdateTimer->Cancel(); |
|
787 self->HandleMassUpdateDone(); |
|
788 return KErrNone; |
|
789 } |
|
790 |
|
791 // ---------------------------------------------------------------------------- |
|
792 // CPbk2HandleMassUpdate::HandleMassUpdateDone |
|
793 // ---------------------------------------------------------------------------- |
|
794 // |
|
795 void CPbk2HandleMassUpdate::HandleMassUpdateDone() |
|
796 { |
|
797 if( iHandleMassUpdateDialog ) |
|
798 { |
|
799 TRAP_IGNORE(iHandleMassUpdateDialog->ProcessFinishedL()); |
|
800 //The below 2 lines just in case... ProcessFinishedL already took care of these |
|
801 delete iHandleMassUpdateDialog; |
|
802 iHandleMassUpdateDialog = NULL; |
|
803 } |
|
804 |
|
805 HandleMassUpdateCheckReset(); |
|
806 iListBox.SetCurrentItemIndex(0); |
|
807 iListBox.SetTopItemIndex(0); |
|
808 } |
|
809 |
|
810 ///////////////////////// End of helper classes ///////////////////////////// |
|
811 |
542 |
812 |
543 // -------------------------------------------------------------------------- |
813 // -------------------------------------------------------------------------- |
544 // CPbk2NamesListControl::CPbk2NamesListControl |
814 // CPbk2NamesListControl::CPbk2NamesListControl |
545 // -------------------------------------------------------------------------- |
815 // -------------------------------------------------------------------------- |
546 // |
816 // |
584 // CPbk2NamesListControl::~CPbk2NamesListControl |
854 // CPbk2NamesListControl::~CPbk2NamesListControl |
585 // -------------------------------------------------------------------------- |
855 // -------------------------------------------------------------------------- |
586 // |
856 // |
587 CPbk2NamesListControl::~CPbk2NamesListControl() |
857 CPbk2NamesListControl::~CPbk2NamesListControl() |
588 { |
858 { |
|
859 ClearMarkedContactsInfo(); |
|
860 |
|
861 if (iBgTask) |
|
862 { |
|
863 delete iBgTask; |
|
864 iBgTask = NULL; |
|
865 } |
|
866 |
589 if ( iViewStack && iStackObserver ) |
867 if ( iViewStack && iStackObserver ) |
590 { |
868 { |
591 iViewStack->RemoveStackObserver( *iStackObserver ); |
869 iViewStack->RemoveStackObserver( *iStackObserver ); |
592 } |
870 } |
593 |
871 |
|
872 if( iThumbManager ) |
|
873 { |
|
874 TRAP_IGNORE( iThumbManager->SetContactViewL( NULL ) ); |
|
875 iThumbManager->RemoveObserver(); |
|
876 } |
|
877 |
594 if (iCommand) |
878 if (iCommand) |
595 { |
879 { |
596 // inform the command that the control is deleted |
880 // inform the command that the control is deleted |
597 iCommand->ResetUiControl(*this); |
881 iCommand->ResetUiControl(*this); |
598 } |
882 } |
599 iObservers.Reset(); |
883 iObservers.Reset(); |
600 iCommandItems.ResetAndDestroy(); |
884 iCommandItems.ResetAndDestroy(); |
|
885 delete iCheckMassUpdate; |
601 delete iListBoxSelectionObserver; |
886 delete iListBoxSelectionObserver; |
602 delete iStateFactory; |
887 delete iStateFactory; |
603 delete iListBox; |
888 delete iListBox; |
604 delete iFindBox; |
889 delete iFindBox; |
605 delete iThumbnailLoader; |
890 delete iThumbnailLoader; |
606 delete iEventSender; |
891 delete iEventSender; |
607 delete iStackObserver; |
892 delete iStackObserver; |
608 delete iUiExtension; |
893 delete iUiExtension; |
609 delete iViewStack; |
894 delete iViewStack; |
610 delete iSearchFilter; |
895 delete iSearchFilter; |
611 |
896 if( iOwnThumbManager ) |
|
897 { |
|
898 delete iThumbManager; |
|
899 } |
612 if (iOwnBaseView) |
900 if (iOwnBaseView) |
613 { |
901 { |
614 delete iBaseView; |
902 delete iBaseView; |
615 } |
903 } |
616 if(iFeatureManagerInitilized) |
904 if(iFeatureManagerInitilized) |
617 { |
905 { |
618 FeatureManager::UnInitializeLib(); |
906 FeatureManager::UnInitializeLib(); |
619 } |
907 } |
620 |
|
621 // if thumbmanager, remove observer |
|
622 if( iThumbManager ) |
|
623 { |
|
624 iThumbManager->RemoveObserver(); |
|
625 } |
|
626 |
|
627 } |
908 } |
628 |
909 |
629 // -------------------------------------------------------------------------- |
910 // -------------------------------------------------------------------------- |
630 // CPbk2NamesListControl::NewL |
911 // CPbk2NamesListControl::NewL |
631 // -------------------------------------------------------------------------- |
912 // -------------------------------------------------------------------------- |
738 aReader.Rewind( sizeof( TInt32 ) ); |
1020 aReader.Rewind( sizeof( TInt32 ) ); |
739 |
1021 |
740 // Create the listbox and its model |
1022 // Create the listbox and its model |
741 if( flags & KPbk2ContactViewListControlDoubleRow ) |
1023 if( flags & KPbk2ContactViewListControlDoubleRow ) |
742 { |
1024 { |
|
1025 if( !iThumbManager ) |
|
1026 { |
|
1027 iThumbManager = CPbk2ThumbnailManager::NewL( iContactManager ); |
|
1028 iOwnThumbManager = ETrue; |
|
1029 } |
|
1030 |
743 iDoubleListBox = CPbk2ContactViewDoubleListBox::NewL |
1031 iDoubleListBox = CPbk2ContactViewDoubleListBox::NewL |
744 ( *this, aReader, iContactManager, |
1032 ( *this, aReader, iContactManager, |
745 *iViewStack, iNameFormatter, iStoreProperties, |
1033 *iViewStack, iNameFormatter, iStoreProperties, |
746 iUiExtension, *iSearchFilter, *iThumbManager ); |
1034 iUiExtension, *iSearchFilter, *iThumbManager ); |
747 |
1035 |
748 if( iThumbManager ) |
1036 iThumbManager->SetObserver( *iDoubleListBox ); |
749 { |
1037 iThumbManager->SetContactViewL( iViewStack ); |
750 iThumbManager->SetObserver( *iDoubleListBox ); |
|
751 iViewStack->AddObserverL( *iThumbManager ); |
|
752 } |
|
753 |
1038 |
754 iListBox = iDoubleListBox; |
1039 iListBox = iDoubleListBox; |
755 } |
1040 } |
756 else |
1041 else |
757 { |
1042 { |
2142 if ( iSearchFilter ) |
2440 if ( iSearchFilter ) |
2143 { |
2441 { |
2144 iSearchFilter->HandleForegroundEventL( aForeground ); |
2442 iSearchFilter->HandleForegroundEventL( aForeground ); |
2145 } |
2443 } |
2146 } |
2444 } |
2147 |
2445 |
|
2446 // --------------------------------------------------------------------------- |
|
2447 // CPbk2NamesListControl::StoreMarkedContactsAndResetViewL |
|
2448 // --------------------------------------------------------------------------- |
|
2449 // |
|
2450 void CPbk2NamesListControl::StoreMarkedContactsAndResetViewL() |
|
2451 { |
|
2452 delete iSelectedLinkArray; |
|
2453 iSelectedLinkArray = NULL; |
|
2454 |
|
2455 iSelectedLinkArray = iCurrentState->SelectedContactsL(); |
|
2456 } |
|
2457 |
|
2458 |
|
2459 // --------------------------------------------------------------------------- |
|
2460 // CPbk2NamesListControl::RestoreMarkedContactsL |
|
2461 // --------------------------------------------------------------------------- |
|
2462 // |
|
2463 void CPbk2NamesListControl::RestoreMarkedContactsL() |
|
2464 { |
|
2465 //Set the Marked Contacts |
|
2466 if ( iSelectedLinkArray ) |
|
2467 { |
|
2468 for ( TInt index = 0; index<iSelectedLinkArray->Count(); index++ ) |
|
2469 { |
|
2470 iCurrentState->SetSelectedContactL( iSelectedLinkArray->At(index), ETrue ); |
|
2471 } |
|
2472 } |
|
2473 |
|
2474 delete iSelectedLinkArray; |
|
2475 iSelectedLinkArray = NULL; |
|
2476 } |
|
2477 |
|
2478 // --------------------------------------------------------------------------- |
|
2479 // CPbk2NamesListControl::ClearMarkedContactsInfo |
|
2480 // --------------------------------------------------------------------------- |
|
2481 // |
|
2482 void CPbk2NamesListControl::ClearMarkedContactsInfo() |
|
2483 { |
|
2484 if ( iBgTask ) |
|
2485 { |
|
2486 iBgTask->ClearAllEvents(); |
|
2487 } |
|
2488 delete iSelectedLinkArray; |
|
2489 iSelectedLinkArray = NULL; |
|
2490 } |
|
2491 |
|
2492 // --------------------------------------------------------------------------- |
|
2493 // CPbk2NamesListControl::HandleViewForegroundEventL |
|
2494 // --------------------------------------------------------------------------- |
|
2495 // |
|
2496 EXPORT_C void CPbk2NamesListControl::HandleViewForegroundEventL( TBool aForeground ) |
|
2497 { |
|
2498 if ( aForeground ) |
|
2499 { |
|
2500 if ( iBgTask ) |
|
2501 { |
|
2502 iBgTask->AddEvent( CPbk2NamesListControl::EStateRestoreMarkedContacts ); |
|
2503 } |
|
2504 } |
|
2505 else |
|
2506 { |
|
2507 if ( iBgTask ) |
|
2508 { |
|
2509 iBgTask->AddEvent( CPbk2NamesListControl::EStateSaveMarkedContacts ); |
|
2510 } |
|
2511 } |
|
2512 } |
|
2513 |
|
2514 // --------------------------------------------------------------------------- |
|
2515 // CPbk2NamesListControlBgTask::CPbk2NamesListControlBgTask |
|
2516 // --------------------------------------------------------------------------- |
|
2517 // |
|
2518 CPbk2NamesListControlBgTask::CPbk2NamesListControlBgTask( CPbk2NamesListControl& aControl ) : |
|
2519 CActive(CActive::EPriorityStandard), |
|
2520 iControl( aControl ) |
|
2521 { |
|
2522 CActiveScheduler::Add(this); |
|
2523 iEventQueue.Append(CPbk2NamesListControl::EStateBgTaskEmpty); |
|
2524 } |
|
2525 |
|
2526 // --------------------------------------------------------------------------- |
|
2527 // CPbk2NamesListControlBgTask::~CPbk2NamesListControlBgTask |
|
2528 // --------------------------------------------------------------------------- |
|
2529 // |
|
2530 CPbk2NamesListControlBgTask::~CPbk2NamesListControlBgTask() |
|
2531 { |
|
2532 Cancel(); |
|
2533 iEventQueue.Reset(); |
|
2534 } |
|
2535 |
|
2536 |
|
2537 // --------------------------------------------------------------------------- |
|
2538 // CPbk2NamesListControlBgTask::DoCancel |
|
2539 // --------------------------------------------------------------------------- |
|
2540 // |
|
2541 void CPbk2NamesListControlBgTask::DoCancel() |
|
2542 { |
|
2543 } |
|
2544 |
|
2545 // --------------------------------------------------------------------------- |
|
2546 // CPbk2NamesListControlBgTask::RunL |
|
2547 // --------------------------------------------------------------------------- |
|
2548 // |
|
2549 void CPbk2NamesListControlBgTask::RunL() |
|
2550 { |
|
2551 |
|
2552 if ( iEventQueue.Count() ) |
|
2553 { |
|
2554 switch ( iEventQueue[0] ) |
|
2555 { |
|
2556 case CPbk2NamesListControl::EStateSaveMarkedContacts: |
|
2557 iControl.StoreMarkedContactsAndResetViewL(); |
|
2558 iEventQueue.Remove( 0 ); |
|
2559 break; |
|
2560 |
|
2561 case CPbk2NamesListControl::EStateRestoreMarkedContacts: |
|
2562 iControl.RestoreMarkedContactsL(); |
|
2563 iEventQueue.Remove( 0 ); |
|
2564 break; |
|
2565 |
|
2566 case CPbk2NamesListControl::EStateBgTaskEmpty : |
|
2567 default: |
|
2568 iControl.ClearMarkedContactsInfo(); |
|
2569 break; |
|
2570 } |
|
2571 } |
|
2572 } |
|
2573 |
|
2574 // --------------------------------------------------------------------------- |
|
2575 // CPbk2NamesListControlBgTask::RunError |
|
2576 // --------------------------------------------------------------------------- |
|
2577 // |
|
2578 TInt CPbk2NamesListControlBgTask::RunError(TInt /*aError*/) |
|
2579 { |
|
2580 return KErrNone; |
|
2581 } |
|
2582 |
|
2583 // --------------------------------------------------------------------------- |
|
2584 // CPbk2NamesListControlBgTask::AddEvent |
|
2585 // --------------------------------------------------------------------------- |
|
2586 // |
|
2587 void CPbk2NamesListControlBgTask::AddEvent( CPbk2NamesListControl::TPbk2NamesListBgEvents aEvent ) |
|
2588 { |
|
2589 iEventQueue.Insert( aEvent, iEventQueue.Count() - 1 ); |
|
2590 if ( !IsActive() ) |
|
2591 { |
|
2592 TRequestStatus* status = &iStatus; |
|
2593 User::RequestComplete(status, KErrNone); |
|
2594 SetActive(); |
|
2595 } |
|
2596 } |
|
2597 |
|
2598 |
|
2599 // --------------------------------------------------------------------------- |
|
2600 // CPbk2NamesListControlBgTask::RemoveEvent |
|
2601 // --------------------------------------------------------------------------- |
|
2602 // |
|
2603 void CPbk2NamesListControlBgTask::RemoveEvent( CPbk2NamesListControl::TPbk2NamesListBgEvents aEvent ) |
|
2604 { |
|
2605 for ( TInt index = 0; index < iEventQueue.Count(); index++ ) |
|
2606 { |
|
2607 if ( aEvent == iEventQueue[index] ) |
|
2608 { |
|
2609 iEventQueue.Remove( index ); |
|
2610 if ( 0 == index ) |
|
2611 { |
|
2612 Cancel(); |
|
2613 } |
|
2614 break; |
|
2615 } |
|
2616 } |
|
2617 } |
|
2618 |
|
2619 |
|
2620 // --------------------------------------------------------------------------- |
|
2621 // CPbk2NamesListControlBgTask::ClearAllEvents |
|
2622 // --------------------------------------------------------------------------- |
|
2623 // |
|
2624 void CPbk2NamesListControlBgTask::ClearAllEvents() |
|
2625 { |
|
2626 iEventQueue.Reset(); |
|
2627 iEventQueue.Append( CPbk2NamesListControl::EStateBgTaskEmpty ); |
|
2628 Cancel(); |
|
2629 } |
2148 |
2630 |
2149 // End of File |
2631 // End of File |