diff options
Diffstat (limited to 'parts/documentation/plugins')
37 files changed, 3135 insertions, 0 deletions
diff --git a/parts/documentation/plugins/Makefile.am b/parts/documentation/plugins/Makefile.am new file mode 100644 index 00000000..c2002f78 --- /dev/null +++ b/parts/documentation/plugins/Makefile.am @@ -0,0 +1,3 @@ +INCLUDES = -I$(top_srcdir)/lib/interfaces -I$(top_srcdir)/lib/util $(all_includes) +METASOURCES = AUTO +SUBDIRS = qt doxygen devhelp kdevtoc chm custom diff --git a/parts/documentation/plugins/chm/Makefile.am b/parts/documentation/plugins/chm/Makefile.am new file mode 100644 index 00000000..6df1ba52 --- /dev/null +++ b/parts/documentation/plugins/chm/Makefile.am @@ -0,0 +1,14 @@ +INCLUDES = -I$(top_srcdir)/lib/interfaces -I$(top_srcdir)/lib/util \ + -I$(top_srcdir)/parts/documentation/interfaces $(all_includes) + +METASOURCES = AUTO + +kde_module_LTLIBRARIES = libdocchmplugin.la + +noinst_HEADERS = docchmplugin.h +kde_services_DATA = docchmplugin.desktop + +libdocchmplugin_la_LDFLAGS = -module -avoid-version -no-undefined $(all_libraries) +libdocchmplugin_la_SOURCES = docchmplugin.cpp +libdocchmplugin_la_LIBADD = $(top_builddir)/lib/libkdevelop.la \ + $(top_builddir)/parts/documentation/interfaces/libdocumentation_interfaces.la diff --git a/parts/documentation/plugins/chm/docchmplugin.cpp b/parts/documentation/plugins/chm/docchmplugin.cpp new file mode 100644 index 00000000..e2b2b556 --- /dev/null +++ b/parts/documentation/plugins/chm/docchmplugin.cpp @@ -0,0 +1,198 @@ +/*************************************************************************** + * Copyright (C) 2004 by Alexander Dymo * + * cloudtemple@mksat.net * + * * + * 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., * + * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * + ***************************************************************************/ +#include "docchmplugin.h" + +#include <kurl.h> +#include <kaboutdata.h> +#include <kconfig.h> +#include <klocale.h> +#include <klistview.h> +#include <kio/netaccess.h> +#include <iostream> +#include <fstream> +#include <qvaluevector.h> +#include <kdevgenericfactory.h> +#include <kdevplugininfo.h> +#include <qregexp.h> + +#include "../../../../config.h" + +static const KDevPluginInfo data("docchmplugin"); +typedef KDevGenericFactory<DocCHMPlugin> DocCHMPluginFactory; +K_EXPORT_COMPONENT_FACTORY( libdocchmplugin, DocCHMPluginFactory(data) ) + +DocCHMPlugin::DocCHMPlugin(QObject* parent, const char* name, QStringList // args + ) + :DocumentationPlugin(DocCHMPluginFactory::instance()->config(), parent, name) +{ + setCapabilities(CustomDocumentationTitles); // | Index | FullTextSearch | ProjectDocumentation + autoSetup(); +} + +DocCHMPlugin::~DocCHMPlugin() +{ +} + + +DocumentationCatalogItem* DocCHMPlugin::createCatalog(KListView* contents, const QString& title, const QString& url) +{ + DocumentationCatalogItem *item = new DocumentationCatalogItem(this, contents, title); + item->setURL(KURL(url)); + + return item; +} + +QPair<KFile::Mode, QString> DocCHMPlugin::catalogLocatorProps() +{ + return QPair<KFile::Mode, QString>(KFile::File, "*.chm"); +} + +QString DocCHMPlugin::catalogTitle(const QString& // url + ) +{ + return QString::null; +} + +QString DocCHMPlugin::pluginName() const +{ + return i18n("CHM Documentation Collection"); +} + + +QString DocCHMPlugin::getSpecialData(const QString& name, KURL url) { + QString ret = ""; + url.setProtocol("ms-its"); + + url.addPath("/:" + name); + QString tmpFile; + if( KIO::NetAccess::download( url, tmpFile, 0 ) ) + { + std::filebuf fb; + fb.open (tmpFile.ascii(), std::ios::in); + std::istream is(&fb); + char buf[5000] = " "; + while(is.good()) { + is.getline(buf, 5000); + ret += buf; ret += "\n"; + } + fb.close(); + KIO::NetAccess::removeTempFile( tmpFile ); + } else { + kdDebug(9002) << "DocCHMPlugin::getSpecialData could not download data from " << url.url() << endl; + } + return ret; +} + + +///this currently is useless, because htdig cannot use kioslaves +QStringList DocCHMPlugin::fullTextSearchLocations() +{ + //return QStringList::split( '\n', getSpecialData("contents", m_url)); + return QStringList(); +} + +bool DocCHMPlugin::needRefreshIndex(DocumentationCatalogItem* // item + ) +{ + return false; +} + +void DocCHMPlugin::autoSetupPlugin() +{ + return; +} + +void DocCHMPlugin::createIndex(IndexBox* // index + , DocumentationCatalogItem* // item + ) +{ + return; +} + + +static KListViewItem* chainEnd(KListViewItem *parent) { + if(parent == 0) return 0; + KListViewItem* ret = dynamic_cast<KListViewItem*>(parent->firstChild()); + if(ret == 0) return 0; + while(ret->nextSibling() != 0) { + ret = dynamic_cast<KListViewItem*>(ret->nextSibling()); + } + return ret; +} + +static QString decodeHTML(const QString& s) { + QRegExp rx(QString::fromLatin1("&#(\\d+);| ")); + QString out = s; + int pos = rx.search(out); + while(pos > -1) { + QString found = rx.cap(0); + if(found != " ") { + out.replace(pos, found.length(), static_cast<char>(rx.cap(1).toInt())); + }else{ + out.replace(pos, found.length(), " "); + } + pos = rx.search(out, pos+1); + } + return out; +} + + +void DocCHMPlugin::createTOC(DocumentationCatalogItem* item) +{ + QStringList lines = QStringList::split("\n", getSpecialData("catalog", item->url()) ); + if(lines.count() % 4 != 0) { kdDebug(9002) << "DocCHMPlugin::createTOC: wrong count of strings"; return;} + + QValueVector<DocumentationItem*> items; + items.push_back(item); + for(QStringList::Iterator it = lines.begin(); it != lines.end();) { + bool ok1 = true, ok2 = true; + int parent = (*it).toInt(&ok1); + ++it; + int current = (*it).toInt(&ok2); + ++it; + if(int(items.size()) != current || !ok1 || !ok2 || parent < 0 || parent >= int(items.size()) || current < 0 || current != int(items.size())) { + kdDebug(9002) << "DocCHMPlugin::createTOC error while parsing output of ioslave" << endl; + break; + } + + QString& name(*it); + ++it; + KURL url(*it); + ++it; + + items.push_back(new DocumentationItem( + DocumentationItem::Document, items[parent], chainEnd(items[parent]), decodeHTML(name))); + items[current]->setURL(url); + if(parent != 0) items[parent]->setType(DocumentationItem::Book); + } + + + return; +} + +void DocCHMPlugin::setCatalogURL(DocumentationCatalogItem* item) +{ + KURL chmURL = item->url(); + chmURL.setProtocol("ms-its"); + chmURL.addPath("/"); + item->setURL(chmURL); +} + +#include "docchmplugin.moc" diff --git a/parts/documentation/plugins/chm/docchmplugin.desktop b/parts/documentation/plugins/chm/docchmplugin.desktop new file mode 100644 index 00000000..1e538ed7 --- /dev/null +++ b/parts/documentation/plugins/chm/docchmplugin.desktop @@ -0,0 +1,44 @@ +[Desktop Entry] +Type=Service +Name=DocCHMPlugin +Name[da]=DocCHM-plugin +Name[hu]=DocCHMPPlugin +Name[sk]=Doc CHM modul +Name[sv]=CHM-dokumentationsinsticksmodul +Name[ta]=DocCHM சொருகு +Name[zh_TW]=Doc CHM 外掛程式 +Exec=blubb +Comment=Documentation plugin for CHM documentation +Comment[ca]=Connector de documentació per a documentació CHM +Comment[da]=Dokumentations-plugin for CHM-dokumentation +Comment[de]=Dokumentations-Modul für CHM-Dokumentation +Comment[el]=Πρόσθετο τεκμηρίωσης για τεκμηρίωση CHM +Comment[es]=Complemento de documentación para CHM +Comment[et]=CHM dokumentatsiooni plugin +Comment[eu]=CHM dokumentazioarako dokumentazioa plugin-aDocumentation plugin for CHM documentation +Comment[fa]=وصلۀ مستندسازی برای مستندات CHM +Comment[fr]=Module externe de documentation pour la documentation CHM +Comment[gl]=Extensión de documentación para documentación CHM +Comment[hu]=Dokumentációmodul CHM formátumú dokumentációhoz +Comment[it]=Plugin di documentazione per file CHM +Comment[ja]=CHM ドキュメンテーションのためのドキュメンテーションプラグイン +Comment[ms]=Plugin dokumentasi untuk dokumentasi CHM +Comment[nds]=Dokmentatschoon-Moduul för CHM-Dokmentatschonen +Comment[ne]=CHM मिसिलीकरणका लागि मिसिलीकरण प्लगइन +Comment[nl]=Documentatie plugin voor CHM documentatie +Comment[pl]=Wtyczka dokumentacji dla dokumentacji w formacie CHM +Comment[pt]='Plugin' para documentação CHM +Comment[pt_BR]=Plug-in de documentação para documento CHM +Comment[ru]=Модуль для просмотра документации в файлах CHM +Comment[sk]=Dokumentačný modul pre CHM dokumentáciu +Comment[sr]=Документациони прикључак за CHM документацију +Comment[sr@Latn]=Dokumentacioni priključak za CHM dokumentaciju +Comment[sv]=Dokumentationsinsticksmodul för CHM-dokumentation +Comment[ta]= CHM ஆவணத்திற்கான ஆவணச் சொருகு +Comment[tg]=Модул барои намоиши файлҳои CHM-е, ки ҳуҷҷатҳо мавҷуд аст +Comment[tr]=CHM belgelendirmesi için belgelendirme eklentisi +Comment[zh_CN]=CHM 文档的文档插件 +Comment[zh_TW]=CHM 文件外掛程式 +ServiceTypes=KDevelop/DocumentationPlugins +X-KDevelop-Version=5 +X-KDE-Library=libdocchmplugin diff --git a/parts/documentation/plugins/chm/docchmplugin.h b/parts/documentation/plugins/chm/docchmplugin.h new file mode 100644 index 00000000..69bc441b --- /dev/null +++ b/parts/documentation/plugins/chm/docchmplugin.h @@ -0,0 +1,50 @@ +/*************************************************************************** + * Copyright (C) 2004 by Alexander Dymo * + * cloudtemple@mksat.net * + * * + * 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., * + * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * + ***************************************************************************/ +#ifndef DOCCHMPLUGIN_H +#define DOCCHMPLUGIN_H + +#include <kdevdocumentationplugin.h> + +class DocCHMPlugin :public DocumentationPlugin +{ + Q_OBJECT +public: + DocCHMPlugin(QObject* parent, const char* name, QStringList args = QStringList()); + ~DocCHMPlugin(); + + virtual QString pluginName() const; + + virtual void setCatalogURL(DocumentationCatalogItem* item); + virtual QString catalogTitle(const QString& url); + virtual QPair<KFile::Mode, QString> catalogLocatorProps(); + virtual DocumentationCatalogItem* createCatalog(KListView* contents, const QString& title, const QString& url); + virtual void createTOC(DocumentationCatalogItem* item); + + virtual void createIndex(IndexBox* index, DocumentationCatalogItem* item); + virtual bool needRefreshIndex(DocumentationCatalogItem* item); + + virtual QStringList fullTextSearchLocations(); + + virtual void autoSetupPlugin(); +protected: + QString getSpecialData(const QString& name, KURL url); +}; + +#endif diff --git a/parts/documentation/plugins/custom/Makefile.am b/parts/documentation/plugins/custom/Makefile.am new file mode 100644 index 00000000..999dc853 --- /dev/null +++ b/parts/documentation/plugins/custom/Makefile.am @@ -0,0 +1,10 @@ +INCLUDES = -I$(top_srcdir)/lib/interfaces \ + -I$(top_srcdir)/parts/documentation/interfaces $(all_includes) +METASOURCES = AUTO +kde_module_LTLIBRARIES = libdoccustomplugin.la +libdoccustomplugin_la_LDFLAGS = -module -avoid-version -no-undefined $(all_libraries) +libdoccustomplugin_la_LIBADD = $(top_builddir)/lib/libkdevelop.la \ + $(top_builddir)/parts/documentation/interfaces/libdocumentation_interfaces.la +noinst_HEADERS = doccustomplugin.h +libdoccustomplugin_la_SOURCES = doccustomplugin.cpp +kde_services_DATA = doccustomplugin.desktop diff --git a/parts/documentation/plugins/custom/doccustomplugin.cpp b/parts/documentation/plugins/custom/doccustomplugin.cpp new file mode 100644 index 00000000..b3cc7685 --- /dev/null +++ b/parts/documentation/plugins/custom/doccustomplugin.cpp @@ -0,0 +1,106 @@ +/*************************************************************************** + * Copyright (C) 2004 by Alexander Dymo * + * adymo@mksat.net * + * * + * 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., * + * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * + ***************************************************************************/ +#include "doccustomplugin.h" + +#include <kurl.h> +#include <kaboutdata.h> +#include <kconfig.h> +#include <klocale.h> +#include <klistview.h> + +#include <kdevgenericfactory.h> +#include <kdevplugininfo.h> + +static const KDevPluginInfo data("doccustomplugin"); +typedef KDevGenericFactory<DocCustomPlugin> DocCustomPluginFactory; +K_EXPORT_COMPONENT_FACTORY( libdoccustomplugin, DocCustomPluginFactory(data) ) + +DocCustomPlugin::DocCustomPlugin(QObject* parent, const char* name, const QStringList // args + ) + :DocumentationPlugin(DocCustomPluginFactory::instance()->config(), parent, name) +{ + setCapabilities(CustomDocumentationTitles | ProjectUserManual); + autoSetup(); +} + +DocCustomPlugin::~DocCustomPlugin() +{ +} + +bool DocCustomPlugin::needRefreshIndex(DocumentationCatalogItem* // item + ) +{ + return false; +} + +QString DocCustomPlugin::pluginName() const +{ + return i18n("Custom Documentation Collection"); +} + +DocumentationCatalogItem* DocCustomPlugin::createCatalog(KListView* contents, const QString& title, const QString& url) +{ + DocumentationCatalogItem *item = new DocumentationCatalogItem(this, contents, title); + item->setURL(KURL(url)); + return item; +} + +QPair<KFile::Mode, QString> DocCustomPlugin::catalogLocatorProps() +{ + return QPair<KFile::Mode, QString>(KFile::File, "all/allfiles"); +} + +QString DocCustomPlugin::catalogTitle(const QString& /*url*/) +{ + return QString::null; +} + +QStringList DocCustomPlugin::fullTextSearchLocations() +{ + return QStringList(); +} + + +void DocCustomPlugin::autoSetupPlugin() +{ + return; +} + +void DocCustomPlugin::createIndex(IndexBox* /*index*/, DocumentationCatalogItem* /*item*/) +{ + return; +} + +void DocCustomPlugin::createTOC(DocumentationCatalogItem* /*item*/) +{ + return; +} + +void DocCustomPlugin::setCatalogURL(DocumentationCatalogItem* /*item*/) +{ + return; +} + +ProjectDocumentationPlugin *DocCustomPlugin::projectDocumentationPlugin(ProjectDocType type) +{ + if (type == UserManual) + return new ProjectDocumentationPlugin(this, type); + return DocumentationPlugin::projectDocumentationPlugin(type); +} diff --git a/parts/documentation/plugins/custom/doccustomplugin.desktop b/parts/documentation/plugins/custom/doccustomplugin.desktop new file mode 100644 index 00000000..09b018e7 --- /dev/null +++ b/parts/documentation/plugins/custom/doccustomplugin.desktop @@ -0,0 +1,44 @@ +[Desktop Entry] +Type=Service +Name=DocCustomPlugin +Name[da]=Brugerdefineret doc-plugin +Name[sk]=Doc vlastný modul +Name[sv]=Egen dokumentationsinsticksmodul +Name[ta]=ஆவண தனிப்பயன் சொருகுப்பொருள் +Name[zh_TW]=Doc 自訂外掛程式 +Exec=blubb +Comment=Documentation plugin for all types of documentation +Comment[ca]=Connector de documentació per a tot tipus de documentació +Comment[da]=Dokumentations-plugin for alle typer dokumentation +Comment[de]=Komponente für alle Arten von Dokumentation +Comment[el]=Πρόσθετο τεκμηρίωσης για όλους τους τύπους τεκμηρίωσης +Comment[es]=Complemento de documentación para todos los tipos de documentación +Comment[et]=Igat tüüpi dokumentatsiooni plugin +Comment[eu]=Dokumentu mota guztientzako dokumentazio plugin-a +Comment[fa]=وصلۀ مستندسازی برای همۀ انواع مستندات +Comment[fr]=Module externe de documentation pour tous les types de documentation +Comment[gl]=Extensión de documentación para tódolos tipos de documentación +Comment[hu]=Dokumentációmodul mindenféle dokumentációhoz +Comment[it]=Plugin di documentazione per tutti i tipi di documentazione +Comment[ja]=全種類のドキュメンテーションのためのドキュメンテーションプラグイン +Comment[ms]=Plugin dokumentasi untuk semua jenis dokumentasi +Comment[nds]=Dokmentatschoon-Moduul för all Oorden vun Dokmentatschoon +Comment[ne]=सबै प्रकारको मिसिलीकरणका लागि मिसिलीकरण प्लगइन +Comment[nl]=Documentatie plugin voor alle typen documentatie +Comment[pl]=Wtyczka dokumentacji dla wszystkich typów dokumentacji +Comment[pt]='Plugin' para documentação de todos os tipos +Comment[pt_BR]=Plug-in de documentação para todos os tipos de documentação +Comment[ru]=Модуль для работы с документацией +Comment[sk]=Dokumentačný modul pre všetky typy dokumentácie +Comment[sl]=Dokumentacijski vstavek za vse vrste dokumentacije +Comment[sr]=Документациони прикључак за све типове документације +Comment[sr@Latn]=Dokumentacioni priključak za sve tipove dokumentacije +Comment[sv]=Dokumentationsinsticksmodul för alla typer av dokumentation +Comment[ta]=எல்லா வகை ஆவணமயமாக்கலுக்கான ஆவணமயமாக்கல் சொருகுப்பொருள் +Comment[tg]=Модул барои кор кардан бо ҳуҷҷатҳо +Comment[tr]=Her tür belgelendirme için belgelendirme eklentisi +Comment[zh_CN]=全部类型文档的文档插件 +Comment[zh_TW]=所有型態的文件外掛程式 +ServiceTypes=KDevelop/DocumentationPlugins +X-KDevelop-Version=5 +X-KDE-Library=libdoccustomplugin diff --git a/parts/documentation/plugins/custom/doccustomplugin.h b/parts/documentation/plugins/custom/doccustomplugin.h new file mode 100644 index 00000000..2888af81 --- /dev/null +++ b/parts/documentation/plugins/custom/doccustomplugin.h @@ -0,0 +1,50 @@ +/*************************************************************************** + * Copyright (C) 2004 by Alexander Dymo * + * adymo@mksat.net * + * * + * 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., * + * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * + ***************************************************************************/ +#ifndef DOCCUSTOMPLUGIN_H +#define DOCCUSTOMPLUGIN_H + +#include <kdevdocumentationplugin.h> + +class DocCustomPlugin : public DocumentationPlugin { +public: + DocCustomPlugin(QObject* parent, const char* name, const QStringList args = QStringList()); + ~DocCustomPlugin(); + + virtual QString pluginName() const; + + virtual DocumentationCatalogItem* createCatalog(KListView* contents, const QString& title, const QString& url); + + virtual void createTOC(DocumentationCatalogItem* item); + virtual void setCatalogURL(DocumentationCatalogItem* item); + + virtual bool needRefreshIndex(DocumentationCatalogItem* item); + virtual void createIndex(IndexBox* index, DocumentationCatalogItem* item); + + virtual QStringList fullTextSearchLocations(); + + virtual QPair<KFile::Mode, QString> catalogLocatorProps(); + virtual QString catalogTitle(const QString& url); + + virtual void autoSetupPlugin(); + + virtual ProjectDocumentationPlugin *projectDocumentationPlugin(ProjectDocType type); +}; + +#endif diff --git a/parts/documentation/plugins/devhelp/Makefile.am b/parts/documentation/plugins/devhelp/Makefile.am new file mode 100644 index 00000000..e0682833 --- /dev/null +++ b/parts/documentation/plugins/devhelp/Makefile.am @@ -0,0 +1,14 @@ +INCLUDES = -I$(top_srcdir)/lib/interfaces -I$(top_srcdir)/lib/util \ + -I$(top_srcdir)/parts/documentation/interfaces $(all_includes) + +METASOURCES = AUTO + +kde_module_LTLIBRARIES = libdocdevhelpplugin.la + +noinst_HEADERS = docdevhelpplugin.h +kde_services_DATA = docdevhelpplugin.desktop + +libdocdevhelpplugin_la_LDFLAGS = -module -avoid-version -no-undefined $(all_libraries) +libdocdevhelpplugin_la_SOURCES = docdevhelpplugin.cpp +libdocdevhelpplugin_la_LIBADD = $(top_builddir)/lib/libkdevelop.la \ + $(top_builddir)/parts/documentation/interfaces/libdocumentation_interfaces.la diff --git a/parts/documentation/plugins/devhelp/docdevhelpplugin.cpp b/parts/documentation/plugins/devhelp/docdevhelpplugin.cpp new file mode 100644 index 00000000..dca19e51 --- /dev/null +++ b/parts/documentation/plugins/devhelp/docdevhelpplugin.cpp @@ -0,0 +1,386 @@ +/*************************************************************************** + * Copyright (C) 2004 by Alexander Dymo * + * cloudtemple@mksat.net * + * * + * 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., * + * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * + ***************************************************************************/ +#include "docdevhelpplugin.h" + +#include <unistd.h> + +#include <qdom.h> +#include <qfile.h> +#include <qfileinfo.h> +#include <qdialog.h> + +#include <kurl.h> +#include <kaboutdata.h> +#include <kconfig.h> +#include <klocale.h> +#include <kstandarddirs.h> + +#include <kdevgenericfactory.h> +#include <kdevplugininfo.h> + +#include "../../../../config.h" + +class DevHelpDocumentationCatalogItem: public DocumentationCatalogItem +{ +public: + DevHelpDocumentationCatalogItem(const QString &devHelpFile, DocumentationPlugin* plugin, + KListView *parent, const QString &name) + :DocumentationCatalogItem(plugin, parent, name), m_devHelpFile(devHelpFile) + { + } + DevHelpDocumentationCatalogItem(const QString &devHelpFile, DocumentationPlugin* plugin, + DocumentationItem *parent, const QString &name) + :DocumentationCatalogItem(plugin, parent, name), m_devHelpFile(devHelpFile) + { + } + QString devHelpFile() const { return m_devHelpFile; } + + virtual QString cacheVersion() const { + unsigned int checksum=0; + for(int a=0;a<m_devHelpFile.length(); a++) { + checksum += (a+1) * (int)m_devHelpFile[a]; + } + QString str; + QTextOStream( &str ) << checksum; + return str; + } + +protected: + +private: + QString m_devHelpFile; +}; + + +static const KDevPluginInfo data("docdevhelpplugin"); +typedef KDevGenericFactory<DocDevHelpPlugin> DocDevHelpPluginFactory; +K_EXPORT_COMPONENT_FACTORY( libdocdevhelpplugin, DocDevHelpPluginFactory(data) ) + +DocDevHelpPlugin::DocDevHelpPlugin(QObject* parent, const char* name, + const QStringList /*args*/) + :DocumentationPlugin(DocDevHelpPluginFactory::instance()->config(), parent, name) +{ + setCapabilities(Index | FullTextSearch | ProjectDocumentation); + autoSetup(); +} + +DocDevHelpPlugin::~DocDevHelpPlugin() +{ +} + +DocumentationCatalogItem* DocDevHelpPlugin::createCatalog(KListView* contents, const QString& title, const QString& url) +{ + return new DevHelpDocumentationCatalogItem(url, this, contents, title); +} + +QPair<KFile::Mode, QString> DocDevHelpPlugin::catalogLocatorProps() +{ + return QPair<KFile::Mode, QString>(KFile::File, "*.devhelp"); +} + +QString DocDevHelpPlugin::catalogTitle(const QString& url) +{ + QFileInfo fi(url); + if (!fi.exists()) + return QString::null; + + QFile f(url); + if (!f.open(IO_ReadOnly)) + return QString::null; + + QDomDocument doc; + if (!doc.setContent(&f)) + return QString::null; + f.close(); + + QDomElement docEl = doc.documentElement(); + + return docEl.attribute("title", QString::null); +} + +QString DocDevHelpPlugin::pluginName() const +{ + return i18n("Devhelp Documentation Collection"); +} + +QStringList DocDevHelpPlugin::fullTextSearchLocations() +{ + QStringList locs; + + QMap<QString, QString> entryMap = config->entryMap("Locations"); + + for (QMap<QString, QString>::const_iterator it = entryMap.begin(); + it != entryMap.end(); ++it) + { + config->setGroup("Search Settings"); + if (config->readBoolEntry(it.key(), false)) + { + config->setGroup("Locations"); + QFileInfo fi(config->readPathEntry(it.key())); + locs << fi.dirPath(true); + } + } + + return locs; +} + +bool DocDevHelpPlugin::needRefreshIndex(DocumentationCatalogItem* item) +{ + DevHelpDocumentationCatalogItem *dhItem = dynamic_cast<DevHelpDocumentationCatalogItem *>(item); + if (!dhItem) + return false; + + QFileInfo fi(dhItem->devHelpFile()); + config->setGroup("Index"); + if (fi.lastModified() > config->readDateTimeEntry(dhItem->text(0), new QDateTime())) + { + kdDebug() << "need rebuild index for " << dhItem->text(0) << endl; + config->writeEntry(item->text(0), fi.lastModified()); + return true; + } + else + return false; +} + +void DocDevHelpPlugin::autoSetupPlugin() +{ + QValueStack<QString> scanStack; + + pushToScanStack(scanStack, getenv("DEVHELP_SEARCH_PATH")); + pushToScanStack(scanStack, QString(getenv("HOME")) + "/.devhelp/books"); + + QString dhexepath = DocDevHelpPluginFactory::instance()->dirs()->findExe("devhelp"); + if (!dhexepath.isEmpty()) + { + QFileInfo fi(dhexepath); + QString path = KURL(fi.dirPath(true)).upURL().path(1); + pushToScanStack(scanStack, path + "share/devhelp/books"); + pushToScanStack(scanStack, path + "share/gtk-doc/html"); + } + + pushToScanStack(scanStack, "/usr/share/gtk-doc/html"); + pushToScanStack(scanStack, "/usr/share/devhelp/books/"); + pushToScanStack(scanStack, "/usr/local/share/devhelp/books"); + pushToScanStack(scanStack, "/usr/local/share/gtk-doc/html"); + pushToScanStack(scanStack, "/opt/gnome/share/devhelp/books"); + pushToScanStack(scanStack, "/opt/gnome/share/gtk-doc/html"); + pushToScanStack(scanStack, "/opt/gnome2/share/devhelp/books"); + pushToScanStack(scanStack, "/opt/gnome2/share/gtk-doc/html"); + + //fill the list of scan dirs (with subdirectories) + QStringList scanList; + QDir dir; + do + { + dir.setPath(scanStack.pop()); + if (!dir.exists()) + continue; + scanList << dir.path(); + + const QFileInfoList *dirEntries = dir.entryInfoList(); + if ( !dirEntries ) continue; + QPtrListIterator<QFileInfo> it(*dirEntries); + for (; it.current(); ++it) + { + QString fileName = it.current()->fileName(); + if (fileName == "." || fileName == "..") + continue; + QString path = it.current()->absFilePath(); + if (it.current()->isDir()) + { + scanStack.push(path); + } + } + } while (!scanStack.isEmpty()); + + for (QStringList::const_iterator it = scanList.begin(); it != scanList.end(); ++it) + { + scanDevHelpDir(*it); + } +} + +void DocDevHelpPlugin::scanDevHelpDir(const QString &path) +{ + QDir d(path); + if (! d.exists() || !d.isReadable()) + return; + + d.setFilter(QDir::Files); + //scan for *.devhelp files + const QFileInfoList *list = d.entryInfoList(); + QFileInfoListIterator it( *list ); + QFileInfo *fi; + while ( (fi = it.current()) != 0 ) + { + if (fi->extension() == "devhelp") + { + config->setGroup("Locations"); + config->writePathEntry(catalogTitle(fi->absFilePath()), fi->absFilePath()); + } + ++it; + } +} + +void DocDevHelpPlugin::pushToScanStack(QValueStack<QString> &stack, const QString &value) +{ + if ( (!value.isEmpty()) && (!stack.contains(value)) ) + { + stack << value; + kdDebug() << "Devhelp scan stack: +: " << value << endl; + } +} + +void DocDevHelpPlugin::createIndex(IndexBox* index, DocumentationCatalogItem* item) +{ + DevHelpDocumentationCatalogItem *dhItem = dynamic_cast<DevHelpDocumentationCatalogItem *>(item); + if (!dhItem) + return; + + QFileInfo fi(dhItem->devHelpFile()); + + QFile f(dhItem->devHelpFile()); + if (!f.open(IO_ReadOnly)) + { + kdDebug(9002) << "Could not read" << dhItem->devHelpFile() << endl; + return; + } + + QDomDocument doc; + if (!doc.setContent(&f)) + { + kdDebug() << "Not a valid devhelp file: " << dhItem->devHelpFile() << endl; + return; + } + f.close(); + + QString baseUrl = KURL(dhItem->devHelpFile()).directory(); + + QDomElement docEl = doc.documentElement(); + QDomElement chaptersEl = docEl.namedItem("functions").toElement(); + QDomElement childEl = chaptersEl.firstChild().toElement(); + while (!childEl.isNull()) + { + if (childEl.tagName() == "function") + { + QString name = childEl.attribute("name"); + QString url = childEl.attribute("link"); + + IndexItemProto *ii = new IndexItemProto(this, item, index, name, item->text(0)); + ii->addURL(KURL(baseUrl+"/"+url)); + } + childEl = childEl.nextSibling().toElement(); + } +} + +void DocDevHelpPlugin::createTOC(DocumentationCatalogItem* item) +{ + DevHelpDocumentationCatalogItem *dhItem = dynamic_cast<DevHelpDocumentationCatalogItem *>(item); + if (!dhItem) + return; + + QFileInfo fi(dhItem->devHelpFile()); + + QFile f(dhItem->devHelpFile()); + if (!f.open(IO_ReadOnly)) + { + kdDebug(9002) << "Could not read" << dhItem->devHelpFile() << endl; + return; + } + + QDomDocument doc; + if (!doc.setContent(&f)) + { + kdDebug() << "Not a valid devhelp file: " << dhItem->devHelpFile() << endl; + return; + } + f.close(); + + QDomElement docEl = doc.documentElement(); + QDomElement chaptersEl = docEl.namedItem("chapters").toElement(); + + QDomElement childEl = chaptersEl.lastChild().toElement(); + QString baseUrl = KURL(dhItem->devHelpFile()).directory(); + addTocSect(dhItem, childEl, baseUrl, true); +} + +void DocDevHelpPlugin::addTocSect(DocumentationItem *parent, QDomElement childEl, + QString baseUrl, bool book) +{ + while (!childEl.isNull()) + { + if ( (childEl.tagName() == "sub") || (childEl.tagName() == "chapter")) + { + QString name = childEl.attribute("name"); + QString url = childEl.attribute("link"); + + if (name.isEmpty() && url.contains("ix")) + name = "Index"; + + DocumentationItem *item = new DocumentationItem( + book ? DocumentationItem::Book : DocumentationItem::Document, parent, name); + item->setURL(KURL(baseUrl+"/"+url)); + + QDomElement grandchildEl = childEl.lastChild().toElement(); + addTocSect(item, grandchildEl, baseUrl); + } + childEl = childEl.previousSibling().toElement(); + } +} + +void DocDevHelpPlugin::setCatalogURL(DocumentationCatalogItem* item) +{ + DevHelpDocumentationCatalogItem *dhItem = dynamic_cast<DevHelpDocumentationCatalogItem *>(item); + if (!dhItem) + return; + + QFileInfo fi(dhItem->devHelpFile()); + + QFile f(dhItem->devHelpFile()); + if (!f.open(IO_ReadOnly)) + { + kdDebug(9002) << "Could not read" << dhItem->devHelpFile() << endl; + return; + } + QDomDocument doc; + if (!doc.setContent(&f)) + { + kdDebug(9002) << "Not a valid Devhelp file: " << dhItem->devHelpFile() << endl; + return; + } + f.close(); + + QDomElement docEl = doc.documentElement(); + QDomElement titleEl = docEl.namedItem("book").toElement(); + + if (item->url().isEmpty()) + { + KURL url(fi.dirPath(true) + "/" + docEl.attribute("link", QString::null)); + item->setURL(url); + } +} + +ProjectDocumentationPlugin *DocDevHelpPlugin::projectDocumentationPlugin(ProjectDocType type) +{ + if (type == APIDocs) + return new ProjectDocumentationPlugin(this, type); + return DocumentationPlugin::projectDocumentationPlugin(type); +} + +#include "docdevhelpplugin.moc" diff --git a/parts/documentation/plugins/devhelp/docdevhelpplugin.desktop b/parts/documentation/plugins/devhelp/docdevhelpplugin.desktop new file mode 100644 index 00000000..14c3f700 --- /dev/null +++ b/parts/documentation/plugins/devhelp/docdevhelpplugin.desktop @@ -0,0 +1,44 @@ +[Desktop Entry] +Type=Service +Name=DevHelpPlugin +Name[da]=DevHelp-plugin +Name[sk]=DevHelp modul +Name[sv]=DevHelp-insticksmodul +Name[ta]=Devஉதவி சொருகு +Name[zh_TW]=DevHelp 外掛程式 +Comment=Documentation plugin for DevHelp documentation +Comment[ca]=Connector de documentació per a documentació DevHelp +Comment[da]=Dokumentations-plugin for DevHelp-dokumentation +Comment[de]=Komponente für DevHelp-Dokumentation +Comment[el]=Πρόσθετο τεκμηρίωσης για τεκμηρίωση DevHelp +Comment[es]=Complemento de documentación para documentación DevHelp +Comment[et]=DevHelp dokumentatsiooni plugin +Comment[eu]=DevHelp dokumentaziorako dokumentazio plugin-a +Comment[fa]=وصلۀ مستندسازی برای مستندات DevHelp +Comment[fr]=Module externe de documentation pour la documentation DevHelp +Comment[gl]=Extensión de documentación para documentación DevHelp +Comment[hu]=Dokumentációmodul DevHelp-dokumentációhoz +Comment[it]=Plugin di documentazione per file DevHelp +Comment[ja]=DevHelp ドキュメンテーションのためのドキュメンテーションプラグイン +Comment[ms]=Plugin dokumentasi untuk dokumentasi DevHelp +Comment[nds]=Dokmentatschoon-Moduul för DevHelp-Dokmentatschoon +Comment[ne]=DevHelp मिसिलीकरणका लागि मिसिलीकरण प्लगइन +Comment[nl]=Documentatie plugin fvoor DevHelp documentatie +Comment[pl]=Wtyczka dokumentacji dla dokumentacji w formacie DevHelp +Comment[pt]='Plugin' para documentação DevHelp +Comment[pt_BR]=Plug-in de documentação para documento DevHelp +Comment[ru]=Модуль для просмотра документации DevHelp +Comment[sk]=Dokumentačný modul pre DevHelp dokumentáciu +Comment[sl]=Dokumentacijski vstavek za dokumentacijo DevHelp +Comment[sr]=Документациони прикључак за DevHelp документацију +Comment[sr@Latn]=Dokumentacioni priključak za DevHelp dokumentaciju +Comment[sv]=Dokumentationsinsticksmodul för DevHelp-dokumentation +Comment[ta]= DevHelp ஆவணத்திற்கான ஆவணச் சொருகு +Comment[tg]=Модул барои наоиш намудани DevHelp-и асоснок карда шуда +Comment[tr]=DevHelp belgelendirmesi için belgelendirme eklentisi +Comment[zh_CN]=DevHelp 文档的文档插件 +Comment[zh_TW]=DevHelp 文件外掛程式 +Exec=blubb +ServiceTypes=KDevelop/DocumentationPlugins +X-KDevelop-Version=5 +X-KDE-Library=libdocdevhelpplugin diff --git a/parts/documentation/plugins/devhelp/docdevhelpplugin.h b/parts/documentation/plugins/devhelp/docdevhelpplugin.h new file mode 100644 index 00000000..ab0b0ece --- /dev/null +++ b/parts/documentation/plugins/devhelp/docdevhelpplugin.h @@ -0,0 +1,60 @@ +/*************************************************************************** + * Copyright (C) 2004 by Alexander Dymo * + * cloudtemple@mksat.net * + * * + * 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., * + * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * + ***************************************************************************/ +#ifndef DOCDEVHELPPLUGIN_H +#define DOCDEVHELPPLUGIN_H + +#include <qvaluestack.h> +#include <qdom.h> + +#include <kdevdocumentationplugin.h> + +class DocDevHelpPlugin: public DocumentationPlugin +{ + Q_OBJECT +public: + DocDevHelpPlugin(QObject* parent, const char* name, const QStringList args = QStringList()); + ~DocDevHelpPlugin(); + + virtual QString pluginName() const; + + virtual QString catalogTitle(const QString& url); + virtual void setCatalogURL(DocumentationCatalogItem* item); + + virtual void createTOC(DocumentationCatalogItem* item); + + virtual DocumentationCatalogItem* createCatalog(KListView* contents, const QString& title, const QString& url); + + virtual bool needRefreshIndex(DocumentationCatalogItem* item); + virtual void createIndex(IndexBox* index, DocumentationCatalogItem* item); + + virtual QStringList fullTextSearchLocations(); + virtual void autoSetupPlugin(); + + virtual QPair<KFile::Mode, QString> catalogLocatorProps(); + + virtual ProjectDocumentationPlugin *projectDocumentationPlugin(ProjectDocType type); + +protected: + void pushToScanStack(QValueStack<QString> &stack, const QString &value); + void scanDevHelpDir(const QString &path); + void addTocSect(DocumentationItem *parent, QDomElement childEl, QString baseUrl, bool book=false); +}; + +#endif diff --git a/parts/documentation/plugins/djvu/Makefile.am b/parts/documentation/plugins/djvu/Makefile.am new file mode 100644 index 00000000..716be5df --- /dev/null +++ b/parts/documentation/plugins/djvu/Makefile.am @@ -0,0 +1,8 @@ +INCLUDES = -I$(top_srcdir)/lib/interfaces $(all_includes) +METASOURCES = AUTO +kde_module_LTLIBRARIES = libdocdjvuplugin.la +libdocdjvuplugin_la_LDFLAGS = $(all_libraries) +libdocdjvuplugin_la_LIBADD = $(top_builddir)/lib/libkdevelop.la +noinst_HEADERS = docdjvuplugin.h +libdocdjvuplugin_la_SOURCES = docdjvuplugin.cpp +kde_services_DATA = docdjvuplugin.desktop diff --git a/parts/documentation/plugins/djvu/docdjvuplugin.cpp b/parts/documentation/plugins/djvu/docdjvuplugin.cpp new file mode 100644 index 00000000..0c53943e --- /dev/null +++ b/parts/documentation/plugins/djvu/docdjvuplugin.cpp @@ -0,0 +1,103 @@ +/*************************************************************************** + * Copyright (C) 2004 by Mathieu Chouinard * + * mathieu.chouinard@kdemail.net * + * * + * 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., * + * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * + ***************************************************************************/ +#include "docdjvuplugin.h" + +#include <kurl.h> +#include <kaboutdata.h> +#include <kconfig.h> +#include <klocale.h> +#include <klistview.h> + +#include <kdevgenericfactory.h> + +static const KAboutData data("docdjvuplugin", I18N_NOOP("Djvu documentation plugin"), "1.0"); +typedef KDevGenericFactory<DocDjvuPlugin> DocDjvuPluginFactory; +K_EXPORT_COMPONENT_FACTORY( libdocdjvuplugin, DocDjvuPluginFactory(&data) ) + +DocDjvuPlugin::DocDjvuPlugin(QObject* parent, const char* name, const QStringList args) + :DocumentationPlugin(DocDjvuPluginFactory::instance()->config(), parent, name) +{ + setCapabilities(CustomDocumentationTitles | ProjectUserManual); + autoSetup(); +} + +DocDjvuPlugin::~DocDjvuPlugin() +{ +} + +bool DocDjvuPlugin::needRefreshIndex(DocumentationCatalogItem* item) +{ + return false; +} + +QString DocDjvuPlugin::pluginName() const +{ + return i18n("Djvu Documentation Collection"); +} + +DocumentationCatalogItem* DocDjvuPlugin::createCatalog(KListView* contents, const QString& title, const QString& url) +{ + DocumentationCatalogItem *item = new DocumentationCatalogItem(this, contents, title); + item->setURL(KURL(url)); + return item; +} + +QPair<KFile::Mode, QString> DocDjvuPlugin::catalogLocatorProps() +{ + return QPair<KFile::Mode, QString>(KFile::File, "all/allfiles"); +} + +QString DocDjvuPlugin::catalogTitle(const QString& /*url*/) +{ + return QString::null; +} + +QStringList DocDjvuPlugin::fullTextSearchLocations() +{ + return QStringList(); +} + + +void DocDjvuPlugin::autoSetupPlugin() +{ + return; +} + +void DocDjvuPlugin::createIndex(IndexBox* /*index*/, DocumentationCatalogItem* /*item*/) +{ + return; +} + +void DocDjvuPlugin::createTOC(DocumentationCatalogItem* /*item*/) +{ + return; +} + +void DocDjvuPlugin::setCatalogURL(DocumentationCatalogItem* /*item*/) +{ + return; +} + +ProjectDocumentationPlugin *DocDjvuPlugin::projectDocumentationPlugin(ProjectDocType type) +{ + if (type == UserManual) + return new ProjectDocumentationPlugin(this, type); + return DocumentationPlugin::projectDocumentationPlugin(type); +} diff --git a/parts/documentation/plugins/djvu/docdjvuplugin.desktop b/parts/documentation/plugins/djvu/docdjvuplugin.desktop new file mode 100644 index 00000000..c88aa6a9 --- /dev/null +++ b/parts/documentation/plugins/djvu/docdjvuplugin.desktop @@ -0,0 +1,44 @@ +[Desktop Entry] +Type=Service +Name=DocDjvuPlugin +Name[da]=DocDjvu-plugin +Name[ms]=PluginDocDjvu +Name[sk]=Doc Djvu modul +Name[sv]=DocDjvu-insticksmodul +Name[ta]=DocQt சொருகு +Name[zh_TW]=Djvu 文件外掛程式 +Exec=blubb +Comment=Documentation plugin for djvu format +Comment[ca]=Connector de documentació per al format djvu +Comment[da]=Dokumentations-plugin for djvu-dokumentation +Comment[de]=Komponente für das DjVu-Dokumentationsformat +Comment[el]=Πρόσθετο τεκμηρίωσης για τη μορφή djvu +Comment[es]=Complemento de documentación para el formato djvu +Comment[et]=Djvu vormingus dokumentatsiooni plugin +Comment[eu]=Djvu dokumentaziorako dokumentazio plugin-a +Comment[fa]=وصلۀ مستندسازی برای قالب djvu +Comment[fr]=Module externe de documentation pour le format djvu +Comment[gl]=Extensión de documentación para o formato djvu +Comment[hu]=Dokumentációmodul djvu formátumú dokumentációhoz +Comment[it]=Plugin documentazione per il formato djvu +Comment[ja]=djvu フォーマットのためのドキュメンテーションプラグイン +Comment[ms]=Plugin dokumentasi untuk format djvu +Comment[nds]=Dokmentatschoon-Moduul för dat djvu-Dokmentatschoonformaat +Comment[ne]=djvu ढाँचाका लागि मिसिलीकरण प्लगइन +Comment[nl]=Documentatie plugin voor het djvu-formaat +Comment[pl]=Wtyczka dokumentacji dla dokumentacji w formacie djvu +Comment[pt]='Plugin' para documentação no formato djvu +Comment[pt_BR]=Plug-in de documentação para o formato djvu +Comment[ru]=Модуль для просмотра документации в формате DJVU +Comment[sk]=Dokumentačný modul pre Djvu dokumentáciu +Comment[sr]=Документациони прикључак за djvu формат +Comment[sr@Latn]=Dokumentacioni priključak za djvu format +Comment[sv]=Dokumentationsinsticksmodul för djvu-format +Comment[ta]= CHM ஆவணத்திற்கான ஆவணச் சொருகு +Comment[tg]=Модул барои наоиш намудани ҳуҷҷатҳо дар формати DJVU +Comment[tr]=djvu biçimi için belgelendirme eklentisi +Comment[zh_CN]=djvu 格式文档插件 +Comment[zh_TW]=Djvu 格式文件外掛程式 +ServiceTypes=KDevelop/DocumentationPlugins +X-KDevelop-Version=1 +X-KDE-Library=libdocdjvuplugin diff --git a/parts/documentation/plugins/djvu/docdjvuplugin.h b/parts/documentation/plugins/djvu/docdjvuplugin.h new file mode 100644 index 00000000..79bbf0ab --- /dev/null +++ b/parts/documentation/plugins/djvu/docdjvuplugin.h @@ -0,0 +1,50 @@ +/*************************************************************************** + * Copyright (C) 2004 by Mathieu Chouinard * + * mathieu.chouinard@kdemail.net * + * * + * 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., * + * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * + ***************************************************************************/ +#ifndef DOCDJVUPLUGIN_H +#define DOCDVJUPLUGIN_H + +#include <kdevdocumentationplugin.h> + +class DocDjvuPlugin : public DocumentationPlugin { +public: + DocDjvuPlugin(QObject* parent, const char* name, const QStringList args = QStringList()); + ~DocDjvuPlugin(); + + virtual QString pluginName() const; + + virtual DocumentationCatalogItem* createCatalog(KListView* contents, const QString& title, const QString& url); + + virtual void createTOC(DocumentationCatalogItem* item); + virtual void setCatalogURL(DocumentationCatalogItem* item); + + virtual bool needRefreshIndex(DocumentationCatalogItem* item); + virtual void createIndex(IndexBox* index, DocumentationCatalogItem* item); + + virtual QStringList fullTextSearchLocations(); + + virtual QPair<KFile::Mode, QString> catalogLocatorProps(); + virtual QString catalogTitle(const QString& url); + + virtual void autoSetupPlugin(); + + virtual ProjectDocumentationPlugin *projectDocumentationPlugin(ProjectDocType type); +}; + +#endif diff --git a/parts/documentation/plugins/doxygen/Makefile.am b/parts/documentation/plugins/doxygen/Makefile.am new file mode 100644 index 00000000..eb6e2648 --- /dev/null +++ b/parts/documentation/plugins/doxygen/Makefile.am @@ -0,0 +1,13 @@ +INCLUDES = -I$(top_srcdir)/lib/interfaces -I$(top_srcdir)/lib/util \ + -I$(top_srcdir)/parts/documentation/interfaces $(all_includes) +METASOURCES = AUTO +kde_module_LTLIBRARIES = libdocdoxygenplugin.la + +kde_services_DATA = docdoxygenplugin.desktop +libdocdoxygenplugin_la_SOURCES = docdoxygenplugin.cpp +noinst_HEADERS = docdoxygenplugin.h + + +libdocdoxygenplugin_la_LDFLAGS = -module -avoid-version -no-undefined $(all_libraries) +libdocdoxygenplugin_la_LIBADD = $(top_builddir)/lib/libkdevelop.la \ + $(top_builddir)/parts/documentation/interfaces/libdocumentation_interfaces.la diff --git a/parts/documentation/plugins/doxygen/docdoxygenplugin.cpp b/parts/documentation/plugins/doxygen/docdoxygenplugin.cpp new file mode 100644 index 00000000..ddea5219 --- /dev/null +++ b/parts/documentation/plugins/doxygen/docdoxygenplugin.cpp @@ -0,0 +1,529 @@ +/*************************************************************************** + * Copyright (C) 2004 by Alexander Dymo * + * cloudtemple@mksat.net * + * * + * 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., * + * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * + ***************************************************************************/ +#include "docdoxygenplugin.h" + +#include <unistd.h> + +#include <qdom.h> +#include <qfile.h> +#include <qfileinfo.h> +#include <qdialog.h> +#include <qregexp.h> +#include <qvaluestack.h> + +#include <kurl.h> +#include <kaboutdata.h> +#include <kconfig.h> +#include <klocale.h> +#include <kstandarddirs.h> + +#include <urlutil.h> +#include <kdevgenericfactory.h> +#include <kdevplugininfo.h> + +#include "../../../../config.h" + +class DoxyDocumentationCatalogItem: public DocumentationCatalogItem +{ +public: + DoxyDocumentationCatalogItem(const QString &origUrl, DocumentationPlugin* plugin, + KListView *parent, const QString &name) + :DocumentationCatalogItem(plugin, parent, name), m_origUrl(origUrl) + { + } + DoxyDocumentationCatalogItem(const QString &origUrl, DocumentationPlugin* plugin, + DocumentationItem *parent, const QString &name) + :DocumentationCatalogItem(plugin, parent, name), m_origUrl(origUrl) + { + } + QString origUrl() const { return m_origUrl; } + +private: + QString m_origUrl; +}; + + +static const KDevPluginInfo data("docdoxygenplugin"); +typedef KDevGenericFactory<DocDoxygenPlugin> DocDoxygenPluginFactory; +K_EXPORT_COMPONENT_FACTORY( libdocdoxygenplugin, DocDoxygenPluginFactory(data) ) + +DocDoxygenPlugin::DocDoxygenPlugin(QObject* parent, const char* name, const QStringList) + :DocumentationPlugin(DocDoxygenPluginFactory::instance()->config(), parent, name) +{ + setCapabilities(Index | FullTextSearch | ProjectDocumentation | CustomDocumentationTitles ); + autoSetup(); +} + +DocDoxygenPlugin::~DocDoxygenPlugin() +{ +} + +QPair<KFile::Mode, QString> DocDoxygenPlugin::catalogLocatorProps() +{ + return QPair<KFile::Mode, QString>(KFile::File, "index.html *.tag"); +} + +QString DocDoxygenPlugin::catalogTitle(const QString& url) +{ + QFileInfo fi(url); + if (!fi.exists()) + return QString::null; + + if (fi.extension(false) == "html") + { + QFile f(url); + if (!f.open(IO_ReadOnly)) + return QString::null; + + QTextStream ts(&f); + QString contents = ts.read(); + QRegExp re(".*<title>(.*)</title>.*"); + re.setCaseSensitive(false); + re.search(contents); + return re.cap(1); + } + else if (fi.extension(false) == "tag") + { + QFile *f = 0; + QFile f1(fi.dirPath(true) + "/html/index.html"); + if (f1.open(IO_ReadOnly)) + f = &f1; + QFile f2(fi.dirPath(true) + "/index.html"); + if (f2.open(IO_ReadOnly)) + f = &f2; + if (f != 0) + { + QTextStream ts(f); + QString contents = ts.read(); + QRegExp re(".*<title>(.*)</title>.*"); + re.setCaseSensitive(false); + re.search(contents); + return re.cap(1); + } + } + return QString::null; +} + +QString DocDoxygenPlugin::pluginName() const +{ + return i18n("Doxygen Documentation Collection"); +} + +QStringList DocDoxygenPlugin::fullTextSearchLocations() +{ + QStringList locs; + + QMap<QString, QString> entryMap = config->entryMap("Locations"); + + for (QMap<QString, QString>::const_iterator it = entryMap.begin(); + it != entryMap.end(); ++it) + { + config->setGroup("Search Settings"); + if (config->readBoolEntry(it.key(), false)) + { + config->setGroup("Locations"); + QFileInfo fi(config->readPathEntry(it.key())); + locs << fi.dirPath(true); + } + } + + return locs; +} + +void DocDoxygenPlugin::setCatalogURL(DocumentationCatalogItem* item) +{ + if (item->url().url().endsWith("tag")) + { + QFileInfo fi(item->url().directory(false) + "html/index.html"); + if (fi.exists()) + { + item->setURL(KURL::fromPathOrURL(fi.absFilePath())); + return; + } + QFileInfo fi2(item->url().directory(false) + "index.html"); + if (fi2.exists()) + { + item->setURL(KURL::fromPathOrURL(fi2.absFilePath())); + return; + } + item->setURL(KURL()); + } +} + +bool DocDoxygenPlugin::needRefreshIndex(DocumentationCatalogItem* item) +{ + DoxyDocumentationCatalogItem *doxyItem = dynamic_cast<DoxyDocumentationCatalogItem*>(item); + if (!doxyItem) + return false; + + QFileInfo fi(doxyItem->origUrl()); + config->setGroup("Index"); + if (fi.lastModified() > config->readDateTimeEntry(item->text(0), new QDateTime())) + { + kdDebug() << "need rebuild index for " << item->text(0) << endl; + config->writeEntry(item->text(0), fi.lastModified()); + return true; + } + else + return false; +} + +void DocDoxygenPlugin::autoSetupPlugin() +{ + autoSetupDocs(KDELIBS_DOXYDIR, "en/kdelibs-apidocs", "The KDE API Reference (The KDE API Reference)"); + autoSetupDocs("", "en/kdevelop-apidocs", "The KDevelop Platform API Documentation (KDevelop)"); + +} + +void DocDoxygenPlugin::autoSetupDocs(const QString &defaultDir, const QString &searchDir, + const QString &name) +{ + QString doxyDocDir(defaultDir); + doxyDocDir = URLUtil::envExpand(doxyDocDir); + if (doxyDocDir.isEmpty()) + { + QStringList apiDirs = DocDoxygenPluginFactory::instance()->dirs()->findDirs("html", searchDir); + for (QStringList::const_iterator it = apiDirs.begin(); it != apiDirs.end(); ++it ) + { + doxyDocDir = *it; + QString indexFile = doxyDocDir + "index.html"; + if (QFile::exists(indexFile)) + { + doxyDocDir = doxyDocDir + "/" + searchDir; + break; + } + doxyDocDir = ""; + } + } + if (!doxyDocDir.isEmpty()) + { + config->setGroup("Search Settings"); + config->writeEntry(name, true); + config->setGroup("Index Settings"); + config->writeEntry(name, true); + config->setGroup("Locations"); + config->writePathEntry(name, doxyDocDir + QString("/index.html")); + } +} + +void DocDoxygenPlugin::createIndex(IndexBox* index, DocumentationCatalogItem* item) +{ + QFileInfo fi(item->url().path()); + if (!fi.exists()) + return; + + DoxyDocumentationCatalogItem *doxyItem = dynamic_cast<DoxyDocumentationCatalogItem*>(item); + if (!doxyItem) + return; + + //doxygen documentation mode (if catalog points to a .tag) + if (doxyItem->origUrl().endsWith("tag")) + { + QString htmlUrl; + QFileInfo fi2(item->url().directory(false) + "index.html"); + if (fi2.exists()) + htmlUrl = fi2.dirPath(true) + "/"; + QFileInfo fi(item->url().directory(false) + "html/index.html"); + if (fi.exists()) + htmlUrl = fi.dirPath(true) + "/"; + + createBookIndex(doxyItem->origUrl(), index, item, htmlUrl); + } + + //KDE doxygen documentation mode (if catalog points to a index.html) + QDir d; + QValueStack<QString> dirStack; + dirStack.push(fi.dirPath(true)); + do { + d.setPath(dirStack.pop()); + if (!d.exists()) + continue; + + const QFileInfoList *dirEntries = d.entryInfoList(); + if (!dirEntries) continue; + QPtrListIterator<QFileInfo> it(*dirEntries); + for (; it.current(); ++it) + { + QString fileName = it.current()->fileName(); + if (fileName == "." || fileName == ".." || fileName == "common" || fileName == "html") + continue; + if (it.current()->isDir()) + dirStack.push(it.current()->absFilePath()); + } + + if (QFile::exists(d.absPath() + "/html/index.html")) + createBookIndex(d.absPath() + "/" + d.dirName() + ".tag", index, item); + } while (!dirStack.isEmpty()); +} + +void DocDoxygenPlugin::createTOC(DocumentationCatalogItem* item) +{ + QFileInfo fi(item->url().path()); + if (!fi.exists()) + return; + + DoxyDocumentationCatalogItem *doxyItem = dynamic_cast<DoxyDocumentationCatalogItem*>(item); + if (!doxyItem) + return; + + //doxygen documentation mode (if catalog points to a .tag) + if (doxyItem->origUrl().endsWith("tag")) + { + QString htmlUrl; + QFileInfo fi2(item->url().directory(false) + "index.html"); + if (fi2.exists()) + htmlUrl = fi2.dirPath(true) + "/"; + QFileInfo fi(item->url().directory(false) + "html/index.html"); + if (fi.exists()) + htmlUrl = fi.dirPath(true) + "/"; + if (!htmlUrl.isEmpty()) + createBookTOC(item, doxyItem->origUrl(), htmlUrl); + } + + //KDE doxygen documentation mode (if catalog points to a index.html) + QDir d; + QValueStack<QString> dirStack; + dirStack.push(fi.dirPath(true)); + do { + d.setPath(dirStack.pop()); + if (!d.exists()) + continue; + + const QFileInfoList *dirEntries = d.entryInfoList(); + if (!dirEntries) continue; + QPtrListIterator<QFileInfo> it(*dirEntries); + for (; it.current(); ++it) + { + QString fileName = it.current()->fileName(); + if (fileName == "." || fileName == ".." || fileName == "common" || fileName == "html") + continue; + if (it.current()->isDir()) + dirStack.push(it.current()->absFilePath()); + } + + if (QFile::exists(d.absPath() + "/html/index.html")) + { + DocumentationItem *docItem = new DocumentationItem(DocumentationItem::Book, item, d.dirName()); + docItem->setURL(KURL(d.absPath() + "/html/index.html")); + docItem->setExpandable(true); + createBookTOC(docItem); + } + } while (!dirStack.isEmpty()); +} + +DocumentationCatalogItem *DocDoxygenPlugin::createCatalog(KListView *contents, const QString &title, const QString &url) +{ + kdDebug() << "DocDoxygenPlugin::createCatalog: url=" << url << endl; + DocumentationCatalogItem *item = new DoxyDocumentationCatalogItem(url, this, contents, title); + item->setURL(url); + return item; +} + +void DocDoxygenPlugin::createBookTOC(DocumentationItem *item, const QString &tagUrl, const QString &baseHtmlUrl) +{ + QString tagName; + if (tagUrl.isEmpty()) + tagName = item->url().upURL().directory(false) + item->text(0) + ".tag"; + else + tagName = tagUrl; + + QString baseUrl; + if (baseHtmlUrl.isEmpty()) + baseUrl = item->url().directory(false); + else + baseUrl = baseHtmlUrl; + + //@todo list html files in the directory if tag was not found + if (!QFile::exists(tagName)) + return; + + QStringList tagFileList; + if (tagName.endsWith(".tag")) + tagFileList = tagFiles(QFileInfo(tagName).dirPath() + "/"); + else + tagFileList += tagName; + + QStringList::ConstIterator end = tagFileList.constEnd(); + for (QStringList::ConstIterator it = tagFileList.constBegin(); it != end; ++it) + { + QFile f(*it); + if (!f.open(IO_ReadOnly)) + { + kdDebug(9002) << "Could not open tag file: " << f.name() << endl; + return; + } + + QDomDocument dom; + if (!dom.setContent(&f) || dom.documentElement().nodeName() != "tagfile") + { + kdDebug(9002) << "No valid tag file" << endl; + return; + } + f.close(); + + QDomElement docEl = dom.documentElement(); + + QDomElement childEl = docEl.lastChild().toElement(); + while (!childEl.isNull()) + { + if (childEl.tagName() == "compound" && childEl.attribute("kind") == "class") + { + QString classname = childEl.namedItem("name").firstChild().toText().data(); + QString filename = childEl.namedItem("filename").firstChild().toText().data(); + + if (QFile::exists(baseUrl + filename)) + { + DocumentationItem *docItem = new DocumentationItem(DocumentationItem::Document, + item, classname); + docItem->setURL(KURL(baseUrl + filename)); + } + } + childEl = childEl.previousSibling().toElement(); + } + } +} + +void DocDoxygenPlugin::createBookIndex(const QString &tagfile, IndexBox* index, DocumentationCatalogItem* item, const QString &baseHtmlUrl) +{ + QString tagName = tagfile; + kdDebug() << tagfile << endl; + if (!QFile::exists(tagName)) + return; + QString prefix = baseHtmlUrl.isEmpty() ? KURL(tagfile).directory(false) + "html/" : baseHtmlUrl; + + QStringList tagFileList = tagFiles(QFileInfo(tagName).dirPath() + "/"); + + QStringList::ConstIterator end = tagFileList.constEnd(); + for (QStringList::ConstIterator it = tagFileList.constBegin(); it != end; ++it) + { + QFile f(*it); + if (!f.open(IO_ReadOnly)) + { + kdDebug(9002) << "Could not open tag file: " << f.name() << endl; + return; + } + + QDomDocument dom; + if (!dom.setContent(&f) || dom.documentElement().nodeName() != "tagfile") + { + kdDebug(9002) << "No valid tag file" << endl; + return; + } + f.close(); + + QDomElement docEl = dom.documentElement(); + createIndexFromTag(dom, index, item, docEl, prefix); + } +} + +void DocDoxygenPlugin::createIndexFromTag(QDomDocument &dom, IndexBox *index, + DocumentationCatalogItem *item, QDomElement &parentEl, const QString &prefix) +{ + QDomElement docEl = parentEl; + + QDomElement childEl = docEl.firstChild().toElement(); + while (!childEl.isNull()) + { + if (childEl.tagName() == "compound" && + ((childEl.attribute("kind") == "class") + || (childEl.attribute("kind") == "struct") + || (childEl.attribute("kind") == "namespace") )) + { + QString classname = childEl.namedItem("name").firstChild().toText().data(); + QString filename = childEl.namedItem("filename").firstChild().toText().data(); + + IndexItemProto *indexItem = new IndexItemProto(this, item, index, classname, + i18n("%1 Class Reference").arg(classname)); + indexItem->addURL(KURL(prefix + filename)); + + createIndexFromTag(dom, index, item, childEl, prefix + filename); + } + else if ((childEl.tagName() == "member") && + ((childEl.attribute("kind") == "function") + || (childEl.attribute("kind") == "slot") + || (childEl.attribute("kind") == "signal") )) + { + QString classname = parentEl.namedItem("name").firstChild().toText().data(); + QString membername = childEl.namedItem("name").firstChild().toText().data(); + QString anchor = childEl.namedItem("anchor").firstChild().toText().data(); + QString arglist = childEl.namedItem("arglist").firstChild().toText().data(); + + if (classname != membername) + { + IndexItemProto *indexItem = new IndexItemProto(this, item, index, membername,i18n("%1::%2%3 Member Reference").arg(classname).arg(membername).arg(arglist)); + indexItem->addURL(KURL(prefix + "#" + anchor)); + } + } + childEl = childEl.nextSibling().toElement(); + } +} + +ProjectDocumentationPlugin *DocDoxygenPlugin::projectDocumentationPlugin(ProjectDocType type) +{ + if (type == APIDocs) + return new ProjectDocumentationPlugin(this, type); + return DocumentationPlugin::projectDocumentationPlugin(type); +} + +QStringList DocDoxygenPlugin::tagFiles(const QString& path, int level) +{ + QStringList r; + QDir dir(path); + if (level > 10) return r; + if (!dir.isReadable()) return r; + if (!dir.exists()) return r; + + QStringList dirList; + QStringList fileList; + QStringList::Iterator it; + + dir.setFilter ( QDir::Dirs); + dirList = dir.entryList(); + + dirList.remove("."); + dirList.remove(".."); + + dir.setFilter(QDir::Files | QDir::Hidden | QDir::System); + fileList = dir.entryList(); + QStringList::Iterator end = dirList.end(); + for ( it = dirList.begin(); it != end; ++it ) + { + QString name = *it; + if (QFileInfo( dir, *it ).isSymLink()) + continue; + r += tagFiles(path + name + "/", level + 1 ); + } + + QStringList::Iterator fend = fileList.end(); + for ( it = fileList.begin(); it != fend; ++it ) + { + QString name = *it; + QFileInfo fi( dir, *it ); + if (fi.isSymLink() || !fi.isFile()) + continue; + + if (QDir::match(QString("*.tag"), name)) + r += (path+name); + } + + return r; +} + +#include "docdoxygenplugin.moc" diff --git a/parts/documentation/plugins/doxygen/docdoxygenplugin.desktop b/parts/documentation/plugins/doxygen/docdoxygenplugin.desktop new file mode 100644 index 00000000..57bb4262 --- /dev/null +++ b/parts/documentation/plugins/doxygen/docdoxygenplugin.desktop @@ -0,0 +1,45 @@ +[Desktop Entry] +Type=Service +Name=DocDoxygenPlugin +Name[da]=DocDoxygen-plugin +Name[ms]=PluginDocDoxygen +Name[sk]=Doc Doxygen modul +Name[sv]=Doxygen-dokumentationsinsticksmodul +Name[ta]=DocDoxygen சொருகு +Name[zh_TW]=Doxygen 文件外掛程式 +Exec=blubb +Comment=Documentation plugin for Doxygen documentation +Comment[ca]=Connector de documentació per a documentació Doxygen +Comment[da]=Dokumentations-plugin for Doxygen-dokumentation +Comment[de]=Komponente für Doxygen-Dokumentation +Comment[el]=Πρόσθετο τεκμηρίωσης για τεκμηρίωση τύπου Doxygen +Comment[es]=Complemento de documentación para Doxygen +Comment[et]=Doxygeni dokumentatsiooni plugin +Comment[eu]=Doxygen dokumentaziorako dokumentazio plugin-a +Comment[fa]=وصلۀ مستندسازی برای مستندات Doxygen +Comment[fr]=Module externe de documentation pour la documentation Doxygen +Comment[gl]=Extensión de documentación para documentación Doxygen +Comment[hu]=Dokumentációmodul Doxygen-dokumentációhoz +Comment[it]=Plugin di documentazione per file di Doxygen +Comment[ja]=Doxygen ドキュメンテーションのためのドキュメンテーションプラグイン +Comment[ms]=Plugin dokumentasi untuk dokumentasi Doxygen +Comment[nds]=Dokmentatschoon-Moduul för Doxygen-Dokmentatschoon +Comment[ne]=Doxygen मिसिलीकरणका लागि मिसिलीकरण प्लगइन +Comment[nl]=Documentatie plugin voor Doxygen documentatie +Comment[pl]=Wtyczka dokumentacji dla dokumentacji w formacie Doxygen +Comment[pt]='Plugin' para documentação Doxygen +Comment[pt_BR]=Plug-in de documentação para documento Doxygen +Comment[ru]=Модуль для просмотра документации Doxygen +Comment[sk]=Dokumentačný modul pre Doxygen dokumentáciu +Comment[sl]=Dokumentacijski vstavek za dokumentacijo Doxygen +Comment[sr]=Документациони прикључак за Doxygen документацију +Comment[sr@Latn]=Dokumentacioni priključak za Doxygen dokumentaciju +Comment[sv]=Dokumentationsinsticksmodul för Doxygen-dokumentation +Comment[ta]= Doxygen ஆவணத்திற்கான ஆவணச் சொருகு +Comment[tg]=Модул барои наоиш намудани ҳуҷҷатҳо дар Doxygen +Comment[tr]=Doxygen belgelendirmesi için belgelendirme eklentisi +Comment[zh_CN]=Doxygen 文档的文档插件 +Comment[zh_TW]=Doxygen 文件外掛程式 +ServiceTypes=KDevelop/DocumentationPlugins +X-KDevelop-Version=5 +X-KDE-Library=libdocdoxygenplugin diff --git a/parts/documentation/plugins/doxygen/docdoxygenplugin.h b/parts/documentation/plugins/doxygen/docdoxygenplugin.h new file mode 100644 index 00000000..fbd7e56f --- /dev/null +++ b/parts/documentation/plugins/doxygen/docdoxygenplugin.h @@ -0,0 +1,75 @@ +/*************************************************************************** + * Copyright (C) 2004 by Alexander Dymo * + * cloudtemple@mksat.net * + * * + * 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., * + * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * + ***************************************************************************/ +#ifndef DOCDOXYGENPLUGIN_H +#define DOCDOXYGENPLUGIN_H + +#include <kdevdocumentationplugin.h> + +class QDomDocument; +class QDomElement; + +class DocDoxygenPlugin: public DocumentationPlugin +{ + Q_OBJECT +public: + DocDoxygenPlugin(QObject* parent, const char* name, const QStringList args = QStringList()); + ~DocDoxygenPlugin(); + + virtual QString pluginName() const; + + virtual DocumentationCatalogItem *createCatalog(KListView *contents, const QString &title, const QString &url); + + virtual void createTOC(DocumentationCatalogItem* item); + virtual void setCatalogURL(DocumentationCatalogItem* item); + + virtual bool needRefreshIndex(DocumentationCatalogItem* item); + virtual void createIndex(IndexBox* index, DocumentationCatalogItem* item); + + virtual QStringList fullTextSearchLocations(); + + virtual QPair<KFile::Mode, QString> catalogLocatorProps(); + virtual QString catalogTitle(const QString& url); + + virtual void autoSetupPlugin(); + + virtual ProjectDocumentationPlugin *projectDocumentationPlugin(ProjectDocType type); + +protected: + void createBookTOC(DocumentationItem* item, const QString &tagUrl = QString::null, + const QString &baseHtmlUrl = QString::null); + void createBookIndex(const QString &tagfile, IndexBox* index, DocumentationCatalogItem* item, const QString &baseHtmlUrl = QString::null); + + void createIndexFromTag(QDomDocument &dom, IndexBox* index, DocumentationCatalogItem* item, + QDomElement &parentEl, const QString &prefix); + + void autoSetupDocs(const QString &defaultDir, const QString &searchDir, + const QString &name); + + /** + * Returns all the tag files from a directory and its subdirectories. + * @param startDir the directory to start with + * @param level the depth of the current search + * @return a list with the absolute path to the ".tag" files in startDir + */ + QStringList tagFiles(const QString &startDir, int level = 0); +}; + + +#endif diff --git a/parts/documentation/plugins/kdevtoc/Makefile.am b/parts/documentation/plugins/kdevtoc/Makefile.am new file mode 100644 index 00000000..a40dd995 --- /dev/null +++ b/parts/documentation/plugins/kdevtoc/Makefile.am @@ -0,0 +1,10 @@ +INCLUDES = -I$(top_srcdir)/lib/interfaces -I$(top_srcdir)/lib/util \ + -I$(top_srcdir)/parts/documentation/interfaces $(all_includes) +METASOURCES = AUTO +kde_module_LTLIBRARIES = libdockdevtocplugin.la +libdockdevtocplugin_la_LDFLAGS = -module -avoid-version -no-undefined $(all_libraries) +kde_services_DATA = dockdevtocplugin.desktop +noinst_HEADERS = dockdevtocplugin.h +libdockdevtocplugin_la_SOURCES = dockdevtocplugin.cpp +libdockdevtocplugin_la_LIBADD = $(top_builddir)/lib/libkdevelop.la \ + $(top_builddir)/parts/documentation/interfaces/libdocumentation_interfaces.la diff --git a/parts/documentation/plugins/kdevtoc/dockdevtocplugin.cpp b/parts/documentation/plugins/kdevtoc/dockdevtocplugin.cpp new file mode 100644 index 00000000..65ebf35f --- /dev/null +++ b/parts/documentation/plugins/kdevtoc/dockdevtocplugin.cpp @@ -0,0 +1,277 @@ +/*************************************************************************** + * Copyright (C) 2004 by Alexander Dymo * + * cloudtemple@mksat.net * + * * + * 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., * + * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * + ***************************************************************************/ +#include "dockdevtocplugin.h" + +#include <unistd.h> + +#include <qdom.h> +#include <qfile.h> +#include <qfileinfo.h> +#include <qdialog.h> + +#include <kurl.h> +#include <kaboutdata.h> +#include <kconfig.h> +#include <klocale.h> +#include <klistview.h> +#include <kstandarddirs.h> + +#include <urlutil.h> +#include <kdevgenericfactory.h> +#include <kdevplugininfo.h> + +#include "../../../../config.h" + +class TOCDocumentationCatalogItem: public DocumentationCatalogItem +{ +public: + TOCDocumentationCatalogItem(const QString &tocFile, DocumentationPlugin* plugin, + KListView *parent, const QString &name) + :DocumentationCatalogItem(plugin, parent, name), m_tocFile(tocFile) + { + } + TOCDocumentationCatalogItem(const QString &tocFile, DocumentationPlugin* plugin, + DocumentationItem *parent, const QString &name) + :DocumentationCatalogItem(plugin, parent, name), m_tocFile(tocFile) + { + } + QString tocFile() const { return m_tocFile; } + +private: + QString m_tocFile; +}; + + +static const KDevPluginInfo data("dockdevtocplugin"); +typedef KDevGenericFactory<DocKDevTOCPlugin> DocKDevTOCPluginFactory; +K_EXPORT_COMPONENT_FACTORY( libdockdevtocplugin, DocKDevTOCPluginFactory(data) ) + +DocKDevTOCPlugin::DocKDevTOCPlugin(QObject* parent, const char* name, + const QStringList /*args*/) + :DocumentationPlugin(DocKDevTOCPluginFactory::instance()->config(), parent, name) +{ + setCapabilities(Index); + autoSetup(); +} + +DocKDevTOCPlugin::~DocKDevTOCPlugin() +{ +} + +QString DocKDevTOCPlugin::pluginName() const +{ + return i18n("KDevelopTOC Documentation Collection"); +} + +DocumentationCatalogItem* DocKDevTOCPlugin::createCatalog(KListView* contents, const QString& title, const QString& url) +{ + return new TOCDocumentationCatalogItem(url, this, contents, title); +} + +QPair<KFile::Mode, QString> DocKDevTOCPlugin::catalogLocatorProps() +{ + return QPair<KFile::Mode, QString>(KFile::File, "*.toc"); +} + +QString DocKDevTOCPlugin::catalogTitle(const QString& url) +{ + QFileInfo fi(url); + if (!fi.exists()) + return QString::null; + + QFile f(url); + if (!f.open(IO_ReadOnly)) + return QString::null; + + QDomDocument doc; + if (!doc.setContent(&f) || (doc.doctype().name() != "kdeveloptoc")) + return QString::null; + f.close(); + + QDomElement titleEl = doc.documentElement().namedItem("title").toElement(); + + return titleEl.firstChild().toText().data(); +} + + +QStringList DocKDevTOCPlugin::fullTextSearchLocations() +{ + return QStringList(); +} + +bool DocKDevTOCPlugin::needRefreshIndex(DocumentationCatalogItem* /*item*/) +{ + return false; +} + +void DocKDevTOCPlugin::autoSetupPlugin() +{ + QStringList tocsDir = DocKDevTOCPluginFactory::instance()->dirs()->findAllResources("data", "kdevdocumentation/tocs/*.toc"); + + for (QStringList::const_iterator it = tocsDir.begin(); it != tocsDir.end(); ++it) + { + config->setGroup("Locations"); + config->writePathEntry(catalogTitle(*it), *it); + } +} + +void DocKDevTOCPlugin::createIndex(IndexBox* index, DocumentationCatalogItem* item) +{ + TOCDocumentationCatalogItem *tocItem = dynamic_cast<TOCDocumentationCatalogItem *>(item); + if (!tocItem) + return; + + QFileInfo fi(tocItem->tocFile()); + + QFile f(tocItem->tocFile()); + if (!f.open(IO_ReadOnly)) + { + kdDebug(9002) << "Could not read" << tocItem->tocFile() << endl; + return; + } + QDomDocument doc; + if (!doc.setContent(&f) || doc.doctype().name() != "kdeveloptoc") + { + kdDebug(9002) << "Not a valid kdeveloptoc file: " << tocItem->tocFile() << endl; + return; + } + f.close(); + + QDomElement docEl = doc.documentElement(); + QDomElement baseEl = docEl.namedItem("base").toElement(); + + QString base; + if (!baseEl.isNull()) + base = baseEl.attribute("href", QString::null); + + QDomElement indexEl = docEl.namedItem("index").toElement(); + QDomElement childEl = indexEl.firstChild().toElement(); + while (!childEl.isNull()) + { + if (childEl.tagName() == "entry") + { + QString name = childEl.attribute("name"); + QString url = childEl.attribute("url"); + + IndexItemProto *ii = new IndexItemProto(this, item, index, name, item->text(0)); + ii->addURL(KURL(constructURL(base, url))); + } + childEl = childEl.nextSibling().toElement(); + } +} + +void DocKDevTOCPlugin::createTOC(DocumentationCatalogItem* item) +{ + TOCDocumentationCatalogItem *tocItem = dynamic_cast<TOCDocumentationCatalogItem *>(item); + if (!tocItem) + return; + + QFileInfo fi(tocItem->tocFile()); + + QFile f(tocItem->tocFile()); + if (!f.open(IO_ReadOnly)) + { + kdDebug(9002) << "Could not read" << tocItem->tocFile() << endl; + return; + } + QDomDocument doc; + if (!doc.setContent(&f) || doc.doctype().name() != "kdeveloptoc") + { + kdDebug(9002) << "Not a valid kdeveloptoc file: " << tocItem->tocFile() << endl; + return; + } + f.close(); + + QDomElement docEl = doc.documentElement(); + QDomElement baseEl = docEl.namedItem("base").toElement(); + + QString base; + if (!baseEl.isNull()) + base = baseEl.attribute("href", QString::null); + + QDomElement childEl = docEl.lastChild().toElement(); + addTocSect(tocItem, childEl, base, 1); +} + +void DocKDevTOCPlugin::addTocSect(DocumentationItem *parent, QDomElement childEl, const QString &base, uint level) +{ + while (!childEl.isNull()) + { + if (childEl.tagName() == QString("tocsect%1").arg(level)) + { + QString name = childEl.attribute("name"); + QString url = childEl.attribute("url"); + + DocumentationItem *item = new DocumentationItem(level == 1 ? DocumentationItem::Book : DocumentationItem::Document, parent, name); + item->setURL(KURL(constructURL(base, url))); + + QDomElement grandchildEl = childEl.lastChild().toElement(); + addTocSect(item, grandchildEl, base, level+1); + } + childEl = childEl.previousSibling().toElement(); + } +} + +void DocKDevTOCPlugin::setCatalogURL(DocumentationCatalogItem* item) +{ + TOCDocumentationCatalogItem *tocItem = dynamic_cast<TOCDocumentationCatalogItem *>(item); + if (!tocItem) + return; + + QFileInfo fi(tocItem->tocFile()); + + QFile f(tocItem->tocFile()); + if (!f.open(IO_ReadOnly)) + { + kdDebug(9002) << "Could not read" << tocItem->tocFile() << endl; + return; + } + QDomDocument doc; + if (!doc.setContent(&f) || doc.doctype().name() != "kdeveloptoc") + { + kdDebug(9002) << "Not a valid kdeveloptoc file: " << tocItem->tocFile() << endl; + return; + } + f.close(); + + QDomElement docEl = doc.documentElement(); + QDomElement baseEl = docEl.namedItem("base").toElement(); + + if (item->url().isEmpty()) + { + if (baseEl.isNull()) + item->setURL(KURL()); + else + item->setURL(KURL(constructURL(baseEl.attribute("href", QString::null), + baseEl.attribute("url", QString::null)))); + } +} + +QString DocKDevTOCPlugin::constructURL(const QString &base, const QString &url) +{ + if (base.isEmpty() && !url.isEmpty()) + return url; + if (!url.isEmpty()) + return base.endsWith("/") ? base + url : base + "/" + url; + else + return base; +} + +#include "dockdevtocplugin.moc" diff --git a/parts/documentation/plugins/kdevtoc/dockdevtocplugin.desktop b/parts/documentation/plugins/kdevtoc/dockdevtocplugin.desktop new file mode 100644 index 00000000..d665e9af --- /dev/null +++ b/parts/documentation/plugins/kdevtoc/dockdevtocplugin.desktop @@ -0,0 +1,43 @@ +[Desktop Entry] +Type=Service +Name=DocKDevTOCPlugin +Name[da]=DocKDevTOC-plugin +Name[sk]=Doc KDevTOC modul +Name[sv]=KDevelop innehållsförteckning-dokumentationsinsticksmodul +Name[ta]=DocKDevTOC சொருகு +Name[zh_TW]=KDevelop 目錄文件外掛程式 +Exec=blubb +Comment=Documentation plugin for KDevelopTOC documentation +Comment[ca]=Connector de documentació per a documentació KDevelopTOC +Comment[da]=Dokumentations-plugin for KDevelopTOC-dokumentation +Comment[de]=Komponente für KDevelopTOC-Dokumentation +Comment[el]=Πρόσθετο τεκμηρίωσης για τεκμηρίωση τύπου KDevelopTOC +Comment[es]=Complemento de documentación para KDevelopTOC +Comment[et]=KDevelopTOC dokumentatsiooni plugin +Comment[eu]=KDevelopTOC dokumentaziorako dokumentazio plugin-a +Comment[fa]=وصلۀ مستندسازی برای مستندات KDevelopTOC +Comment[fr]=Module externe de documentation pour la documentation KDevelopTOC +Comment[gl]=Extensión de documentación para documentación KDevelopTOC +Comment[hu]=Dokumentációmodul KDevelopTOC-dokumentációhoz +Comment[it]=Plugin di documentazione per file di KDevelopTOC +Comment[ja]=KDevelopTOC ドキュメンテーションのためのドキュメンテーションプラグイン +Comment[ms]=Plugin dokumentasi untuk dokumentasi KDevelopTOC +Comment[nds]=Dokmentatschoon-Moduul för KDevelopTOC-Dokmentatschoon +Comment[ne]=KDevelopTOC मिसिलीकरणका लागि मिसिलीकरण प्लगइन +Comment[nl]=Documentatie plugin for KDevelopTOC documentatie +Comment[pl]=Wtyczka dokumentacji dla dokumentacji w formacie KDevelopTOC +Comment[pt]='Plugin' para documentação KDevelopTOC +Comment[pt_BR]=Plug-in de documentação para document TOC do KDevelop +Comment[ru]=Модуль для просмотра KDevelopTOC +Comment[sk]=Dokumentačný modul pre KDevelopTOC dokumentáciu +Comment[sr]=Документациони прикључак за KDevelopTOC документацију +Comment[sr@Latn]=Dokumentacioni priključak za KDevelopTOC dokumentaciju +Comment[sv]=Dokumentationsinsticksmodul för KDevelop innehållsförteckningsdokumentation +Comment[ta]= KDevelopTOC ஆவணத்திற்கான ஆவணச் சொருகு +Comment[tg]=Модул барои наоиши KDevelopTOC +Comment[tr]=KDevelopTOC belgelendirmesi için belgelendirme eklentisi +Comment[zh_CN]=KDevelopTOC 文档的文档插件 +Comment[zh_TW]=KDevelop 目錄文件外掛程式 +ServiceTypes=KDevelop/DocumentationPlugins +X-KDevelop-Version=5 +X-KDE-Library=libdockdevtocplugin diff --git a/parts/documentation/plugins/kdevtoc/dockdevtocplugin.h b/parts/documentation/plugins/kdevtoc/dockdevtocplugin.h new file mode 100644 index 00000000..4a958473 --- /dev/null +++ b/parts/documentation/plugins/kdevtoc/dockdevtocplugin.h @@ -0,0 +1,54 @@ +/*************************************************************************** + * Copyright (C) 2004 by Alexander Dymo * + * cloudtemple@mksat.net * + * * + * 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., * + * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * + ***************************************************************************/ +#ifndef DOCKDEVTOCPLUGIN_H +#define DOCKDEVTOCPLUGIN_H + +#include <qdom.h> + +#include <kdevdocumentationplugin.h> + +class DocKDevTOCPlugin : public DocumentationPlugin +{ + Q_OBJECT +public: + DocKDevTOCPlugin(QObject* parent, const char* name, const QStringList args = QStringList()); + ~DocKDevTOCPlugin(); + + virtual QString pluginName() const; + + virtual QString catalogTitle(const QString& url); + virtual DocumentationCatalogItem* createCatalog(KListView* contents, const QString& title, const QString& url); + virtual void createTOC(DocumentationCatalogItem* item); + virtual void setCatalogURL(DocumentationCatalogItem* item); + + virtual bool needRefreshIndex(DocumentationCatalogItem* item); + virtual void createIndex(IndexBox* index, DocumentationCatalogItem* item); + + virtual QStringList fullTextSearchLocations(); + + virtual QPair<KFile::Mode, QString > catalogLocatorProps(); + virtual void autoSetupPlugin(); + +protected: + void addTocSect(DocumentationItem *parent, QDomElement childEl, const QString &base, uint level); + static QString constructURL(const QString &base, const QString &url) ; +}; + +#endif diff --git a/parts/documentation/plugins/pdb/Makefile.am b/parts/documentation/plugins/pdb/Makefile.am new file mode 100644 index 00000000..4d015e3c --- /dev/null +++ b/parts/documentation/plugins/pdb/Makefile.am @@ -0,0 +1,8 @@ +INCLUDES = -I$(top_srcdir)/lib/interfaces $(all_includes) +METASOURCES = AUTO +kde_module_LTLIBRARIES = libdocpdbplugin.la +libdocpdbplugin_la_LDFLAGS = -module -avoid-version -no-undefined $(all_libraries) +libdocpdbplugin_la_LIBADD = $(top_builddir)/lib/libkdevelop.la +noinst_HEADERS = docpdbplugin.h +libdocpdbplugin_la_SOURCES = docpdbplugin.cpp +kde_services_DATA = docpdbplugin.desktop diff --git a/parts/documentation/plugins/pdb/docpdbplugin.cpp b/parts/documentation/plugins/pdb/docpdbplugin.cpp new file mode 100644 index 00000000..5c2f68c7 --- /dev/null +++ b/parts/documentation/plugins/pdb/docpdbplugin.cpp @@ -0,0 +1,103 @@ +/*************************************************************************** + * Copyright (C) 2004 by Mathieu Chouinard * + * mathieu.chouinard@kdemail.net * + * * + * 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., * + * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * + ***************************************************************************/ +#include "docpdbplugin.h" + +#include <kurl.h> +#include <kaboutdata.h> +#include <kconfig.h> +#include <klocale.h> +#include <klistview.h> + +#include <kdevgenericfactory.h> + +static const KAboutData data("docpdbplugin", I18N_NOOP("PalmDoc documentation plugin"), "1.0"); +typedef KDevGenericFactory<DocPDBPlugin> DocPDBPluginFactory; +K_EXPORT_COMPONENT_FACTORY( libdocpdbplugin, DocPDBPluginFactory(&data) ) + +DocPDBPlugin::DocPDBPlugin(QObject* parent, const char* name, const QStringList args) + :DocumentationPlugin(DocPDBPluginFactory::instance()->config(), parent, name) +{ + setCapabilities(CustomDocumentationTitles | ProjectUserManual); + autoSetup(); +} + +DocPDBPlugin::~DocPDBPlugin() +{ +} + +bool DocPDBPlugin::needRefreshIndex(DocumentationCatalogItem* item) +{ + return false; +} + +QString DocPDBPlugin::pluginName() const +{ + return i18n("PalmDoc Documentation Collection"); +} + +DocumentationCatalogItem* DocPDBPlugin::createCatalog(KListView* contents, const QString& title, const QString& url) +{ + DocumentationCatalogItem *item = new DocumentationCatalogItem(this, contents, title); + item->setURL(KURL(url)); + return item; +} + +QPair<KFile::Mode, QString> DocPDBPlugin::catalogLocatorProps() +{ + return QPair<KFile::Mode, QString>(KFile::File, "all/allfiles"); +} + +QString DocPDBPlugin::catalogTitle(const QString& /*url*/) +{ + return QString::null; +} + +QStringList DocPDBPlugin::fullTextSearchLocations() +{ + return QStringList(); +} + + +void DocPDBPlugin::autoSetupPlugin() +{ + return; +} + +void DocPDBPlugin::createIndex(IndexBox* /*index*/, DocumentationCatalogItem* /*item*/) +{ + return; +} + +void DocPDBPlugin::createTOC(DocumentationCatalogItem* /*item*/) +{ + return; +} + +void DocPDBPlugin::setCatalogURL(DocumentationCatalogItem* /*item*/) +{ + return; +} + +ProjectDocumentationPlugin *DocPDBPlugin::projectDocumentationPlugin(ProjectDocType type) +{ + if (type == UserManual) + return new ProjectDocumentationPlugin(this, type); + return DocumentationPlugin::projectDocumentationPlugin(type); +} diff --git a/parts/documentation/plugins/pdb/docpdbplugin.desktop b/parts/documentation/plugins/pdb/docpdbplugin.desktop new file mode 100644 index 00000000..76630793 --- /dev/null +++ b/parts/documentation/plugins/pdb/docpdbplugin.desktop @@ -0,0 +1,43 @@ +[Desktop Entry] +Type=Service +Name=DocPDBPlugin +Name[da]=DocPDB-plugin +Name[sk]=Doc PDB modul +Name[sv]=DocPDB-insticksmodul +Name[ta]=DocQt சொருகு +Name[zh_TW]=PDB 文件外掛程式 +Exec=blubb +Comment=Documentation plugin for Palmdoc format +Comment[ca]=Connector de documentació per al format Palmdoc +Comment[da]=Dokumentations-plugin for Palmdoc-format +Comment[de]=Komponente für das Palmdoc-Dokumentationsformat +Comment[el]=Πρόσθετο τεκμηρίωσης για τη μορφή Palmdoc +Comment[es]=Complemento de documentación para el formato Palmdoc +Comment[et]=PalmDOC-vormingus dokumentatsiooni plugin +Comment[eu]=Palmdoc formaturako dokumentazio plugin-a +Comment[fa]=وصلۀ مستندسازی برای قالب Palmdoc +Comment[fr]=Module externe de documentation pour le format Palmdoc +Comment[gl]=Extensión de documentación para o formato Palmdoc +Comment[hu]=Dokumentációmodul Palmdoc formátumú dokumentációhoz +Comment[it]=Plugin di documentazione per il formato Palmdoc +Comment[ja]=Palmdoc フォーマットのためのドキュメンテーションプラグイン +Comment[ms]=Plugin dokumentasi untuk format Palmdoc +Comment[nds]=Komponente för dat Palmdoc-Dokmentatschoonformaat +Comment[ne]=Palmdoc ढाँचाका लागि मिसिलीकरण प्लगइन +Comment[nl]=Documentatie plugin voor Palmdoc documentatie +Comment[pl]=Wtyczka dokumentacji dla dokumentacji w formacie Palmdoc +Comment[pt]='Plugin' para documentação no formato Palmdoc +Comment[pt_BR]=Plug-in de documentação para o formato Palmdoc +Comment[ru]=Модуль для просмотра документации в формате Palmdoc +Comment[sk]=Dokumentačný modul pre Palmdoc formát +Comment[sr]=Документациони прикључак за Palmdoc формат +Comment[sr@Latn]=Dokumentacioni priključak za Palmdoc format +Comment[sv]=Dokumentationsinsticksmodul för Palmdoc-format +Comment[ta]= CHM ஆவணத்திற்கான ஆவணச் சொருகு +Comment[tg]=Модул барои наоиш намудани ҳуҷҷатҳо дар формати Palmdoc +Comment[tr]=Palmdoc biçimi için belgelendirme eklentisi +Comment[zh_CN]=Palmdoc 格式的文档插件 +Comment[zh_TW]=Palmdoc 格式文件外掛程式 +ServiceTypes=KDevelop/DocumentationPlugins +X-KDevelop-Version=1 +X-KDE-Library=libdocpdbplugin diff --git a/parts/documentation/plugins/pdb/docpdbplugin.h b/parts/documentation/plugins/pdb/docpdbplugin.h new file mode 100644 index 00000000..cdb9e90f --- /dev/null +++ b/parts/documentation/plugins/pdb/docpdbplugin.h @@ -0,0 +1,50 @@ +/*************************************************************************** + * Copyright (C) 2004 by Mathieu Chouinard * + * mathieu.chouinard@kdemail.net * + * * + * 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., * + * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * + ***************************************************************************/ +#ifndef DOCPDBPLUGIN_H +#define DOCPDBPLUGIN_H + +#include <kdevdocumentationplugin.h> + +class DocPDBPlugin : public DocumentationPlugin { +public: + DocPDBPlugin(QObject* parent, const char* name, const QStringList args = QStringList()); + ~DocPDBPlugin(); + + virtual QString pluginName() const; + + virtual DocumentationCatalogItem* createCatalog(KListView* contents, const QString& title, const QString& url); + + virtual void createTOC(DocumentationCatalogItem* item); + virtual void setCatalogURL(DocumentationCatalogItem* item); + + virtual bool needRefreshIndex(DocumentationCatalogItem* item); + virtual void createIndex(IndexBox* index, DocumentationCatalogItem* item); + + virtual QStringList fullTextSearchLocations(); + + virtual QPair<KFile::Mode, QString> catalogLocatorProps(); + virtual QString catalogTitle(const QString& url); + + virtual void autoSetupPlugin(); + + virtual ProjectDocumentationPlugin *projectDocumentationPlugin(ProjectDocType type); +}; + +#endif diff --git a/parts/documentation/plugins/pdf/Makefile.am b/parts/documentation/plugins/pdf/Makefile.am new file mode 100644 index 00000000..8d9617d2 --- /dev/null +++ b/parts/documentation/plugins/pdf/Makefile.am @@ -0,0 +1,8 @@ +INCLUDES = -I$(top_srcdir)/lib/interfaces $(all_includes) +METASOURCES = AUTO +kde_module_LTLIBRARIES = libdocpdfplugin.la +libdocpdfplugin_la_LDFLAGS = $(all_libraries) +libdocpdfplugin_la_LIBADD = $(top_builddir)/lib/libkdevelop.la +noinst_HEADERS = docpdfplugin.h +libdocpdfplugin_la_SOURCES = docpdfplugin.cpp +kde_services_DATA = docpdfplugin.desktop diff --git a/parts/documentation/plugins/pdf/docpdfplugin.cpp b/parts/documentation/plugins/pdf/docpdfplugin.cpp new file mode 100644 index 00000000..02bac373 --- /dev/null +++ b/parts/documentation/plugins/pdf/docpdfplugin.cpp @@ -0,0 +1,103 @@ +/*************************************************************************** + * Copyright (C) 2004 by Mathieu Chouinard * + * mathieu.chouinard@kdemail.net * + * * + * 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., * + * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * + ***************************************************************************/ +#include "docpdfplugin.h" + +#include <kurl.h> +#include <kaboutdata.h> +#include <kconfig.h> +#include <klocale.h> +#include <klistview.h> + +#include <kdevgenericfactory.h> + +static const KAboutData data("docpdfplugin", I18N_NOOP("PDF documentation plugin"), "1.0"); +typedef KDevGenericFactory<DocPDFPlugin> DocPDFPluginFactory; +K_EXPORT_COMPONENT_FACTORY( libdocpdfplugin, DocPDFPluginFactory(&data) ) + +DocPDFPlugin::DocPDFPlugin(QObject* parent, const char* name, const QStringList args) + :DocumentationPlugin(DocPDFPluginFactory::instance()->config(), parent, name) +{ + setCapabilities(CustomDocumentationTitles | ProjectUserManual); + autoSetup(); +} + +DocPDFPlugin::~DocPDFPlugin() +{ +} + +bool DocPDFPlugin::needRefreshIndex(DocumentationCatalogItem* item) +{ + return false; +} + +QString DocPDFPlugin::pluginName() const +{ + return i18n("PDF Documentation Collection"); +} + +DocumentationCatalogItem* DocPDFPlugin::createCatalog(KListView* contents, const QString& title, const QString& url) +{ + DocumentationCatalogItem *item = new DocumentationCatalogItem(this, contents, title); + item->setURL(KURL(url)); + return item; +} + +QPair<KFile::Mode, QString> DocPDFPlugin::catalogLocatorProps() +{ + return QPair<KFile::Mode, QString>(KFile::File, "*.pdf"); +} + +QString DocPDFPlugin::catalogTitle(const QString& /*url*/) +{ + return QString::null; +} + +QStringList DocPDFPlugin::fullTextSearchLocations() +{ + return QStringList(); +} + + +void DocPDFPlugin::autoSetupPlugin() +{ + return; +} + +void DocPDFPlugin::createIndex(IndexBox* /*index*/, DocumentationCatalogItem* /*item*/) +{ + return; +} + +void DocPDFPlugin::createTOC(DocumentationCatalogItem* /*item*/) +{ + return; +} + +void DocPDFPlugin::setCatalogURL(DocumentationCatalogItem* /*item*/) +{ + return; +} + +ProjectDocumentationPlugin *DocPDFPlugin::projectDocumentationPlugin(ProjectDocType type) +{ + if (type == UserManual) + return new ProjectDocumentationPlugin(this, type); + return DocumentationPlugin::projectDocumentationPlugin(type); +} diff --git a/parts/documentation/plugins/pdf/docpdfplugin.desktop b/parts/documentation/plugins/pdf/docpdfplugin.desktop new file mode 100644 index 00000000..f42429ff --- /dev/null +++ b/parts/documentation/plugins/pdf/docpdfplugin.desktop @@ -0,0 +1,43 @@ +[Desktop Entry] +Type=Service +Name=DocPDFPlugin +Name[da]=DocPDF-plugin +Name[sk]=Doc PDF modul +Name[sv]=DocPDF-insticksmodul +Name[ta]=DocQt சொருகுபொருள் +Name[zh_TW]=PDF 文件外掛程式 +Exec=blubb +Comment=Documentation plugin for PDF format +Comment[ca]=Connector de documentació per al format PDF +Comment[da]=Dokumentations-plugin for PDF-format +Comment[de]=Komponente für das PDF-Dokumentationsformat +Comment[el]=Πρόσθετο τεκμηρίωσης για τη μορφή PDF +Comment[es]=Complemento de documentación para el formato PDF +Comment[et]=PDF-vormingus dokumentatsiooni plugin +Comment[eu]=PDF formaturako dokumentazio plugin-a +Comment[fa]=وصلۀ مستندسازی برای قالب PDF +Comment[fr]=Module externe de documentation pour le format PDF +Comment[gl]=Extensión de documentación para o formato PDF +Comment[hu]=Dokumentációmodul PDF formátumú dokumentációhoz +Comment[it]=Plugin di documentazione per formato PDF +Comment[ja]=PDF フォーマットのためのドキュメンテーションプラグイン +Comment[ms]=Plugin dokumentasi untuk format PDF +Comment[nds]=Komponente för dat PDF-Dokmentatschoonformaat +Comment[ne]=PDF ढाँचाका लागि मिसिलीकरण प्लगइन +Comment[nl]=Documentatie plugin voor PDF documentatie +Comment[pl]=Wtyczka dokumentacji dla dokumentacji w formacie PDF +Comment[pt]='Plugin' para documentação no formato PDF +Comment[pt_BR]=Plug-in de documentação para o formato PDF +Comment[ru]=Модуль для просмотра PDF +Comment[sk]=Dokumentačný modul pre PDF formát +Comment[sr]=Документациони прикључак за PDF формат +Comment[sr@Latn]=Dokumentacioni priključak za PDF format +Comment[sv]=Dokumentationsinsticksmodul för PDF-format +Comment[ta]= Qt DCF ஆவணத்திற்கான ஆவணச் சொருகு +Comment[tg]=Модул барои наоиши PDF +Comment[tr]=PDF biçimi için belgelendirme eklentisi +Comment[zh_CN]=PDF 格式的文档插件 +Comment[zh_TW]=PDF 格式文件外掛程式 +ServiceTypes=KDevelop/DocumentationPlugins +X-KDevelop-Version=1 +X-KDE-Library=libdocpdfplugin diff --git a/parts/documentation/plugins/pdf/docpdfplugin.h b/parts/documentation/plugins/pdf/docpdfplugin.h new file mode 100644 index 00000000..4148454a --- /dev/null +++ b/parts/documentation/plugins/pdf/docpdfplugin.h @@ -0,0 +1,50 @@ +/*************************************************************************** + * Copyright (C) 2004 by Mathieu Chouinard * + * mathieu.chouinard@kdemail.net * + * * + * 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., * + * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * + ***************************************************************************/ +#ifndef DOCPDFPLUGIN_H +#define DOCPDFPLUGIN_H + +#include <kdevdocumentationplugin.h> + +class DocPDFPlugin : public DocumentationPlugin { +public: + DocPDFPlugin(QObject* parent, const char* name, const QStringList args = QStringList()); + ~DocPDFPlugin(); + + virtual QString pluginName() const; + + virtual DocumentationCatalogItem* createCatalog(KListView* contents, const QString& title, const QString& url); + + virtual void createTOC(DocumentationCatalogItem* item); + virtual void setCatalogURL(DocumentationCatalogItem* item); + + virtual bool needRefreshIndex(DocumentationCatalogItem* item); + virtual void createIndex(IndexBox* index, DocumentationCatalogItem* item); + + virtual QStringList fullTextSearchLocations(); + + virtual QPair<KFile::Mode, QString> catalogLocatorProps(); + virtual QString catalogTitle(const QString& url); + + virtual void autoSetupPlugin(); + + virtual ProjectDocumentationPlugin *projectDocumentationPlugin(ProjectDocType type); +}; + +#endif diff --git a/parts/documentation/plugins/qt/Makefile.am b/parts/documentation/plugins/qt/Makefile.am new file mode 100644 index 00000000..a25419e7 --- /dev/null +++ b/parts/documentation/plugins/qt/Makefile.am @@ -0,0 +1,14 @@ +INCLUDES = -I$(top_srcdir)/lib/interfaces -I$(top_srcdir)/lib/util \ + -I$(top_srcdir)/parts/documentation/interfaces $(all_includes) + +METASOURCES = AUTO + +kde_module_LTLIBRARIES = libdocqtplugin.la + +noinst_HEADERS = docqtplugin.h +kde_services_DATA = docqtplugin.desktop + +libdocqtplugin_la_LDFLAGS = -module -avoid-version -no-undefined $(all_libraries) +libdocqtplugin_la_SOURCES = docqtplugin.cpp +libdocqtplugin_la_LIBADD = $(top_builddir)/lib/libkdevelop.la \ + $(top_builddir)/parts/documentation/interfaces/libdocumentation_interfaces.la diff --git a/parts/documentation/plugins/qt/docqtplugin.cpp b/parts/documentation/plugins/qt/docqtplugin.cpp new file mode 100644 index 00000000..ffbce63a --- /dev/null +++ b/parts/documentation/plugins/qt/docqtplugin.cpp @@ -0,0 +1,339 @@ +/*************************************************************************** + * Copyright (C) 2004 by Alexander Dymo * + * cloudtemple@mksat.net * + * * + * 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., * + * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * + ***************************************************************************/ +#include "docqtplugin.h" + +#include <unistd.h> + +#include <qfile.h> +#include <qfileinfo.h> +#include <qdialog.h> + +#include <kurl.h> +#include <kaboutdata.h> +#include <kconfig.h> +#include <klocale.h> +#include <klistview.h> + +#include <urlutil.h> +#include <kdevgenericfactory.h> +#include <kdevplugininfo.h> + +#include "../../../../config.h" + +class QtDocumentationCatalogItem: public DocumentationCatalogItem +{ +public: + QtDocumentationCatalogItem(const QString &dcfFile, DocumentationPlugin* plugin, + KListView *parent, const QString &name) + :DocumentationCatalogItem(plugin, parent, name), m_dcfFile(dcfFile) + { + } + QtDocumentationCatalogItem(const QString &dcfFile, DocumentationPlugin* plugin, + DocumentationItem *parent, const QString &name) + :DocumentationCatalogItem(plugin, parent, name), m_dcfFile(dcfFile) + { + } + QString dcfFile() const { return m_dcfFile; } + +private: + QString m_dcfFile; +}; + +static const KDevPluginInfo data("docqtplugin"); +typedef KDevGenericFactory<DocQtPlugin> DocQtPluginFactory; +K_EXPORT_COMPONENT_FACTORY( libdocqtplugin, DocQtPluginFactory(data) ) + +DocQtPlugin::DocQtPlugin(QObject* parent, const char* name, const QStringList) + :DocumentationPlugin(DocQtPluginFactory::instance()->config(), parent, name) +{ + setCapabilities(Index | FullTextSearch | CustomDocumentationTitles); + autoSetup(); +} + +DocQtPlugin::~DocQtPlugin() +{ +} + +void DocQtPlugin::createTOC(DocumentationCatalogItem *item) +{ + QtDocumentationCatalogItem *qtItem = dynamic_cast<QtDocumentationCatalogItem *>(item); + if (!qtItem) + return; + + QFileInfo fi(qtItem->dcfFile()); + + QFile f(qtItem->dcfFile()); + if (!f.open(IO_ReadOnly)) + { + kdDebug(9002) << "Could not read" << qtItem->dcfFile() << endl; + return; + } + QDomDocument doc; + if (!doc.setContent(&f) || doc.doctype().name() != "DCF") + { + kdDebug(9002) << "Not a valid DCF file: " << qtItem->dcfFile() << endl; + return; + } + f.close(); + + QDomElement docEl = doc.documentElement(); + QDomElement titleEl = docEl.namedItem("DCF").toElement(); + + QDomElement childEl = docEl.lastChild().toElement(); + while (!childEl.isNull()) + { + if (childEl.tagName() == "section") + { + QString ref = childEl.attribute("ref"); + QString title = childEl.attribute("title"); + + DocumentationItem *sectionItem = new DocumentationItem(DocumentationItem::Book, item, title); + KURL sectionUrl(fi.dirPath(true) + "/" + ref); + sectionItem->setURL(sectionUrl); + + QDomElement grandChild = childEl.lastChild().toElement(); + while(!grandChild.isNull()) + { + if (grandChild.tagName() == "keyword") + { + QString keyRef = grandChild.attribute("ref"); + QString keyTitle = grandChild.text(); + + DocumentationItem *keyItem = new DocumentationItem(DocumentationItem::Document, sectionItem, keyTitle); + KURL keyUrl(fi.dirPath(true) + "/" + keyRef); + keyItem->setURL(keyUrl); + } + if (grandChild.tagName() == "section") + { + QString keyRef = grandChild.attribute("ref"); + QString keyTitle = grandChild.attribute("title"); + DocumentationItem *keyItem = new DocumentationItem(DocumentationItem::Book, sectionItem, keyTitle); + KURL keyUrl(fi.dirPath(true) + "/" + keyRef); + keyItem->setURL(keyUrl); + } + grandChild = grandChild.previousSibling().toElement(); + } + } + childEl = childEl.previousSibling().toElement(); + } +} + +void DocQtPlugin::autoSetupPlugin() +{ + QString qtDocDir(QT_DOCDIR); + qtDocDir = URLUtil::envExpand(qtDocDir); + if (qtDocDir.isEmpty()) + { + qtDocDir = getenv("QTDIR"); + } + if (!qtDocDir.isEmpty()) + { + config->setGroup("Search Settings"); + config->writeEntry("Qt Reference Documentation", true); + config->setGroup("Index Settings"); + config->writeEntry("Qt Reference Documentation", true); + config->setGroup("Locations"); + config->writePathEntry("Qt Reference Documentation", qtDocDir + QString("/qt.dcf")); + config->writePathEntry("Qt Assistant Manual", qtDocDir + QString("/assistant.dcf")); + config->writePathEntry("Qt Designer Manual", qtDocDir + QString("/designer.dcf")); + config->writePathEntry("Guide to the Qt Translation Tools", qtDocDir + QString("/linguist.dcf")); + config->writePathEntry("qmake User Guide", qtDocDir + QString("/qmake.dcf")); + } +} + +void DocQtPlugin::setCatalogURL(DocumentationCatalogItem *item) +{ + QtDocumentationCatalogItem *qtItem = dynamic_cast<QtDocumentationCatalogItem *>(item); + if (!qtItem) + return; + + QFileInfo fi(qtItem->dcfFile()); + + QFile f(qtItem->dcfFile()); + if (!f.open(IO_ReadOnly)) + { + kdDebug(9002) << "Could not read" << qtItem->dcfFile() << endl; + return; + } + QDomDocument doc; + if (!doc.setContent(&f) || doc.doctype().name() != "DCF") + { + kdDebug(9002) << "Not a valid DCF file: " << qtItem->dcfFile() << endl; + return; + } + f.close(); + + QDomElement docEl = doc.documentElement(); + QDomElement titleEl = docEl.namedItem("DCF").toElement(); + + if (item->url().isEmpty()) + { + KURL url(fi.dirPath(true) + "/" + docEl.attribute("ref", QString::null)); + item->setURL(url); + } +} + +QString DocQtPlugin::pluginName() const +{ + return i18n("Qt Documentation Collection"); +} + +bool DocQtPlugin::needRefreshIndex(DocumentationCatalogItem *item) +{ + QtDocumentationCatalogItem *qtItem = dynamic_cast<QtDocumentationCatalogItem *>(item); + if (!qtItem) + return false; + + QFileInfo fi(qtItem->dcfFile()); + config->setGroup("Index"); + if (fi.lastModified() > config->readDateTimeEntry(qtItem->text(0), new QDateTime())) + { + kdDebug() << "need rebuild index for " << qtItem->text(0) << endl; + config->writeEntry(item->text(0), fi.lastModified()); + return true; + } + else + return false; +} + +void DocQtPlugin::createIndex(IndexBox *index, DocumentationCatalogItem *item) +{ + QtDocumentationCatalogItem *qtItem = dynamic_cast<QtDocumentationCatalogItem *>(item); + if (!qtItem) + return; + + QFileInfo fi(qtItem->dcfFile()); + + QFile f(qtItem->dcfFile()); + if (!f.open(IO_ReadOnly)) + { + kdDebug(9002) << "Could not read" << qtItem->dcfFile() << endl; + return; + } + QDomDocument doc; + if (!doc.setContent(&f) || doc.doctype().name() != "DCF") + { + kdDebug(9002) << "Not a valid DCF file: " << qtItem->dcfFile() << endl; + return; + } + f.close(); + + QDomElement docEl = doc.documentElement(); + QDomElement titleEl = docEl.namedItem("DCF").toElement(); + + QDomElement childEl = docEl.firstChild().toElement(); + while (!childEl.isNull()) + { + if (childEl.tagName() == "section") + { + createSectionIndex(fi, index, item, childEl); + } + childEl = childEl.nextSibling().toElement(); + } +} + +void DocQtPlugin::createSectionIndex(QFileInfo &fi, IndexBox *index, DocumentationCatalogItem *item, + QDomElement section) +{ + //adymo: do not load section to index for Qt reference documentation + QString title = section.attribute("title"); + if (fi.fileName() != "qt.dcf") + { + QString ref = section.attribute("ref"); + + IndexItemProto *ii = new IndexItemProto(this, item, index, title, item->text(0)); + ii->addURL(KURL(fi.dirPath(true) + "/" + ref)); + } + + QDomElement grandChild = section.firstChild().toElement(); + while(!grandChild.isNull()) + { + if (grandChild.tagName() == "keyword") + { + QString keyRef = grandChild.attribute("ref"); + QString keyTitle = grandChild.text(); + + //adymo: a little hack to avoid unwanted elements + if (keyRef != "qdir-example.html") + { + IndexItemProto *ii = new IndexItemProto(this, item, index, keyTitle, title); + ii->addURL(KURL(fi.dirPath(true) + "/" + keyRef)); + } + } + if (grandChild.tagName() == "section") + { + createSectionIndex(fi, index, item, grandChild); + } + grandChild = grandChild.nextSibling().toElement(); + } +} + +QStringList DocQtPlugin::fullTextSearchLocations() +{ + QStringList locs; + + QMap<QString, QString> entryMap = config->entryMap("Locations"); + + for (QMap<QString, QString>::const_iterator it = entryMap.begin(); + it != entryMap.end(); ++it) + { + config->setGroup("Search Settings"); + if (config->readBoolEntry(it.key(), false)) + { + config->setGroup("Locations"); + QFileInfo fi(config->readPathEntry(it.key())); + locs << fi.dirPath(true); + } + } + + return locs; +} + +QPair<KFile::Mode, QString> DocQtPlugin::catalogLocatorProps() +{ + return QPair<KFile::Mode, QString>(KFile::File, "*.xml *.dcf"); +} + +QString DocQtPlugin::catalogTitle(const QString &url) +{ + QFileInfo fi(url); + if (!fi.exists()) + return QString::null; + + QFile f(url); + if (!f.open(IO_ReadOnly)) + return QString::null; + + QDomDocument doc; + if (!doc.setContent(&f) || (doc.doctype().name() != "DCF")) + return QString::null; + f.close(); + + QDomElement docEl = doc.documentElement(); + + return docEl.attribute("title", QString::null); +} + +DocumentationCatalogItem *DocQtPlugin::createCatalog(KListView *contents, const QString &title, const QString &url) +{ + return new QtDocumentationCatalogItem(url, this, contents, title); +} + +#include "docqtplugin.moc" diff --git a/parts/documentation/plugins/qt/docqtplugin.desktop b/parts/documentation/plugins/qt/docqtplugin.desktop new file mode 100644 index 00000000..1e96eacf --- /dev/null +++ b/parts/documentation/plugins/qt/docqtplugin.desktop @@ -0,0 +1,44 @@ +[Desktop Entry] +Type=Service +Name=DocQtPlugin +Name[da]=DocQt-plugin +Name[sk]=Doc Qt modul +Name[sv]=Qt-dokumentationsinsticksmodul +Name[ta]=DocQt சொருகு +Name[zh_TW]=Qt 文件外掛程式 +Exec=blubb +Comment=Documentation plugin for Qt DCF documentation +Comment[ca]=Connector de documentació per a documentació Qt DCF +Comment[da]=Dokumentations-plugin for Qt DCF dokumentation +Comment[de]=Komponente für Qt-DCF-Dokumentation +Comment[el]=Πρόσθετο τεκμηρίωσης για τεκμηρίωση τύπου Qt DCF +Comment[es]=Complemento de documentación para Qt DCF +Comment[et]=Qt DCF dokumentatsiooni plugin +Comment[eu]=Qt DCF dokumentaziorako dokumentazio plugin-a +Comment[fa]=وصلۀ مستندسازی برای مستندات Qt DCF +Comment[fr]=Module externe de documentation pour la documentation Qt DCF +Comment[gl]=Extensión de documentación para documentación Qt DCF +Comment[hu]=Dokumentációmodul Qt DCF-dokumentációhoz +Comment[it]=Plugin di documentazione per file di Qt DCF +Comment[ja]=Qt DCF ドキュメンテーションのためのドキュメンテーションプラグイン +Comment[ms]=Plugin dokumentasi untuk dokumentasi Qt DCF +Comment[nds]=Dokmentatschoon-Moduul för Qt-DCF-Dokmentatschoon +Comment[ne]=Qt DCF मिसिलीकरणका लागि मिसिलीकरण प्लगइन +Comment[nl]=Documentatie plugin voor Qt DCF documentatie +Comment[pl]=Wtyczka dokumentacji dla dokumentacji w formacie Qt DCF +Comment[pt]='Plugin' para documentação Qt DCF +Comment[pt_BR]=Plug-in de documentação para documento DCF do Qt +Comment[ru]=Модуль для просмотра Qt DCF +Comment[sk]=Dokumentačný modul pre Qt DCF dokumentáciu +Comment[sl]=Vstavek dokumentacije za Qt DCF +Comment[sr]=Документациони прикључак за Qt DCF документацију +Comment[sr@Latn]=Dokumentacioni priključak za Qt DCF dokumentaciju +Comment[sv]=Dokumentationsinsticksmodul för Qt DCF-dokumentation +Comment[ta]= Qt DCF ஆவணத்திற்கான ஆவணச் சொருகு +Comment[tg]=Модул барои наоиши QT DCF +Comment[tr]=Qt DCF Belgelendirmesi için belgelendirme eklentisi +Comment[zh_CN]=Qt DCF 文档的文档插件 +Comment[zh_TW]=Qt DCF 文件外掛程式 +ServiceTypes=KDevelop/DocumentationPlugins +X-KDevelop-Version=5 +X-KDE-Library=libdocqtplugin diff --git a/parts/documentation/plugins/qt/docqtplugin.h b/parts/documentation/plugins/qt/docqtplugin.h new file mode 100644 index 00000000..802dd98a --- /dev/null +++ b/parts/documentation/plugins/qt/docqtplugin.h @@ -0,0 +1,56 @@ +/*************************************************************************** + * Copyright (C) 2004 by Alexander Dymo * + * cloudtemple@mksat.net * + * * + * 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., * + * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * + ***************************************************************************/ +#ifndef DOCQTPLUGIN_H +#define DOCQTPLUGIN_H + +#include <kdevdocumentationplugin.h> +#include <qdom.h> + +class KConfig; + +class DocQtPlugin : public DocumentationPlugin +{ + Q_OBJECT +public: + DocQtPlugin(QObject* parent, const char* name, const QStringList args = QStringList()); + ~DocQtPlugin(); + + virtual QString pluginName() const; + + virtual DocumentationCatalogItem *createCatalog(KListView *contents, const QString &title, const QString &url); + + virtual void createTOC(DocumentationCatalogItem *item); + virtual void setCatalogURL(DocumentationCatalogItem *item); + + virtual bool needRefreshIndex(DocumentationCatalogItem *item); + virtual void createIndex(IndexBox *index, DocumentationCatalogItem *item); + virtual void createSectionIndex(QFileInfo &fi, IndexBox *index, DocumentationCatalogItem *item, + QDomElement section); + + virtual QStringList fullTextSearchLocations(); + + virtual QPair<KFile::Mode, QString> catalogLocatorProps(); + virtual QString catalogTitle(const QString &url); + + virtual void autoSetupPlugin(); + +}; + +#endif |