1 /***************************************************************************
2                          texdocdialog.h
3                          --------------
4     date                 : Feb 15 2007
5     version              : 0.14
6     copyright            : (C) 2005-2007 by Holger Danielsson
7     email                : holger.danielsson@versanet.de
8  ***************************************************************************/
9 
10 /***************************************************************************
11  *                                                                         *
12  *   This program is free software; you can redistribute it and/or modify  *
13  *   it under the terms of the GNU General Public License as published by  *
14  *   the Free Software Foundation; either version 2 of the License, or     *
15  *   (at your option) any later version.                                   *
16  *                                                                         *
17  ***************************************************************************/
18 
19 #ifndef TEXDOCUMENTATIONDIALOG_H
20 #define TEXDOCUMENTATIONDIALOG_H
21 
22 #include <QDialog>
23 
24 #include <QMap>
25 #include <QProcess>
26 
27 class QTreeWidget;
28 class QTreeWidgetItem;
29 
30 class KProcess;
31 class QDialogButtonBox;
32 class QLineEdit;
33 class QPushButton;
34 class QTemporaryFile;
35 
36 namespace KileDialog
37 {
38 
39 class TexDocDialog : public QDialog
40 {
41     Q_OBJECT
42 
43 public:
44     explicit TexDocDialog(QWidget *parent = 0);
45     ~TexDocDialog();
46 
47 private:
48     QTreeWidget *m_texdocs;
49     QLineEdit *m_leKeywords;
50     QPushButton *m_pbSearch;
51     QDialogButtonBox *m_buttonBox;
52 
53     QString m_texmfPath, m_texmfdocPath, m_texdoctkPath;
54 
55     QStringList m_tocList, m_tocSearchList;
56     QMap<QString, QString> m_dictDocuments;
57     QMap<QString, QString> m_dictStyleCodes;
58 
59     void readToc();
60     void showToc(const QString &caption, const QStringList &doclist, bool toc = true);
61 
62     QString m_filename;
63     QString m_output;
64 
65     QTemporaryFile *m_tempfile;
66     KProcess *m_proc;
67 
68     void callSearch();
69     void executeScript(const QString &command);
70     void showFile(const QString &filename);
71 
72     QString searchFile(const QString &docfilename, const QString &listofpathes,
73                        const QString &subdir = QString());
74     void decompressFile(const QString &docfile, const QString &command);
75     void showStyleFile(const QString &filename, const QString &stylecode);
76 
77     QString getMimeType(const QString &filename);
78     QString getIconName(const QString &filename);
79 
80 protected:
81     virtual bool eventFilter(QObject *o, QEvent *e) override;
82 
83 Q_SIGNALS:
84     void processFinished();
85 
86 private Q_SLOTS:
87     void slotListViewDoubleClicked(QTreeWidgetItem *item);
88     void slotTextChanged(const QString &text);
89     void slotSearchClicked();
90     void slotResetSearch();
91 
92     void slotProcessOutput();
93     void slotProcessExited(int, QProcess::ExitStatus);
94 
95     void slotInitToc();
96     void slotShowFile();
97 };
98 
99 }
100 
101 #endif
102