277 iSubSession.GetDocument(aIndex, iStatus); |
277 iSubSession.GetDocument(aIndex, iStatus); |
278 OstTraceFunctionExit0( CCPIXSEARCHER_GETDOCUMENTL_EXIT ); |
278 OstTraceFunctionExit0( CCPIXSEARCHER_GETDOCUMENTL_EXIT ); |
279 SetActive(); |
279 SetActive(); |
280 } |
280 } |
281 |
281 |
|
282 EXPORT_C CSearchDocument** CCPixSearcher::GetBatchDocumentL(TInt aIndex, TInt& aReturnDoc, TInt aCount) |
|
283 { |
|
284 PERFORMANCE_LOG_START("CCPixSearcher::GetBatchDocumentL"); |
|
285 |
|
286 if ( !iIsDatabaseOpen ) User::Leave( KErrNotReady ); |
|
287 if ( IsActive() ) |
|
288 { |
|
289 User::Leave(KErrInUse); |
|
290 } |
|
291 |
|
292 return iSubSession.GetBatchDocumentL(aIndex,aReturnDoc, aCount); |
|
293 } |
|
294 |
|
295 EXPORT_C void CCPixSearcher::GetBatchDocumentL(TInt aIndex, MCPixNextDocumentRequestObserver& aObserver, TInt aCount) |
|
296 { |
|
297 PERFORMANCE_LOG_START("CCPixSearcher::GetBatchDocumentL"); |
|
298 |
|
299 if ( !iIsDatabaseOpen ) User::Leave( KErrNotReady ); |
|
300 if ( IsActive() ) |
|
301 { |
|
302 User::Leave(KErrInUse); // Need ::RunError to handle this |
|
303 } |
|
304 |
|
305 iObserver.iNextDocument = &aObserver; |
|
306 |
|
307 iState = EStateGetBatchDocument; |
|
308 iSubSession.GetBatchDocument(aIndex, iStatus, aCount); |
|
309 SetActive(); |
|
310 } |
|
311 |
|
312 |
282 // CCPixSearcher::RunL() |
313 // CCPixSearcher::RunL() |
283 // Invoked to handle responses from the server. |
314 // Invoked to handle responses from the server. |
284 void CCPixSearcher::RunL() |
315 void CCPixSearcher::RunL() |
285 { |
316 { |
286 // NOTE: Should we do cleanup here (!) |
317 // NOTE: Should we do cleanup here (!) |
339 observer.iNextDocument->HandleDocumentL(err, document); |
370 observer.iNextDocument->HandleDocumentL(err, document); |
340 } |
371 } |
341 } |
372 } |
342 } |
373 } |
343 break; |
374 break; |
|
375 |
|
376 case EStateGetBatchDocument: |
|
377 { |
|
378 // Fetch search results and call back at the observer |
|
379 CSearchDocument** document = 0; |
|
380 TInt retCount = 0; |
|
381 TRAPD( err, document = iSubSession.GetBatchDocumentObjectL( retCount ) ); |
|
382 if ( observer.iNextDocument ) |
|
383 { |
|
384 if ( err == KErrNone ) |
|
385 { |
|
386 observer.iNextDocument->HandleBatchDocumentL(iStatus.Int(),retCount, document); |
|
387 } |
|
388 else |
|
389 { |
|
390 observer.iNextDocument->HandleBatchDocumentL(err, retCount, document); |
|
391 } |
|
392 } |
|
393 } |
|
394 break; |
|
395 |
344 |
396 |
345 case EStateNone: |
397 case EStateNone: |
346 // Do nothing, dont panic. |
398 // Do nothing, dont panic. |
347 break; |
399 break; |
348 |
400 |