1
2/*
3 * toc.h - part of the KDE Help Center
4 *
5 * Copyright (C) 2002 Frerich Raabe (raabe@kde.org)
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
20 */
21
22#ifndef KHC_TOC_H
23#define KHC_TOC_H
24
25#include "navigatoritem.h"
26
27#include <QtXml/QtXml>
28
29#include <QTreeWidget>
30#include <QTreeWidgetItem>
31
32#include <QObject>
33
34#include <KProcess>
35
36namespace KHC {
37
38class TOC : public QObject
39{
40 Q_OBJECT
41 public:
42 TOC( NavigatorItem *parentItem );
43
44 QString application() const { return m_application; }
45 void setApplication( const QString &application ) { m_application = application; }
46
47 public Q_SLOTS:
48 void build( const QString &file );
49
50 Q_SIGNALS:
51 void itemSelected( const QString &url );
52
53 private Q_SLOTS:
54 void slotItemSelected( QTreeWidgetItem *item );
55 void meinprocExited( int exitCode, QProcess::ExitStatus exitStatus);
56
57 private:
58 enum CacheStatus { NeedRebuild, CacheOk };
59
60 CacheStatus cacheStatus() const;
61 int sourceFileCTime() const;
62 int cachedCTime() const;
63 QDomElement childElement( const QDomElement &e, const QString &name );
64 void buildCache();
65 void fillTree();
66
67 QString m_application;
68 QString m_cacheFile;
69 QString m_sourceFile;
70
71 NavigatorItem *m_parentItem;
72 static bool m_alreadyWarned;
73};
74
75}
76
77#endif // KHC_TOC_H
78// vim:ts=2:sw=2:et
79