summaryrefslogtreecommitdiffstats
path: root/kate/xmlcheck
diff options
context:
space:
mode:
authortoma <toma@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2009-11-25 17:56:58 +0000
committertoma <toma@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2009-11-25 17:56:58 +0000
commit84da08d7b7fcda12c85caeb5a10b4903770a6f69 (patch)
tree2a6aea76f2dfffb4cc04bb907c4725af94f70e72 /kate/xmlcheck
downloadtdeaddons-84da08d7b7fcda12c85caeb5a10b4903770a6f69.tar.gz
tdeaddons-84da08d7b7fcda12c85caeb5a10b4903770a6f69.zip
Copy the KDE 3.5 branch to branches/trinity for new KDE 3.5 features.
BUG:215923 git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdeaddons@1054174 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'kate/xmlcheck')
-rw-r--r--kate/xmlcheck/Makefile.am21
-rw-r--r--kate/xmlcheck/katexmlcheck.desktop122
-rw-r--r--kate/xmlcheck/plugin_katexmlcheck.cpp353
-rw-r--r--kate/xmlcheck/plugin_katexmlcheck.h87
-rw-r--r--kate/xmlcheck/ui.rc8
5 files changed, 591 insertions, 0 deletions
diff --git a/kate/xmlcheck/Makefile.am b/kate/xmlcheck/Makefile.am
new file mode 100644
index 0000000..f6554c2
--- /dev/null
+++ b/kate/xmlcheck/Makefile.am
@@ -0,0 +1,21 @@
+INCLUDES = $(all_includes)
+METASOURCES = AUTO
+
+# Install this plugin in the KDE modules directory
+kde_module_LTLIBRARIES = katexmlcheckplugin.la
+
+# This is all standard. Remove the LIB_KHTML reference if you are not
+# using the KHTML Part
+katexmlcheckplugin_la_SOURCES = plugin_katexmlcheck.cpp
+katexmlcheckplugin_la_LIBADD = -lkateinterfaces
+katexmlcheckplugin_la_LDFLAGS = -module $(KDE_PLUGIN) $(all_libraries)
+
+# Install the .rc file in the Part's directory (in this case, the part
+# is KHTMLPart)
+pluginsdir = $(kde_datadir)/kate/plugins/katexmlcheck
+plugins_DATA = ui.rc
+
+kde_services_DATA = katexmlcheck.desktop
+
+messages: rc.cpp
+ $(XGETTEXT) *.cpp -o $(podir)/katexmlcheck.pot
diff --git a/kate/xmlcheck/katexmlcheck.desktop b/kate/xmlcheck/katexmlcheck.desktop
new file mode 100644
index 0000000..bc6d031
--- /dev/null
+++ b/kate/xmlcheck/katexmlcheck.desktop
@@ -0,0 +1,122 @@
+[Desktop Entry]
+Type=Service
+ServiceTypes=Kate/Plugin
+X-KDE-Library=katexmlcheckplugin
+X-Kate-Version=2.5
+Name=Kate XML Validation
+Name[af]=Kate Xml Bekragting
+Name[az]=Kate XML Doğrulaması
+Name[ca]=Validació XML per a Kate
+Name[cs]=Validace XML pro Kate
+Name[cy]=Dilysiad XML Kate
+Name[da]=Kate XML-gyldighedstjek
+Name[de]=Kate-XML-Überprüfung
+Name[el]=Έλεγχος εγκυρότητας XML του Kate
+Name[eo]=XML-kontrolo por Kodredaktilo
+Name[es]=Validación XML para Kate
+Name[et]=Kate XML süntaksi kontrollija
+Name[eu]=Kateren XML balidazioa
+Name[fa]=اعتبارسنجی Kate XML
+Name[fi]=Kate XML validointi
+Name[fr]=Validation XML pour Kate
+Name[fy]=Kate XML-falidaasje
+Name[gl]=Validación de XML para Kate
+Name[he]=וידוא XML ל־Kate
+Name[hi]=के-एटीई एक्सएमएल वेलिडेशन
+Name[hr]=Kate XML validacija
+Name[hu]=Kate XML-ellenőrző
+Name[is]=Kate XML villuleit
+Name[it]=Validazione XML di Kate
+Name[ja]=Kate XML 検証
+Name[ka]=Kate XML დამმოწმებელი
+Name[kk]=Kate XML тексеруі
+Name[km]=សុពល​កម្ម​របស់ Kate XML
+Name[lt]=Kate XML tikrinimas
+Name[mk]=Валидација на XML во Кате
+Name[ms]=Pengesahan Kate XML
+Name[nb]=XML-validering til Kate
+Name[nds]=XML-Prööv för Kate
+Name[ne]=केट एक्सएमएल प्रमाणीकरण
+Name[nl]=Kate XML-validatie
+Name[nn]=XML-validering til Kate
+Name[nso]=Netefatso ya XML ya Kate
+Name[pa]=ਕੇਟ XML ਪੜਤਾਲ
+Name[pl]=Sprawdzenie poprawności XML-a
+Name[pt]=Validação de XML do Kate
+Name[pt_BR]=Validação XML do Kate
+Name[ro]=Validare XML pentru Kate
+Name[ru]=Проверка XML в Kate
+Name[sk]=Kate XML validácia
+Name[sl]=Potrjevanje XML v Kate
+Name[sr]=Провера XML-а за Kate
+Name[sr@Latn]=Provera XML-a za Kate
+Name[sv]=Kates XML-validering
+Name[ta]=கேட் XML மதிப்பிடுதல்
+Name[tg]=Тафтиши XML дар Kate
+Name[tr]=Kate XML Denetleme
+Name[uk]=Перевірка XML для Kate
+Name[uz]=Kate XML tekshirish
+Name[uz@cyrillic]=Kate XML текшириш
+Name[vi]=Thẩm tra XML Kate
+Name[xh]=Uvavanyo lwesiqiniseko se Kate XML
+Name[zh_CN]=Kate XML 校验
+Name[zh_TW]=Kate XML 驗證
+Comment=Validates XML files using xmllint
+Comment[ar]=يقوم بالتأكد من صلاحية ملفات XML باستخدام xmllint
+Comment[az]=xmllint işlədərək XML fayllarının doğrulamasını edir
+Comment[bg]=Валидиране на текущия документ XML чрез xmllint
+Comment[bs]=Provjerava ispravnost XML datoteka koristeći xmllint
+Comment[ca]=Valida fitxers XML emprant xmllint
+Comment[cs]=Validuje XML pomocí xmllint
+Comment[cy]=Dilysu ffeiliau XML gan ddefnyddio xmllint
+Comment[da]=Gyldighedstjekker XML-filer vha. xmllint
+Comment[de]=Überprüfung einer XML-Datei mit "xmllint"
+Comment[el]=Κάνει έλεγχο εγκυρότητας XML χρησιμοποιώντας το xmllint
+Comment[eo]=Kontrolas XML-dosierojn per xmllint
+Comment[es]=Valida archivos XML utilizando xmllint
+Comment[et]=Kontrollib XML-faile xmllint'i abil
+Comment[eu]=XML fitxategiak balidatzen ditu xmllint erabiliz
+Comment[fa]=پروندۀ XML را با استفاده از xmllint اعتبارسنجی می‌کند
+Comment[fi]=Validoi XML tiedostoja käyttäen xmllint ohjelmaa
+Comment[fr]=Valide un fichier XML en utilisant « xmllint »
+Comment[fy]=Falidearret XML-triemmen fia xmllint
+Comment[ga]=Bailíochtaigh comhaid XML le xmllint
+Comment[gl]=Valida ficheiros XML utilizando xmllint
+Comment[he]=וידוא קבצי XML באמצעות xmllint
+Comment[hi]=xmllint के उपयोग से XML फ़ाइलों को वेलिडेट करता है
+Comment[hr]=Validacija XML datoteke pomoću xmllint
+Comment[hu]=XML fájlok ellenőrzése az xmllint segítségével
+Comment[is]=Villuleitar XML skrár með xmllint
+Comment[it]=Valida i file XML usando xmllint
+Comment[ja]=xmllint で XML ファイルを検証します
+Comment[ka]=XML ფაილებს xmllint-ით ამოწმებს
+Comment[kk]=XML файлдарды xmllint көмегімен тексеру
+Comment[km]=ធ្វើឲ្យ​​ឯកសារ XML មាន​សុពល​ភាព​ដោយ​ប្រើ xmllint
+Comment[lt]=Tikrina XML bylas naudojant xmllint
+Comment[mk]=Валидира XML-датотеки со xmllint
+Comment[ms]=Mengesahkan fail XML menggunakan xmllint
+Comment[nb]=Validerer XML-filer vha xmllint
+Comment[nds]=Pröövt XML-Dateien mit "xmllint"
+Comment[ne]=xmllint प्रयोग गरेर एक्सएमएल फाइल प्रमाणित गर्छ
+Comment[nl]=Valideert XML-bestanden via xmllint
+Comment[nn]=Validerer XML-filer ved hjelp av xmllint
+Comment[pl]=Sprawdza poprawność plików XML za pomocą xmllint
+Comment[pt]=Valida ficheiros XML utilizando xmllint
+Comment[pt_BR]=Valida arquivos XML usando o xmllint
+Comment[ro]=Validează fişierele XML folosind utilitarul "xmllint"
+Comment[ru]=Проверка правильности XML с использованием xmllint
+Comment[sk]=Skontroluje vaše XML súbory pomocou xmllint
+Comment[sl]=Potrdi datoteke XML z uporabo xmllint
+Comment[sr]=Проверава XML фајлове користећи xmllint
+Comment[sr@Latn]=Proverava XML fajlove koristeći xmllint
+Comment[sv]=Validerar XML-filer med XMLlint
+Comment[ta]= XML கோப்புகளை xmllint கொண்டு மதிப்பிடும்
+Comment[tg]=Тафтиши дурустии XML бо истифодабарии xmllint
+Comment[tr]=xmllint kullanarak XML dosyalarını denetler
+Comment[uk]=Перевіряє файли XML за допомогою xmlinit
+Comment[uz]=Xmllint yordamida XML-fayllarni tekshirish
+Comment[uz@cyrillic]=Xmllint ёрдамида XML-файлларни текшириш
+Comment[vi]=Thẩm tra tập tin XML bằng xmllint
+Comment[xh]=Ivavanya isiqiniseko sefayile se XML isebenzisa ixmllint
+Comment[zh_CN]=使用 XMLLINT 来校验 XML 文件
+Comment[zh_TW]=使用 xmllint 驗證 XML 檔
diff --git a/kate/xmlcheck/plugin_katexmlcheck.cpp b/kate/xmlcheck/plugin_katexmlcheck.cpp
new file mode 100644
index 0000000..120e04e
--- /dev/null
+++ b/kate/xmlcheck/plugin_katexmlcheck.cpp
@@ -0,0 +1,353 @@
+/***************************************************************************
+ plugin_katexmlcheck.cpp - checks XML files using xmllint
+ -------------------
+ begin : 2002-07-06
+ copyright : (C) 2002 by Daniel Naber
+ email : daniel.naber@t-online.de
+ ***************************************************************************/
+
+/***************************************************************************
+ This program is free software; you can redistribute it and/or
+ modify it under the terms of the GNU General Public License
+ as published by the Free Software Foundation; either version 2
+ of the License, or (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ ***************************************************************************/
+
+/*
+-fixme: show dock if "Validate XML" is selected (doesn't currently work when Kate
+ was just started and the dockwidget isn't yet visible)
+-fixme(?): doesn't correctly disappear when deactivated in config
+*/
+
+#include "plugin_katexmlcheck.h"
+#include "plugin_katexmlcheck.moc"
+
+#include <cassert>
+
+#include <config.h>
+#include <qfile.h>
+#include <qinputdialog.h>
+#include <qregexp.h>
+#include <qstring.h>
+#include <qtextstream.h>
+
+#include <kaction.h>
+#include <kcursor.h>
+#include <kdebug.h>
+#include <kdockwidget.h>
+#include <kinstance.h>
+#include <klocale.h>
+#include <kmessagebox.h>
+#include <kstandarddirs.h>
+#include <ktempfile.h>
+#include <kate/toolviewmanager.h>
+#include <kgenericfactory.h>
+
+K_EXPORT_COMPONENT_FACTORY( katexmlcheckplugin, KGenericFactory<PluginKateXMLCheck>( "katexmlcheck" ) )
+
+PluginKateXMLCheck::PluginKateXMLCheck( QObject* parent, const char* name, const QStringList& )
+ : Kate::Plugin ( (Kate::Application *)parent, name )
+{
+}
+
+
+PluginKateXMLCheck::~PluginKateXMLCheck()
+{
+}
+
+
+void PluginKateXMLCheck::addView(Kate::MainWindow *win)
+{
+ Kate::ToolViewManager *viewmanager = win->toolViewManager();
+ QWidget *dock = viewmanager->createToolView("kate_plugin_xmlcheck_ouputview", Kate::ToolViewManager::Bottom, SmallIcon("misc"), i18n("XML Checker Output"));
+
+ PluginKateXMLCheckView *view = new PluginKateXMLCheckView (dock,win,"katexmlcheck_outputview");
+ view->dock = dock;
+
+ win->guiFactory()->addClient(view);
+ view->win = win;
+
+ m_views.append(view);
+}
+
+
+void PluginKateXMLCheck::removeView(Kate::MainWindow *win)
+{
+ for (uint z=0; z < m_views.count(); z++) {
+ if (m_views.at(z)->win == win) {
+ PluginKateXMLCheckView *view = m_views.at(z);
+ m_views.remove (view);
+ win->guiFactory()->removeClient (view);
+ delete view->dock; // this will delete view, too
+ }
+ }
+}
+
+
+//---------------------------------
+PluginKateXMLCheckView::PluginKateXMLCheckView(QWidget *parent,Kate::MainWindow *mainwin,const char* name)
+ :QListView(parent,name),KXMLGUIClient(),win(mainwin)
+{
+ m_tmp_file=0;
+ m_proc=0;
+ (void) new KAction ( i18n("Validate XML"), 0, this,
+ SLOT( slotValidate() ), actionCollection(), "xml_check" );
+ // TODO?:
+ //(void) new KAction ( i18n("Indent XML"), 0, this,
+ // SLOT( slotIndent() ), actionCollection(), "xml_indent" );
+
+ setInstance(new KInstance("kate"));
+ setXMLFile("plugins/katexmlcheck/ui.rc");
+
+
+ setFocusPolicy(QWidget::NoFocus);
+ addColumn(i18n("#"), -1);
+ addColumn(i18n("Line"), -1);
+ setColumnAlignment(1, AlignRight);
+ addColumn(i18n("Column"), -1);
+ setColumnAlignment(2, AlignRight);
+ addColumn(i18n("Message"), -1);
+ setAllColumnsShowFocus(true);
+ setResizeMode(QListView::LastColumn);
+ connect(this, SIGNAL(clicked(QListViewItem *)), SLOT(slotClicked(QListViewItem *)));
+
+/* TODO?: invalidate the listview when document has changed
+ Kate::View *kv = application()->activeMainWindow()->viewManager()->activeView();
+ if( ! kv ) {
+ kdDebug() << "Warning: no Kate::View" << endl;
+ return;
+ }
+ connect(kv, SIGNAL(modifiedChanged()), this, SLOT(slotUpdate()));
+*/
+
+ m_proc_stderr = "";
+ m_proc = new KProcess();
+ connect(m_proc, SIGNAL(processExited(KProcess*)), this, SLOT(slotProcExited(KProcess*)));
+ // we currently only want errors:
+ //connect(m_proc, SIGNAL(receivedStdout(KProcess*,char*,int)),
+ // this, SLOT(receivedProcStdout(KProcess*, char*, int)));
+ connect(m_proc, SIGNAL(receivedStderr(KProcess*,char*,int)),
+ this, SLOT(slotReceivedProcStderr(KProcess*, char*, int)));
+
+}
+
+
+PluginKateXMLCheckView::~PluginKateXMLCheckView()
+{
+ delete m_proc;
+ delete m_tmp_file;
+}
+
+
+
+
+void PluginKateXMLCheckView::slotReceivedProcStderr(KProcess *, char *result, int len)
+{
+ m_proc_stderr += QString::fromLocal8Bit( QCString(result, len+1) );
+}
+
+
+void PluginKateXMLCheckView::slotProcExited(KProcess*)
+{
+ // FIXME: doesn't work correct the first time:
+ //if( m_dockwidget->isDockBackPossible() ) {
+ // m_dockwidget->dockBack();
+// }
+
+ kdDebug() << "slotProcExited()" << endl;
+ //kdDebug() << "output: " << endl << m_proc_stderr << endl << endl;
+ QApplication::restoreOverrideCursor();
+ m_tmp_file->unlink();
+ clear();
+ uint list_count = 0;
+ uint err_count = 0;
+ if( ! m_validating ) {
+ // no i18n here, so we don't get an ugly English<->Non-english mixup:
+ QString msg;
+ if( m_dtdname.isEmpty() ) {
+ msg = "No DOCTYPE found, will only check well-formedness.";
+ } else {
+ msg = "'" + m_dtdname + "' not found, will only check well-formedness.";
+ }
+ (void)new QListViewItem(this, QString("1").rightJustify(4,' '), "", "", msg);
+ list_count++;
+ }
+ if( ! m_proc_stderr.isEmpty() ) {
+ QStringList lines = QStringList::split("\n", m_proc_stderr);
+ QListViewItem *item = 0;
+ QString linenumber, msg;
+ uint line_count = 0;
+ for(QStringList::Iterator it = lines.begin(); it != lines.end(); ++it) {
+ QString line = *it;
+ line_count++;
+ int semicolon_1 = line.find(':');
+ int semicolon_2 = line.find(':', semicolon_1+1);
+ int semicolon_3 = line.find(':', semicolon_2+2);
+ int caret_pos = line.find('^');
+ if( semicolon_1 != -1 && semicolon_2 != -1 && semicolon_3 != -1 ) {
+ linenumber = line.mid(semicolon_1+1, semicolon_2-semicolon_1-1).stripWhiteSpace();
+ linenumber = linenumber.rightJustify(6, ' '); // for sorting numbers
+ msg = line.mid(semicolon_3+1, line.length()-semicolon_3-1).stripWhiteSpace();
+ } else if( caret_pos != -1 || line_count == lines.size() ) {
+ // TODO: this fails if "^" occurs in the real text?!
+ if( line_count == lines.size() && caret_pos == -1 ) {
+ msg = msg+"\n"+line;
+ }
+ QString col = QString::number(caret_pos);
+ if( col == "-1" ) {
+ col = "";
+ }
+ err_count++;
+ list_count++;
+ item = new QListViewItem(this, QString::number(list_count).rightJustify(4,' '), linenumber, col, msg);
+ item->setMultiLinesEnabled(true);
+ } else {
+ msg = msg+"\n"+line;
+ }
+ }
+ sort(); // TODO?: insert in right order
+ }
+ if( err_count == 0 ) {
+ QString msg;
+ if( m_validating ) {
+ msg = "No errors found, document is valid."; // no i18n here
+ } else {
+ msg = "No errors found, document is well-formed."; // no i18n here
+ }
+ (void)new QListViewItem(this, QString::number(list_count+1).rightJustify(4,' '), "", "", msg);
+ }
+}
+
+
+void PluginKateXMLCheckView::slotClicked(QListViewItem *item)
+{
+ kdDebug() << "slotClicked" << endl;
+ if( item ) {
+ bool ok = true;
+ uint line = item->text(1).toUInt(&ok);
+ bool ok2 = true;
+ uint column = item->text(2).toUInt(&ok);
+ if( ok && ok2 ) {
+ Kate::View *kv = win->viewManager()->activeView();
+ if( ! kv ) {
+ kdDebug() << "Warning (slotClicked()): no Kate::View" << endl;
+ return;
+ }
+ kv->setCursorPositionReal(line-1, column);
+ }
+ }
+}
+
+
+void PluginKateXMLCheckView::slotUpdate()
+{
+ kdDebug() << "slotUpdate() (not implemented yet)" << endl;
+}
+
+
+bool PluginKateXMLCheckView::slotValidate()
+{
+ kdDebug() << "slotValidate()" << endl;
+
+ win->toolViewManager()->showToolView (this);
+
+ m_proc->clearArguments();
+ m_proc_stderr = "";
+ m_validating = false;
+ m_dtdname = "";
+
+ Kate::View *kv = win->viewManager()->activeView();
+ if( ! kv ) {
+ kdDebug() << "Error (slotValidate()): no Kate::View" << endl;
+ return false;
+ }
+ if( ! kv->getDoc() ) {
+ kdDebug() << "Error (slotValidate()): no kv->getDoc()" << endl;
+ return false;
+ }
+ Kate::Document *doc = (Kate::Document*)kv->document();
+
+ m_tmp_file = new KTempFile();
+ if( m_tmp_file->status() != 0 ) {
+ kdDebug() << "Error (slotValidate()): could not create '" << m_tmp_file->name() << "': " << m_tmp_file->status() << endl;
+ KMessageBox::error(0, i18n("<b>Error:</b> Could not create "
+ "temporary file '%1'.").arg(m_tmp_file->name()));
+ delete m_tmp_file;
+ m_tmp_file=0L;
+ return false;
+ }
+ QTextStream *s = m_tmp_file->textStream();
+ *s << kv->getDoc()->text();
+ bool removed = m_tmp_file->close();
+ if( ! removed ) {
+ kdDebug() << "Warning (slotValidate()): temp file '" << m_tmp_file->name() << "' not deleted: " << m_tmp_file->status() << endl;
+ }
+
+ QString exe = KStandardDirs::findExe("xmllint");
+ if( exe.isEmpty() ) {
+ exe = locate("exe", "xmllint");
+ }
+
+ // use catalogs for KDE docbook:
+ if( ! getenv("SGML_CATALOG_FILES") ) {
+ KInstance ins("katexmlcheckplugin");
+ QString catalogs;
+ catalogs += ins.dirs()->findResource("data", "ksgmltools2/customization/catalog");
+ catalogs += ":";
+ catalogs += ins.dirs()->findResource("data", "ksgmltools2/docbook/xml-dtd-4.1.2/docbook.cat");
+ kdDebug() << "catalogs: " << catalogs << endl;
+ setenv("SGML_CATALOG_FILES", QFile::encodeName( catalogs ).data(), 1);
+ }
+ //kdDebug() << "**catalogs: " << getenv("SGML_CATALOG_FILES") << endl;
+
+ *m_proc << exe << "--catalogs" << "--noout";
+
+ // heuristic: assume that the doctype is in the first 10,000 bytes:
+ QString text_start = kv->getDoc()->text().left(10000);
+ // remove comments before looking for doctype (as a doctype might be commented out
+ // and needs to be ignored then):
+ QRegExp re("<!--.*-->");
+ re.setMinimal(true);
+ text_start.replace(re, "");
+ QRegExp re_doctype("<!DOCTYPE\\s+(.*)\\s+(?:PUBLIC\\s+[\"'].*[\"']\\s+[\"'](.*)[\"']|SYSTEM\\s+[\"'](.*)[\"'])", false);
+ re_doctype.setMinimal(true);
+
+ if( re_doctype.search(text_start) != -1 ) {
+ QString dtdname;
+ if( ! re_doctype.cap(2).isEmpty() ) {
+ dtdname = re_doctype.cap(2);
+ } else {
+ dtdname = re_doctype.cap(3);
+ }
+ if( !dtdname.startsWith("http:") ) { // todo: u_dtd.isLocalFile() doesn't work :-(
+ // a local DTD is used
+ m_validating = true;
+ *m_proc << "--valid";
+ } else {
+ m_validating = true;
+ *m_proc << "--valid";
+ }
+ } else if( text_start.find("<!DOCTYPE") != -1 ) {
+ // DTD is inside the XML file
+ m_validating = true;
+ *m_proc << "--valid";
+ }
+ *m_proc << m_tmp_file->name();
+
+ if( ! m_proc->start(KProcess::NotifyOnExit, KProcess::AllOutput) ) {
+ KMessageBox::error(0, i18n("<b>Error:</b> Failed to execute xmllint. Please make "
+ "sure that xmllint is installed. It is part of libxml2."));
+ return false;
+ }
+ QApplication::setOverrideCursor(KCursor::waitCursor());
+ return true;
+}
diff --git a/kate/xmlcheck/plugin_katexmlcheck.h b/kate/xmlcheck/plugin_katexmlcheck.h
new file mode 100644
index 0000000..17c2e53
--- /dev/null
+++ b/kate/xmlcheck/plugin_katexmlcheck.h
@@ -0,0 +1,87 @@
+ /***************************************************************************
+ plugin_katexmlcheck.h
+ -------------------
+ begin : 2002-07-06
+ copyright : (C) 2002 by Daniel Naber
+ email : daniel.naber@t-online.de
+ ***************************************************************************/
+
+/***************************************************************************
+ This program is free software; you can redistribute it and/or
+ modify it under the terms of the GNU General Public License
+ as published by the Free Software Foundation; either version 2
+ of the License, or (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ ***************************************************************************/
+
+#ifndef _PLUGIN_KANT_XMLCHECK_H
+#define _PLUGIN_KANT_XMLCHECK_H
+
+#include <qlistview.h>
+#include <qstring.h>
+
+#include <kate/plugin.h>
+#include <kate/application.h>
+#include <kate/view.h>
+#include <kate/document.h>
+#include <kate/documentmanager.h>
+#include <kate/mainwindow.h>
+#include <kate/viewmanager.h>
+
+#include <kdockwidget.h>
+#include <kiconloader.h>
+#include <kprocess.h>
+#include <ktempfile.h>
+
+class PluginKateXMLCheckView : public QListView, public KXMLGUIClient
+{
+ Q_OBJECT
+
+ public:
+ PluginKateXMLCheckView(QWidget *parent,Kate::MainWindow *mainwin,const char* name);
+ virtual ~PluginKateXMLCheckView();
+
+ Kate::MainWindow *win;
+ QWidget *dock;
+
+ public slots:
+ bool slotValidate();
+ void slotClicked(QListViewItem *item);
+ void slotProcExited(KProcess*);
+ void slotReceivedProcStderr(KProcess*, char*, int);
+ void slotUpdate();
+
+ private:
+ KTempFile *m_tmp_file;
+ KParts::ReadOnlyPart *part;
+ bool m_validating;
+ KProcess *m_proc;
+ QString m_proc_stderr;
+ QString m_dtdname;
+};
+
+
+class PluginKateXMLCheck : public Kate::Plugin, Kate::PluginViewInterface
+{
+ Q_OBJECT
+
+ public:
+ PluginKateXMLCheck( QObject* parent = 0, const char* name = 0, const QStringList& = QStringList() );
+ virtual ~PluginKateXMLCheck();
+
+ void addView (Kate::MainWindow *win);
+ void removeView (Kate::MainWindow *win);
+
+ private:
+ QPtrList<PluginKateXMLCheckView> m_views;
+};
+
+#endif // _PLUGIN_KANT_XMLCHECK_H
diff --git a/kate/xmlcheck/ui.rc b/kate/xmlcheck/ui.rc
new file mode 100644
index 0000000..9f24edd
--- /dev/null
+++ b/kate/xmlcheck/ui.rc
@@ -0,0 +1,8 @@
+<!DOCTYPE kpartgui>
+<kpartplugin name="katexmlcheck" library="libkatexmlcheckplugin" version="4">
+<MenuBar>
+ <Menu name="xml"><Text>&amp;XML</Text>
+ <Action name="xml_check" />
+ </Menu>
+</MenuBar>
+</kpartplugin>