1/*
2 * searchwidget.h - part of the KDE Help Center
3 *
4 * Copyright (C) 1999 Matthias Elter (me@kde.org)
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
19 */
20
21#ifndef KHC_SEARCHWIDGET_H
22#define KHC_SEARCHWIDGET_H
23
24#include <QWidget>
25#include <QtDBus/QtDBus>
26
27#include "docmetainfo.h"
28
29class QTreeWidgetItem;
30class QTreeWidget;
31class QTreeWidgetItem;
32class QComboBox;
33
34class KConfig;
35
36
37namespace KHC {
38
39class SearchEngine;
40
41class SearchWidget : public QWidget
42{
43 Q_OBJECT
44 Q_CLASSINFO("D-Bus Interface", "org.kde.khelpcenter.searchwidget")
45
46public Q_SLOTS:
47 Q_SCRIPTABLE Q_NOREPLY void searchIndexUpdated(); // called from kcmhelpcenter
48
49 public:
50 explicit SearchWidget ( SearchEngine *, QWidget *parent = 0 );
51 ~SearchWidget();
52
53 QString method();
54 int pages();
55 QString scope();
56
57 QTreeWidget *listView() { return mScopeListView; }
58
59 enum { ScopeDefault, ScopeAll, ScopeNone, ScopeCustom, ScopeNum };
60
61 QString scopeSelectionLabel( int ) const;
62
63 void readConfig( KConfig * );
64 void writeConfig( KConfig * );
65
66 int scopeCount() const;
67
68 SearchEngine *engine() const { return mEngine; }
69
70 Q_SIGNALS:
71 void searchResult( const QString &url );
72 void scopeCountChanged( int );
73 void showIndexDialog();
74
75 public Q_SLOTS:
76 void slotSwitchBoxes();
77 void scopeSelectionChanged( int );
78 void updateScopeList();
79
80 protected:
81 void checkScope();
82
83 protected Q_SLOTS:
84 void scopeDoubleClicked( QTreeWidgetItem* );
85 void scopeClicked( QTreeWidgetItem* );
86
87 private:
88 void loadLanguages();
89
90 SearchEngine *mEngine;
91
92 QComboBox *mMethodCombo;
93 QComboBox *mPagesCombo;
94 QComboBox *mScopeCombo;
95 QTreeWidget *mScopeListView;
96
97 int mScopeCount;
98};
99
100}
101
102#endif //KHC_SEARCHWIDGET_H
103// vim:ts=2:sw=2:et
104