772 // ---------------------------------------------------------------------------- |
772 // ---------------------------------------------------------------------------- |
773 // |
773 // |
774 void CWrtHarvester::QueueOperationL( TWidgetOperations aOperation, TUid aUid ) |
774 void CWrtHarvester::QueueOperationL( TWidgetOperations aOperation, TUid aUid ) |
775 { |
775 { |
776 //Hack to find out if WidgetUi exist as Queue keeps filling up |
776 //Hack to find out if WidgetUi exist as Queue keeps filling up |
777 if((iHSCount*3 <= iWidgetOperations.Count() && !CheckTaskExistsL()) || (aOperation == WidgetSelect)) |
777 SWidgetOperation op = { aOperation, aUid }; |
778 { |
778 |
|
779 if((iHSCount*3 <= iWidgetOperations.Count() && !CheckTaskExistsL() ) || (aOperation == WidgetSelect)) |
|
780 { |
779 ClearAllOperations(); |
781 ClearAllOperations(); |
780 iWidgetUIListener->SetValue(1); |
782 iWidgetUIListener->SetValue(1); |
781 } |
783 } |
782 SWidgetOperation op = { aOperation, aUid }; |
784 |
783 iWidgetOperations.Append( op ); |
785 TBool queued (EFalse); |
|
786 for(TInt i =0; i < iWidgetOperations.Count() && (aOperation == WidgetResume || aOperation == WidgetSuspend ) ; i++) |
|
787 { |
|
788 SWidgetOperation opInQueue = iWidgetOperations[i]; |
|
789 //we get resume but we already have suspend in Queue |
|
790 //make Resume as Suspend |
|
791 if(op.iOperation == WidgetResume && opInQueue.iUid == op.iUid && opInQueue.iOperation == WidgetSuspend ) |
|
792 { |
|
793 iWidgetOperations[i].iOperation = WidgetResume; |
|
794 queued = ETrue; |
|
795 break; |
|
796 } |
|
797 //we get suspend but we already have resume in Queue |
|
798 //make Suspend as Resume |
|
799 if(op.iOperation == WidgetSuspend && opInQueue.iUid == op.iUid && opInQueue.iOperation == WidgetResume ) |
|
800 { |
|
801 iWidgetOperations[i].iOperation = WidgetSuspend; |
|
802 queued = ETrue; |
|
803 break; |
|
804 } |
|
805 } |
|
806 |
|
807 if(!queued) |
|
808 iWidgetOperations.Append( op ); |
|
809 |
784 TryLaunchNextOperationL(); |
810 TryLaunchNextOperationL(); |
785 } |
811 } |
786 |
812 |
787 // ---------------------------------------------------------------------------- |
813 // ---------------------------------------------------------------------------- |
788 // |
814 // |