webengine/wrtharvester/src/wrtharvester.cpp
branchRCL_3
changeset 41 4bd5176e1bc8
parent 36 c711bdda59f4
child 46 30342f40acbf
--- a/webengine/wrtharvester/src/wrtharvester.cpp	Tue May 11 17:13:44 2010 +0300
+++ b/webengine/wrtharvester/src/wrtharvester.cpp	Tue May 25 13:52:38 2010 +0300
@@ -774,13 +774,39 @@
 void CWrtHarvester::QueueOperationL( TWidgetOperations aOperation, TUid aUid )
     {
     //Hack to find out if WidgetUi exist as Queue keeps filling up
-    if((iHSCount*3 <= iWidgetOperations.Count() && !CheckTaskExistsL()) || (aOperation == WidgetSelect))
-        {
+    SWidgetOperation op = { aOperation, aUid };
+    
+    if((iHSCount*3 <= iWidgetOperations.Count() && !CheckTaskExistsL() ) || (aOperation == WidgetSelect))
+        {        
         ClearAllOperations();
         iWidgetUIListener->SetValue(1);
-        }        
-    SWidgetOperation op = { aOperation, aUid };
-    iWidgetOperations.Append( op );
+        } 
+    
+    TBool queued (EFalse);
+    for(TInt i =0; i < iWidgetOperations.Count() && (aOperation == WidgetResume || aOperation == WidgetSuspend ) ; i++)
+        {
+        SWidgetOperation opInQueue = iWidgetOperations[i];
+        //we get resume but we already have suspend in Queue
+        //make Resume as Suspend    
+        if(op.iOperation == WidgetResume && opInQueue.iUid == op.iUid && opInQueue.iOperation == WidgetSuspend )
+            {            
+            iWidgetOperations[i].iOperation = WidgetResume;
+            queued = ETrue;
+            break;
+            }            
+        //we get suspend but we already have resume in Queue
+        //make Suspend as Resume    
+        if(op.iOperation == WidgetSuspend  && opInQueue.iUid == op.iUid && opInQueue.iOperation == WidgetResume )
+            {            
+            iWidgetOperations[i].iOperation = WidgetSuspend;
+            queued = ETrue;
+            break;
+            }    
+        }
+            
+    if(!queued)
+        iWidgetOperations.Append( op );
+            
     TryLaunchNextOperationL();
     }