diff -r 993ab30e92fc -r 7d8c8d8f5eab searchui/indevicehandler/src/indevicehandler.cpp --- a/searchui/indevicehandler/src/indevicehandler.cpp Tue Jul 06 14:17:22 2010 +0300 +++ b/searchui/indevicehandler/src/indevicehandler.cpp Wed Aug 18 09:49:49 2010 +0300 @@ -15,8 +15,8 @@ * */ #include "indevicehandler.h" -#include -#include +#include +#include // --------------------------------------------------------------------------- // InDeviceHandler::InDeviceHandler() @@ -34,11 +34,17 @@ { if (mSearchInterface) { + disconnect(mSearchInterface, SIGNAL(handleSearchResults(int,int)), + this, SLOT(getSearchResult(int,int))); + disconnect(mSearchInterface, + SIGNAL(handleDocument(int,CpixDocument*)), this, + SLOT(getDocumentAsync(int,CpixDocument*))); + disconnect(mSearchInterface, + SIGNAL(handleDocument(int,CpixDocument*)), this, + SLOT(getDocumentAsync(int,CpixDocument*))); delete mSearchInterface; - } } - // --------------------------------------------------------------------------- // InDeviceHandler::getSearchResult(int aError, int estimatedResultCount) // aError: error code @@ -47,33 +53,43 @@ // void InDeviceHandler::getSearchResult(int aError, int estimatedResultCount) { - qDebug() << aError << estimatedResultCount; mSearchResultCount = estimatedResultCount; emit handleAsyncSearchResult(aError, estimatedResultCount); } // --------------------------------------------------------------------------- -// InDeviceHandler::getDocumentAsync(int aError, QCPixDocument* aDocument) +// InDeviceHandler::getDocumentAsync(int aError, CpixDocument* aDocument) // aError: error code // aDocument: holding the result item // --------------------------------------------------------------------------- // -void InDeviceHandler::getDocumentAsync(int aError, QCPixDocument* aDocument) +void InDeviceHandler::getDocumentAsync(int aError, CpixDocument* aDocument) { emit handleDocument(aError, aDocument); } // --------------------------------------------------------------------------- +// InDeviceHandler::getBatchDocumentAsync(int aError, CpixDocument* aDocument) +// aError: error code +// aDocument: holding the result item +// --------------------------------------------------------------------------- +// +void InDeviceHandler::getBatchDocumentAsync(int aError, int aCount, + CpixDocument** aDocument) + { + emit handleBatchDocument(aError, aCount, aDocument); + } +// --------------------------------------------------------------------------- // InDeviceHandler::getDocumentAtIndex(int aIndex) // aIndex: item index to be found // --------------------------------------------------------------------------- // -QCPixDocument* InDeviceHandler::getDocumentAtIndex(int aIndex) +CpixDocument* InDeviceHandler::getDocumentAtIndex(int aIndex) { - QCPixDocument* doc = NULL; + CpixDocument* doc = NULL; if (mSearchInterface) { try { - doc = mSearchInterface->getDocument(aIndex); + doc = mSearchInterface->document(aIndex); } catch (...) @@ -85,7 +101,6 @@ return doc; } - // --------------------------------------------------------------------------- // InDeviceHandler::getSearchResultCount() // gets the number of hits @@ -106,7 +121,7 @@ { try { - mSearchInterface->getDocumentAsync(aIndex); + mSearchInterface->documentAsync(aIndex); } catch (...) { @@ -114,7 +129,27 @@ return; } } - + } +// --------------------------------------------------------------------------- +// InDeviceHandler::getBatchDocumentAsyncAtIndex +// aIndex : index of item to be found async +// aCount : number of result items +// --------------------------------------------------------------------------- +// +void InDeviceHandler::getBatchDocumentAsyncAtIndex(int aIndex, int aCount) + { + if (mSearchInterface) + { + try + { + mSearchInterface->batchdocumentAsync(aIndex, aCount); + } + catch (...) + { + // handle the exception + return; + } + } } // --------------------------------------------------------------------------- // InDeviceHandler::searchAsync @@ -148,7 +183,6 @@ void InDeviceHandler::cancelLastSearch() { if (mSearchInterface) - { try { @@ -177,37 +211,23 @@ { QString database("root "); database.append(astring); - mSearchInterface = QCPixSearcher::newInstance(database, + mSearchInterface = CpixSearcher::newInstance(database, DEFAULT_SEARCH_FIELD); } else { - mSearchInterface = QCPixSearcher::newInstance("root", - DEFAULT_SEARCH_FIELD); + mSearchInterface = CpixSearcher::newInstance("root", + DEFAULT_SEARCH_FIELD); } if (mSearchInterface) { - try - { - mSearchInterface->connect(mSearchInterface, - SIGNAL(handleSearchResults(int,int)), this, - SLOT(getSearchResult(int,int))); - } - catch (...) - { - // handle the exception - } - - try - { - mSearchInterface->connect(mSearchInterface, - SIGNAL(handleDocument(int,QCPixDocument*)), this, - SLOT(getDocumentAsync(int,QCPixDocument*))); - } - catch (...) - { - // handle the exception - } + connect(mSearchInterface, SIGNAL(handleSearchResults(int,int)), this, + SLOT(getSearchResult(int,int))); + connect(mSearchInterface, SIGNAL(handleDocument(int,CpixDocument*)), + this, SLOT(getDocumentAsync(int,CpixDocument*))); + connect(mSearchInterface, + SIGNAL(handleBatchDocuments(int,int,CpixDocument**)), this, + SLOT(getBatchDocumentAsync(int,int,CpixDocument**))); } } @@ -222,7 +242,5 @@ { return true; } - return false; - }