1 | /* |
2 | * This file is 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_NAVIGATOR_H |
22 | #define KHC_NAVIGATOR_H |
23 | |
24 | #include "glossary.h" |
25 | |
26 | #include <KUrl> |
27 | |
28 | #include <QFile> |
29 | #include <QTextStream> |
30 | #include <QTimer> |
31 | #include <QTabWidget> |
32 | #include <QTreeWidget> |
33 | #include <QFrame> |
34 | |
35 | class QPushButton; |
36 | class KLineEdit; |
37 | class KCMHelpCenter; |
38 | |
39 | namespace KHC { |
40 | |
41 | class NavigatorItem; |
42 | class Navigator; |
43 | class View; |
44 | class SearchEngine; |
45 | class SearchWidget; |
46 | class Formatter; |
47 | |
48 | class Navigator : public QWidget |
49 | { |
50 | Q_OBJECT |
51 | public: |
52 | explicit Navigator(View *, QWidget *parent=0, const char *name=0); |
53 | virtual ~Navigator(); |
54 | |
55 | KUrl homeURL(); |
56 | |
57 | SearchEngine *searchEngine() const; |
58 | Formatter *formatter() const; |
59 | |
60 | const GlossaryEntry &glossEntry(const QString &term) const { return mGlossaryTree->entry( term ); } |
61 | |
62 | void insertParentAppDocs( const QString &name, NavigatorItem *parent ); |
63 | NavigatorItem *insertScrollKeeperDocs( NavigatorItem *parentItem, |
64 | NavigatorItem *after ); |
65 | void insertInfoDocs( NavigatorItem *parentItem ); |
66 | void insertKCMDocs(const QString &, NavigatorItem*parent, const QString &); |
67 | void insertIOSlaveDocs(const QString &, NavigatorItem*parent); |
68 | |
69 | void createItemFromDesktopFile( NavigatorItem *item, const QString &name ); |
70 | |
71 | bool showMissingDocs() const; |
72 | |
73 | void clearSelection(); |
74 | |
75 | void showOverview( NavigatorItem *item, const KUrl &url ); |
76 | |
77 | void readConfig(); |
78 | void writeConfig(); |
79 | |
80 | public Q_SLOTS: |
81 | void openInternalUrl( const KUrl &url ); |
82 | void slotItemSelected(QTreeWidgetItem* index); |
83 | void slotSearch(); |
84 | void slotShowSearchResult( const QString & ); |
85 | void slotSelectGlossEntry( const QString &id ); |
86 | void selectItem( const KUrl &url ); |
87 | void showIndexDialog(); |
88 | |
89 | Q_SIGNALS: |
90 | void itemSelected(const QString& itemURL); |
91 | void glossSelected(const GlossaryEntry &entry); |
92 | |
93 | protected Q_SLOTS: |
94 | void slotSearchFinished(); |
95 | void slotTabChanged( QWidget * ); |
96 | void checkSearchButton(); |
97 | |
98 | bool checkSearchIndex(); |
99 | |
100 | void clearSearch(); |
101 | |
102 | protected: |
103 | QString createChildrenList( QTreeWidgetItem *child ); |
104 | |
105 | private: |
106 | void setupContentsTab(); |
107 | void setupIndexTab(); |
108 | void setupSearchTab(); |
109 | void setupGlossaryTab(); |
110 | |
111 | void insertPlugins(); |
112 | void hideSearch(); |
113 | |
114 | QTreeWidget *mContentsTree; |
115 | Glossary *mGlossaryTree; |
116 | |
117 | SearchWidget *mSearchWidget; |
118 | KCMHelpCenter *mIndexDialog; |
119 | |
120 | QTabWidget *mTabWidget; |
121 | |
122 | QFrame *mSearchFrame; |
123 | KLineEdit *mSearchEdit; |
124 | QPushButton *mSearchButton; |
125 | |
126 | bool mShowMissingDocs; |
127 | |
128 | SearchEngine *mSearchEngine; |
129 | |
130 | View *mView; |
131 | |
132 | KUrl mHomeUrl; |
133 | |
134 | bool mSelected; |
135 | |
136 | KUrl mLastUrl; |
137 | |
138 | int mDirLevel; |
139 | }; |
140 | |
141 | } |
142 | |
143 | #endif //KHC_NAVIGATOR_H |
144 | // vim:ts=2:sw=2:et |
145 | |