imagehandlingutilities/thumbnailmanager/thumbagdaemon/src/thumbagprocessor.cpp
changeset 19 b790c5b3d11f
parent 17 ffa62e555b02
child 22 a67f74060682
equal deleted inserted replaced
17:ffa62e555b02 19:b790c5b3d11f
   293        
   293        
   294         //free query
   294         //free query
   295         delete iQueryAllItems;
   295         delete iQueryAllItems;
   296         iQueryAllItems = NULL;
   296         iQueryAllItems = NULL;
   297         }
   297         }
   298     else if(&aQuery == iQuery )
   298     else if(&aQuery == iQuery ) 
   299         {
   299         {
   300         TN_DEBUG1( "CThumbAGProcessor::HandleQueryCompleted - Query completed");
   300         TN_DEBUG1( "CThumbAGProcessor::HandleQueryCompleted - Query completed");
   301         
   301         
   302         if(iQueryActive)
   302         if(iQueryActive)
   303             {
   303             {
   316                 
   316                 
   317                 RArray<TItemId> queryQueueDelta;
   317                 RArray<TItemId> queryQueueDelta;
   318                 
   318                 
   319                 TInt itemIndex(KErrNotFound);
   319                 TInt itemIndex(KErrNotFound);
   320                 
   320                 
   321                 //search delta items
   321                 //search delta items which were queried, but not found
   322                  for(TInt queryItem =0; queryItem < iQueryQueue.Count();queryItem++)
   322                  for(TInt queryItem =0; queryItem < iQueryQueue.Count();queryItem++)
   323                      {
   323                      {
   324                      TBool found(EFalse);
   324                      TBool found(EFalse);
   325                      for(TInt queryResult = 0; queryResult < iQuery->Count(); queryResult++)
   325                      for(TInt queryResult = 0; queryResult < iQuery->Count(); queryResult++)
   326                         {    
   326                         {    
   367                 iModify = EFalse;
   367                 iModify = EFalse;
   368                 }
   368                 }
   369             }
   369             }
   370         else
   370         else
   371             {
   371             {
   372             DeleteAndCancelQuery();
   372             //Delete and cancel query, do not return items back to original queue
       
   373             DeleteAndCancelQuery( EFalse );
   373             TN_DEBUG1( "CThumbAGProcessor::HandleQueryCompleted() Query FAILED!"); 
   374             TN_DEBUG1( "CThumbAGProcessor::HandleQueryCompleted() Query FAILED!"); 
   374             }
   375             }
   375         }
   376         }
   376     else
   377     else
   377         {
   378         {
   662                     // ignore if fails
   663                     // ignore if fails
   663                     i2ndRoundGenerateQueue.InsertInOrder(aObject->Id(), Compare);
   664                     i2ndRoundGenerateQueue.InsertInOrder(aObject->Id(), Compare);
   664                     }
   665                     }
   665                 }
   666                 }
   666             
   667             
       
   668 		   // 10.1 specific
   667            if( imageObjectDef.Id() != aObject->Def().Id()  )
   669            if( imageObjectDef.Id() != aObject->Def().Id()  )
   668                 {
   670                 {
   669                 TN_DEBUG1( "CThumbAGProcessor::CreateThumbnailsL() 1st round not image");
   671                 TN_DEBUG1( "CThumbAGProcessor::CreateThumbnailsL() 1st round not image");
   670                 ActivateAO();
   672                 ActivateAO();
   671                 return;
   673                 return;
  1028                 }
  1030                 }
  1029             }
  1031             }
  1030         //force is coming, but executing non-forced query complete-> cancel old
  1032         //force is coming, but executing non-forced query complete-> cancel old
  1031         else
  1033         else
  1032             {
  1034             {
  1033             DeleteAndCancelQuery();
  1035 			//cancel query and move items back to original processing queue
       
  1036             DeleteAndCancelQuery( ETrue );
  1034 	        ActivateAO();
  1037 	        ActivateAO();
  1035             return;  
  1038             return;  
  1036             }
  1039             }
  1037         
  1040         
  1038         //is last query item
  1041         //is last query item
  1046         ActivateAO();
  1049         ActivateAO();
  1047         }
  1050         }
  1048     //waiting for MDS query to complete
  1051     //waiting for MDS query to complete
  1049     else if( iQueryActive )
  1052     else if( iQueryActive )
  1050         {
  1053         {
       
  1054 		//state mismatch
  1051         if(iForceRun && !iModify)
  1055         if(iForceRun && !iModify)
  1052             {
  1056             {
  1053             DeleteAndCancelQuery();
  1057 			//cancel query and move items back to original processing queue
       
  1058             DeleteAndCancelQuery(ETrue);
  1054             ActivateAO();
  1059             ActivateAO();
  1055             }
  1060             }
  1056         else  
  1061         else  
  1057             {
  1062             {
  1058             TN_DEBUG1( "CThumbAGProcessor::RunL() - waiting for query to complete, abort..." );
  1063             TN_DEBUG1( "CThumbAGProcessor::RunL() - waiting for query to complete, abort..." );
  1124 
  1129 
  1125 // ---------------------------------------------------------------------------
  1130 // ---------------------------------------------------------------------------
  1126 // CThumbAGProcessor::DeleteAndCancelQuery()
  1131 // CThumbAGProcessor::DeleteAndCancelQuery()
  1127 // ---------------------------------------------------------------------------
  1132 // ---------------------------------------------------------------------------
  1128 //
  1133 //
  1129 void CThumbAGProcessor::DeleteAndCancelQuery()
  1134 void CThumbAGProcessor::DeleteAndCancelQuery(TBool aRestoreItems)
  1130     {
  1135     {
  1131     TN_DEBUG1( "CThumbAGProcessor::DeleteAndCancelQuery() in" );
  1136     TN_DEBUG1( "CThumbAGProcessor::DeleteAndCancelQuery() in" );
  1132     
  1137     
  1133     if(iQuery)
  1138     if(iQuery)
  1134         {
  1139         {
  1143     iProcessingCount = 0;
  1148     iProcessingCount = 0;
  1144     
  1149     
  1145     //move remainig IDs in query queue back to original queue
  1150     //move remainig IDs in query queue back to original queue
  1146     while(iQueryQueue.Count())
  1151     while(iQueryQueue.Count())
  1147         {
  1152         {
  1148         if(iLastQueue)
  1153         if(aRestoreItems && iLastQueue)
  1149             {
  1154             {
  1150             if(iLastQueue->FindInOrder(iQueryQueue[0], Compare) == KErrNotFound)
  1155             if(iLastQueue->FindInOrder(iQueryQueue[0], Compare) == KErrNotFound)
  1151                 {
  1156                 {
  1152                 //ignore if fails
  1157                 //ignore if fails
  1153                 iLastQueue->InsertInOrder(iQueryQueue[0], Compare);
  1158                 iLastQueue->InsertInOrder(iQueryQueue[0], Compare);
  1792         }
  1797         }
  1793     
  1798     
  1794     //cancel 2nd round generarion when there is items in 1st round queues
  1799     //cancel 2nd round generarion when there is items in 1st round queues
  1795     if(itemsLeft && i2ndRound)
  1800     if(itemsLeft && i2ndRound)
  1796         {
  1801         {
  1797         DeleteAndCancelQuery();
  1802         DeleteAndCancelQuery(ETrue);
  1798         i2ndRound = EFalse;
  1803         i2ndRound = EFalse;
  1799         }
  1804         }
  1800         
  1805         
  1801     TN_DEBUG2( "CThumbAGProcessor::UpdatePSValues() KItemsleft == %d", itemsLeft);
  1806     TN_DEBUG2( "CThumbAGProcessor::UpdatePSValues() KItemsleft == %d", itemsLeft);
  1802     
  1807