qcpix/tsrc/samplesearch/samplesearch.h
changeset 0 671dee74050a
child 13 fcb2a58c181b
equal deleted inserted replaced
-1:000000000000 0:671dee74050a
       
     1 /*
       
     2 * Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description: 
       
    15 *
       
    16 */
       
    17 
       
    18 #ifndef SAMPLESEARCH_H
       
    19 #define SAMPLESEARCH_H
       
    20 
       
    21 #include <QtGui/QMainWindow>
       
    22 #include <QLineEdit>
       
    23 #include <QTableWidget>
       
    24 #include <QPushButton>
       
    25 #include <QVBoxLayout>
       
    26 #include <QHBoxLayout>
       
    27 #include <QLabel>
       
    28 #include <QDesktopWidget>
       
    29 #include <QApplication>
       
    30 #include <QTableWidgetItem>
       
    31 #include <QMessageBox>
       
    32 #include <QVector>
       
    33 
       
    34 class CSearchHandler;
       
    35 class QCPixDocument;
       
    36 class DocLaunchInfo;
       
    37 
       
    38 class SampleSearch : public QWidget
       
    39 {
       
    40     Q_OBJECT
       
    41 
       
    42 public:
       
    43 	SampleSearch(QWidget *parent = 0);
       
    44     ~SampleSearch();
       
    45 private:
       
    46     QLineEdit* txtSearch;
       
    47     QPushButton* btnSearch;
       
    48     QPushButton* btnSearchAsync;
       
    49     QTableWidget* dataTable;
       
    50     int noOfItemsPerPage;
       
    51     int iCurrentPageNum;
       
    52     CSearchHandler* iSearchHandler;
       
    53     int iSearchResultsCount;
       
    54     int noOfPages; 
       
    55     QPushButton* btnNext;
       
    56     QPushButton* btnPrev;
       
    57     QVBoxLayout* rootLayout;
       
    58     QHBoxLayout* rowLayout;
       
    59     QHBoxLayout* rowButtonLayout;
       
    60     QLabel* lbCaption;
       
    61     QHBoxLayout* layoutForNavButton;
       
    62     QLabel * iSearchResultLabel;
       
    63     QLineEdit* txtSearchResultCount;
       
    64     QLabel * iPageInfoLabel;
       
    65     QHBoxLayout* searchResultLayout;
       
    66     int currentRow;
       
    67     int nextDocumentIndex;
       
    68     bool asyncSearch;
       
    69     QVector<DocLaunchInfo*> docInfo;
       
    70     QMessageBox mBox;
       
    71     
       
    72 private:
       
    73     void clearSearchResults();
       
    74     int getStartIndexForPage();
       
    75     void createSearchResultTableAndAddContents();
       
    76     void searchCompleteHelper(int aError, int aResultCount);
       
    77     void setSearchResultsHeader();
       
    78     void addDocumentToResultsPage( QCPixDocument* aSearchDoc, int rowCount );
       
    79     void openMessaging( int aMessagingId );
       
    80     void doLaunchDoc(DocLaunchInfo& info);
       
    81     
       
    82 private slots:
       
    83     void launchDoc(int,int);
       
    84     void doSearch();
       
    85     void doSearchAsync();
       
    86     void onSearchComplete(int aError, int aResultCount);
       
    87     void onAsyncSearchComplete(int aError, int aResultCount);
       
    88     void onGetDocumentComplete(int aError, QCPixDocument* aDoc);
       
    89     void displayNextPage();
       
    90     void displayPrevPage();   
       
    91 };
       
    92 
       
    93 #endif // SAMPLESEARCH_H