~ubuntu-branches/ubuntu/maverick/datakiosk/maverick

« back to all changes in this revision

Viewing changes to src/src/searchwidget.h

  • Committer: Bazaar Package Importer
  • Author(s): Jonathan Riddell
  • Date: 2005-06-27 22:48:06 UTC
  • Revision ID: james.westby@ubuntu.com-20050627224806-8farkci1dc2onhbs
Tags: upstream-0.7
ImportĀ upstreamĀ versionĀ 0.7

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/***************************************************************************
 
2
 *   Copyright (C) 2005 by Adam Treat                                      *
 
3
 *   treat@kde.org                                                         *
 
4
 *                                                                         *
 
5
 *   Copyright (C) 2004 by Scott Wheeler                                   *
 
6
 *   wheeler@kde.org                                                       *
 
7
 *                                                                         *
 
8
 *   This program is free software; you can redistribute it and/or modify  *
 
9
 *   it under the terms of the GNU General Public License as published by  *
 
10
 *   the Free Software Foundation; either version 2 of the License, or     *
 
11
 *   (at your option) any later version.                                   *
 
12
 *                                                                         *
 
13
 ***************************************************************************/
 
14
 
 
15
#ifndef SEARCHWIDGET_H
 
16
#define SEARCHWIDGET_H
 
17
 
 
18
#include <ktoolbar.h>
 
19
#include <qhbox.h>
 
20
 
 
21
#include "datatablesearch.h"
 
22
 
 
23
class QCheckBox;
 
24
class KComboBox;
 
25
class KTextEdit;
 
26
class DataTable;
 
27
typedef QValueList<DataTableSearch> DataSearchList;
 
28
 
 
29
class SearchLine : public QHBox
 
30
{
 
31
    Q_OBJECT
 
32
 
 
33
public:
 
34
 
 
35
    SearchLine( QWidget *parent, DataTableList dataTables = DataTableList(),
 
36
                bool simple = false, const char *name = 0 );
 
37
    virtual ~SearchLine()
 
38
    {}
 
39
 
 
40
    DataTableSearch::Component searchComponent() const;
 
41
    void setSearchComponent( const DataTableSearch::Component &component );
 
42
 
 
43
    bool isPrompt() const;
 
44
    void setPrompt( bool prompt );
 
45
 
 
46
public slots:
 
47
    void clear();
 
48
    void searchFieldChanged();
 
49
    void setText( const QString &txt );
 
50
 
 
51
signals:
 
52
    void signalQueryChanged();
 
53
    void signalClearAdvancedQuery();
 
54
 
 
55
private:
 
56
    void updateColumns();
 
57
 
 
58
private:
 
59
    DataTableList m_dataTables;
 
60
    bool m_simple;
 
61
    bool m_calendarMode;
 
62
    KComboBox *m_searchFieldsBox;
 
63
    KComboBox *m_operator;
 
64
    QCheckBox *m_prompt;
 
65
    KLineEdit *m_lineEdit;
 
66
};
 
67
 
 
68
class AdvancedLine : public QHBox
 
69
{
 
70
    Q_OBJECT
 
71
 
 
72
public:
 
73
 
 
74
    AdvancedLine( QWidget *parent, DataTableList dataTables = DataTableList(),
 
75
                const char *name = 0 );
 
76
    virtual ~AdvancedLine()
 
77
    {}
 
78
 
 
79
    DataTableSearch::Component searchComponent() const;
 
80
    void setSearchComponent( const DataTableSearch::Component &component );
 
81
 
 
82
public slots:
 
83
    void clear();
 
84
    void searchTableChanged();
 
85
 
 
86
private:
 
87
    void updateTables();
 
88
 
 
89
private:
 
90
    DataTableList m_dataTables;
 
91
    KTextEdit *m_customSqlQuery;
 
92
    KComboBox *m_searchTablesBox;
 
93
};
 
94
 
 
95
class SearchWidget : public KToolBar
 
96
{
 
97
    Q_OBJECT
 
98
 
 
99
public:
 
100
    SearchWidget( QWidget *parent, const char *name = 0 );
 
101
    virtual ~SearchWidget();
 
102
 
 
103
    DataTableSearch createSearch( const DataTableList &dataTables ) const;
 
104
    DataTableSearch search() const;
 
105
    void setSearch( const DataTableSearch &search );
 
106
    DataSearchList searchList( const DataTableList &dataTables ) const;
 
107
    void setSearchList( const DataSearchList &searchList );
 
108
    void searchRemoved();
 
109
 
 
110
public slots:
 
111
    void clear();
 
112
    void setLineEnabled( bool enable );
 
113
    void setEnabled( bool enable );
 
114
    void searchListChanged();
 
115
    void invokeSearch( const QString &search );
 
116
 
 
117
signals:
 
118
    void signalQueryChanged();
 
119
    void signalClearAdvancedQuery();
 
120
    void signalSearchListChanged( const DataTableSearch &search );
 
121
 
 
122
    // This signal is only emitted when the Show/Hide action is triggered.
 
123
    // Minimizing/closing the DataKiosk window will not trigger this signal.
 
124
 
 
125
    void signalShown( bool shown );
 
126
 
 
127
private:
 
128
    void setupLayout();
 
129
 
 
130
private:
 
131
    SearchLine *m_searchLine;
 
132
    KComboBox *m_searchCombo;
 
133
    DataTableSearch m_search;
 
134
    DataSearchList m_searchList;
 
135
    QStringList m_columnHeaders;
 
136
};
 
137
 
 
138
#endif