File indexing completed on 2024-04-28 05:49:19

0001 /***************************************************************************
0002                           plugin_katexmlcheck.h
0003                           -------------------
0004    begin                : 2002-07-06
0005    copyright            : (C) 2002 by Daniel Naber
0006    email                : daniel.naber@t-online.de
0007 ***************************************************************************/
0008 
0009 /***************************************************************************
0010  This program is free software; you can redistribute it and/or
0011  modify it under the terms of the GNU General Public License
0012  as published by the Free Software Foundation; either version 2
0013  of the License, or (at your option) any later version.
0014 
0015  This program is distributed in the hope that it will be useful,
0016  but WITHOUT ANY WARRANTY; without even the implied warranty of
0017  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
0018  GNU General Public License for more details.
0019 
0020  You should have received a copy of the GNU General Public License
0021  along with this program; if not, write to the Free Software
0022  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
0023  ***************************************************************************/
0024 
0025 #pragma once
0026 
0027 #include "diagnostics/diagnosticview.h"
0028 
0029 #include <ktexteditor/application.h>
0030 #include <ktexteditor/document.h>
0031 #include <ktexteditor/mainwindow.h>
0032 #include <ktexteditor/plugin.h>
0033 #include <ktexteditor/view.h>
0034 
0035 #include <QProcess>
0036 #include <QString>
0037 #include <QVariantList>
0038 
0039 class QTreeWidget;
0040 class QTreeWidgetItem;
0041 class QTemporaryFile;
0042 
0043 class PluginKateXMLCheckView : public QObject, public KXMLGUIClient
0044 {
0045     Q_OBJECT
0046 
0047 public:
0048     PluginKateXMLCheckView(KTextEditor::Plugin *plugin, KTextEditor::MainWindow *mainwin);
0049     ~PluginKateXMLCheckView() override;
0050 
0051     KTextEditor::MainWindow *m_mainWindow;
0052 
0053 public Q_SLOTS:
0054     bool slotValidate();
0055     void slotProcExited(int exitCode, QProcess::ExitStatus exitStatus);
0056     static void slotUpdate();
0057 
0058 private:
0059     QTemporaryFile *m_tmp_file;
0060     bool m_validating = false;
0061     QProcess m_proc;
0062     QString m_proc_stderr;
0063     QString m_dtdname;
0064     DiagnosticsProvider m_provider;
0065 };
0066 
0067 class PluginKateXMLCheck : public KTextEditor::Plugin
0068 {
0069     Q_OBJECT
0070 
0071 public:
0072     explicit PluginKateXMLCheck(QObject *parent = nullptr, const QVariantList & = QVariantList());
0073 
0074     ~PluginKateXMLCheck() override;
0075     QObject *createView(KTextEditor::MainWindow *mainWindow) override;
0076 };