searcher/searchclient/src/ccpixsearcher.cpp
changeset 15 cf5c74390b98
parent 10 afe194b6b1cd
child 16 2729d20a0010
--- a/searcher/searchclient/src/ccpixsearcher.cpp	Tue Jul 06 15:30:04 2010 +0300
+++ b/searcher/searchclient/src/ccpixsearcher.cpp	Wed Aug 18 10:53:26 2010 +0300
@@ -279,6 +279,37 @@
 	SetActive();     
     }
 
+EXPORT_C CSearchDocument** CCPixSearcher::GetBatchDocumentL(TInt aIndex, TInt& aReturnDoc, TInt aCount)
+    {
+    PERFORMANCE_LOG_START("CCPixSearcher::GetBatchDocumentL");
+    
+	if ( !iIsDatabaseOpen ) 	User::Leave( KErrNotReady );
+	if ( IsActive() )
+		{
+		User::Leave(KErrInUse);
+		}
+
+	return iSubSession.GetBatchDocumentL(aIndex,aReturnDoc, aCount);
+    }
+
+EXPORT_C void CCPixSearcher::GetBatchDocumentL(TInt aIndex, MCPixNextDocumentRequestObserver& aObserver, TInt aCount)
+    {
+    PERFORMANCE_LOG_START("CCPixSearcher::GetBatchDocumentL");
+    
+    if ( !iIsDatabaseOpen ) 	User::Leave( KErrNotReady );
+	if ( IsActive() )
+		{
+		User::Leave(KErrInUse); // Need ::RunError to handle this
+		}
+	
+	iObserver.iNextDocument = &aObserver;
+	
+	iState = EStateGetBatchDocument;
+	iSubSession.GetBatchDocument(aIndex, iStatus, aCount);
+	SetActive();     
+    }
+	
+	
 // CCPixSearcher::RunL()
 // Invoked to handle responses from the server.
 void CCPixSearcher::RunL()
@@ -341,6 +372,27 @@
 		        }
 		    }
 		    break;
+			
+		case EStateGetBatchDocument:
+		    {
+			// Fetch search results and call back at the observer
+		    CSearchDocument** document = 0;
+		    TInt retCount = 0;
+		    TRAPD( err, document = iSubSession.GetBatchDocumentObjectL( retCount ) );
+		    if ( observer.iNextDocument )
+		        {
+		        if ( err == KErrNone )
+		            {
+		            observer.iNextDocument->HandleBatchDocumentL(iStatus.Int(),retCount, document);
+		            }
+		        else
+		            {
+		            observer.iNextDocument->HandleBatchDocumentL(err, retCount, document);
+		            }
+		        }
+		    }
+			break;
+		
 
 		case EStateNone:
 		    // Do nothing, dont panic.