File indexing completed on 2024-04-28 16:26:26

0001 /******************************************************************************
0002   Copyright (C) 2005-2007 by Holger Danielsson (holger.danielsson@t-online.de)
0003             (C) 2019 by Michel Ludwig (michel.ludwig@kdemail.net)
0004  ******************************************************************************/
0005 
0006 /***************************************************************************
0007  *                                                                         *
0008  *   This program is free software; you can redistribute it and/or modify  *
0009  *   it under the terms of the GNU General Public License as published by  *
0010  *   the Free Software Foundation; either version 2 of the License, or     *
0011  *   (at your option) any later version.                                   *
0012  *                                                                         *
0013  ***************************************************************************/
0014 
0015 #ifndef TEXDOCUMENTATIONDIALOG_H
0016 #define TEXDOCUMENTATIONDIALOG_H
0017 
0018 #include <QDialog>
0019 
0020 #include <QMap>
0021 #include <QProcess>
0022 
0023 class QTreeWidget;
0024 class QTreeWidgetItem;
0025 
0026 class KProcess;
0027 class QDialogButtonBox;
0028 class QLineEdit;
0029 class QPushButton;
0030 class QTemporaryFile;
0031 
0032 namespace KileDialog
0033 {
0034 
0035 class TexDocDialog : public QDialog
0036 {
0037     Q_OBJECT
0038 
0039 public:
0040     explicit TexDocDialog(QWidget *parent = 0);
0041     ~TexDocDialog();
0042 
0043 private:
0044     QTreeWidget *m_texdocs;
0045     QLineEdit *m_leKeywords;
0046     QPushButton *m_pbSearch;
0047     QDialogButtonBox *m_buttonBox;
0048 
0049     QString m_texmfPath, m_texmfdocPath, m_texdoctkPath;
0050 
0051     QStringList m_tocList, m_tocSearchList;
0052     QMap<QString, QString> m_dictDocuments;
0053 
0054     void readToc();
0055     void showToc(const QString &caption, const QStringList &doclist, bool toc = true);
0056 
0057     QString m_filename;
0058     QString m_output;
0059 
0060     QTemporaryFile *m_tempfile;
0061     KProcess *m_proc;
0062 
0063     void callSearch();
0064     void executeScript(const QString &command);
0065     void showFile(const QString &filename);
0066 
0067     QString searchFile(const QString &docfilename, const QString &listofpathes,
0068                        const QString &subdir = QString());
0069     QString findFile(const QString &docfilename);
0070 
0071     QString getMimeType(const QString &filename);
0072     QString getIconName(const QString &filename);
0073 
0074 protected:
0075     virtual bool eventFilter(QObject *o, QEvent *e) override;
0076 
0077 Q_SIGNALS:
0078     void processFinished();
0079 
0080 private Q_SLOTS:
0081     void slotListViewDoubleClicked(QTreeWidgetItem *item);
0082     void slotTextChanged(const QString &text);
0083     void slotSearchClicked();
0084     void slotResetSearch();
0085 
0086     void slotProcessOutput();
0087     void slotProcessExited(int, QProcess::ExitStatus);
0088 
0089     void slotInitToc();
0090     void slotShowFile();
0091 };
0092 
0093 }
0094 
0095 #endif