13 * |
13 * |
14 * Description: Implementation indevice handler |
14 * Description: Implementation indevice handler |
15 * |
15 * |
16 */ |
16 */ |
17 #include "indevicehandler.h" |
17 #include "indevicehandler.h" |
18 #include <qcpixsearcher.h> |
18 #include <cpixsearcher.h> |
19 #include <qcpixdocument.h> |
19 #include <cpixdocument.h> |
20 |
20 |
21 // --------------------------------------------------------------------------- |
21 // --------------------------------------------------------------------------- |
22 // InDeviceHandler::InDeviceHandler() |
22 // InDeviceHandler::InDeviceHandler() |
23 // --------------------------------------------------------------------------- |
23 // --------------------------------------------------------------------------- |
24 // |
24 // |
50 qDebug() << aError << estimatedResultCount; |
50 qDebug() << aError << estimatedResultCount; |
51 mSearchResultCount = estimatedResultCount; |
51 mSearchResultCount = estimatedResultCount; |
52 emit handleAsyncSearchResult(aError, estimatedResultCount); |
52 emit handleAsyncSearchResult(aError, estimatedResultCount); |
53 } |
53 } |
54 // --------------------------------------------------------------------------- |
54 // --------------------------------------------------------------------------- |
55 // InDeviceHandler::getDocumentAsync(int aError, QCPixDocument* aDocument) |
55 // InDeviceHandler::getDocumentAsync(int aError, CpixDocument* aDocument) |
56 // aError: error code |
56 // aError: error code |
57 // aDocument: holding the result item |
57 // aDocument: holding the result item |
58 // --------------------------------------------------------------------------- |
58 // --------------------------------------------------------------------------- |
59 // |
59 // |
60 void InDeviceHandler::getDocumentAsync(int aError, QCPixDocument* aDocument) |
60 void InDeviceHandler::getDocumentAsync(int aError, CpixDocument* aDocument) |
61 { |
61 { |
62 emit handleDocument(aError, aDocument); |
62 emit handleDocument(aError, aDocument); |
63 } |
63 } |
64 // --------------------------------------------------------------------------- |
64 // --------------------------------------------------------------------------- |
65 // InDeviceHandler::getDocumentAtIndex(int aIndex) |
65 // InDeviceHandler::getDocumentAtIndex(int aIndex) |
66 // aIndex: item index to be found |
66 // aIndex: item index to be found |
67 // --------------------------------------------------------------------------- |
67 // --------------------------------------------------------------------------- |
68 // |
68 // |
69 QCPixDocument* InDeviceHandler::getDocumentAtIndex(int aIndex) |
69 CpixDocument* InDeviceHandler::getDocumentAtIndex(int aIndex) |
70 { |
70 { |
71 QCPixDocument* doc = NULL; |
71 CpixDocument* doc = NULL; |
72 if (mSearchInterface) |
72 if (mSearchInterface) |
73 { |
73 { |
74 try |
74 try |
75 { |
75 { |
76 doc = mSearchInterface->getDocument(aIndex); |
76 doc = mSearchInterface->document(aIndex); |
77 |
77 |
78 } |
78 } |
79 catch (...) |
79 catch (...) |
80 { |
80 { |
81 delete doc; |
81 delete doc; |
175 } |
175 } |
176 if (astring.length()) |
176 if (astring.length()) |
177 { |
177 { |
178 QString database("root "); |
178 QString database("root "); |
179 database.append(astring); |
179 database.append(astring); |
180 mSearchInterface = QCPixSearcher::newInstance(database, |
180 mSearchInterface = CpixSearcher::newInstance(database, |
181 DEFAULT_SEARCH_FIELD); |
181 DEFAULT_SEARCH_FIELD); |
182 } |
182 } |
183 else |
183 else |
184 { |
184 { |
185 mSearchInterface = QCPixSearcher::newInstance("root", |
185 mSearchInterface = CpixSearcher::newInstance("root", |
186 DEFAULT_SEARCH_FIELD); |
186 DEFAULT_SEARCH_FIELD); |
187 } |
187 } |
188 if (mSearchInterface) |
188 if (mSearchInterface) |
189 { |
189 { |
190 try |
190 try |
199 } |
199 } |
200 |
200 |
201 try |
201 try |
202 { |
202 { |
203 mSearchInterface->connect(mSearchInterface, |
203 mSearchInterface->connect(mSearchInterface, |
204 SIGNAL(handleDocument(int,QCPixDocument*)), this, |
204 SIGNAL(handleDocument(int,CpixDocument*)), this, |
205 SLOT(getDocumentAsync(int,QCPixDocument*))); |
205 SLOT(getDocumentAsync(int,CpixDocument*))); |
206 } |
206 } |
207 catch (...) |
207 catch (...) |
208 { |
208 { |
209 // handle the exception |
209 // handle the exception |
210 } |
210 } |