15 * |
15 * |
16 */ |
16 */ |
17 |
17 |
18 #include "SampleSearch.h" |
18 #include "SampleSearch.h" |
19 #include "searchhandler.h" |
19 #include "searchhandler.h" |
20 #include <QCPixDocument.h> |
20 #include <cpixdocument.h> |
21 #include <xqservicerequest.h> |
21 #include <xqservicerequest.h> |
22 |
22 |
23 SampleSearch::SampleSearch(QWidget */*parent*/) |
23 SampleSearch::SampleSearch(QWidget */*parent*/) |
24 { |
24 { |
25 iSearchHandler = new CSearchHandler(); |
25 iSearchHandler = new CSearchHandler(); |
96 setWindowTitle(tr("Search")); |
96 setWindowTitle(tr("Search")); |
97 connect(btnSearch, SIGNAL(clicked()),this, SLOT(doSearch())); |
97 connect(btnSearch, SIGNAL(clicked()),this, SLOT(doSearch())); |
98 connect(btnSearchAsync, SIGNAL(clicked()),this, SLOT(doSearchAsync())); |
98 connect(btnSearchAsync, SIGNAL(clicked()),this, SLOT(doSearchAsync())); |
99 connect(iSearchHandler, SIGNAL(handleSearchResult(int,int)),this, SLOT(onSearchComplete(int,int))); |
99 connect(iSearchHandler, SIGNAL(handleSearchResult(int,int)),this, SLOT(onSearchComplete(int,int))); |
100 connect(iSearchHandler, SIGNAL(handleAsyncSearchResult(int,int)),this, SLOT(onAsyncSearchComplete(int,int))); |
100 connect(iSearchHandler, SIGNAL(handleAsyncSearchResult(int,int)),this, SLOT(onAsyncSearchComplete(int,int))); |
101 connect(iSearchHandler, SIGNAL(handleDocument(int,QCPixDocument*)),this, SLOT(onGetDocumentComplete(int,QCPixDocument*))); |
101 connect(iSearchHandler, SIGNAL(handleDocument(int,CpixDocument*)),this, SLOT(onGetDocumentComplete(int,CpixDocument*))); |
102 } |
102 } |
103 |
103 |
104 SampleSearch::~SampleSearch() |
104 SampleSearch::~SampleSearch() |
105 { |
105 { |
106 delete dataTable; |
106 delete dataTable; |
140 currentRow = 0; |
140 currentRow = 0; |
141 nextDocumentIndex = 0; |
141 nextDocumentIndex = 0; |
142 iSearchHandler->getDocumentAsyncAtIndex( nextDocumentIndex++ ); |
142 iSearchHandler->getDocumentAsyncAtIndex( nextDocumentIndex++ ); |
143 } |
143 } |
144 |
144 |
145 void SampleSearch::onGetDocumentComplete(int aError, QCPixDocument* aDoc) |
145 void SampleSearch::onGetDocumentComplete(int aError, CpixDocument* aDoc) |
146 { |
146 { |
147 if( aDoc == NULL ) return; |
147 if( aDoc == NULL ) return; |
148 addDocumentToResultsPage( aDoc, currentRow++ ); |
148 addDocumentToResultsPage( aDoc, currentRow++ ); |
149 if( currentRow < noOfItemsPerPage ) |
149 if( currentRow < noOfItemsPerPage ) |
150 iSearchHandler->getDocumentAsyncAtIndex( nextDocumentIndex++ ); |
150 iSearchHandler->getDocumentAsyncAtIndex( nextDocumentIndex++ ); |
310 public: |
310 public: |
311 QString type; |
311 QString type; |
312 QString docId; |
312 QString docId; |
313 }; |
313 }; |
314 |
314 |
315 void SampleSearch::addDocumentToResultsPage( QCPixDocument* aSearchDoc, int rowCount ) |
315 void SampleSearch::addDocumentToResultsPage( CpixDocument* aSearchDoc, int rowCount ) |
316 { |
316 { |
317 QTableWidgetItem *appClassCol = new QTableWidgetItem("Col1"); |
317 QTableWidgetItem *appClassCol = new QTableWidgetItem("Col1"); |
318 appClassCol->setFlags(Qt::ItemIsEnabled); |
318 appClassCol->setFlags(Qt::ItemIsEnabled); |
319 |
319 |
320 QTableWidgetItem *docuidCol = new QTableWidgetItem("Col2"); |
320 QTableWidgetItem *docuidCol = new QTableWidgetItem("Col2"); |