diff options
Diffstat (limited to 'parts/documentation/plugins/doxygen/docdoxygenplugin.cpp')
-rw-r--r-- | parts/documentation/plugins/doxygen/docdoxygenplugin.cpp | 234 |
1 files changed, 117 insertions, 117 deletions
diff --git a/parts/documentation/plugins/doxygen/docdoxygenplugin.cpp b/parts/documentation/plugins/doxygen/docdoxygenplugin.cpp index 3fa7d5cb..a92eb60f 100644 --- a/parts/documentation/plugins/doxygen/docdoxygenplugin.cpp +++ b/parts/documentation/plugins/doxygen/docdoxygenplugin.cpp @@ -21,12 +21,12 @@ #include <unistd.h> -#include <qdom.h> -#include <qfile.h> -#include <qfileinfo.h> -#include <qdialog.h> -#include <qregexp.h> -#include <qvaluestack.h> +#include <tqdom.h> +#include <tqfile.h> +#include <tqfileinfo.h> +#include <tqdialog.h> +#include <tqregexp.h> +#include <tqvaluestack.h> #include <kurl.h> #include <kaboutdata.h> @@ -43,20 +43,20 @@ class DoxyDocumentationCatalogItem: public DocumentationCatalogItem { public: - DoxyDocumentationCatalogItem(const QString &origUrl, DocumentationPlugin* plugin, - KListView *parent, const QString &name) + DoxyDocumentationCatalogItem(const TQString &origUrl, DocumentationPlugin* plugin, + KListView *parent, const TQString &name) :DocumentationCatalogItem(plugin, parent, name), m_origUrl(origUrl) { } - DoxyDocumentationCatalogItem(const QString &origUrl, DocumentationPlugin* plugin, - DocumentationItem *parent, const QString &name) + DoxyDocumentationCatalogItem(const TQString &origUrl, DocumentationPlugin* plugin, + DocumentationItem *parent, const TQString &name) :DocumentationCatalogItem(plugin, parent, name), m_origUrl(origUrl) { } - QString origUrl() const { return m_origUrl; } + TQString origUrl() const { return m_origUrl; } private: - QString m_origUrl; + TQString m_origUrl; }; @@ -64,7 +64,7 @@ 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) +DocDoxygenPlugin::DocDoxygenPlugin(TQObject* parent, const char* name, const TQStringList) :DocumentationPlugin(DocDoxygenPluginFactory::instance()->config(), parent, name) { setCapabilities(Index | FullTextSearch | ProjectDocumentation | CustomDocumentationTitles ); @@ -75,71 +75,71 @@ DocDoxygenPlugin::~DocDoxygenPlugin() { } -QPair<KFile::Mode, QString> DocDoxygenPlugin::catalogLocatorProps() +QPair<KFile::Mode, TQString> DocDoxygenPlugin::catalogLocatorProps() { - return QPair<KFile::Mode, QString>(KFile::File, "index.html *.tag"); + return QPair<KFile::Mode, TQString>(KFile::File, "index.html *.tag"); } -QString DocDoxygenPlugin::catalogTitle(const QString& url) +TQString DocDoxygenPlugin::catalogTitle(const TQString& url) { - QFileInfo fi(url); + TQFileInfo fi(url); if (!fi.exists()) - return QString::null; + return TQString::null; if (fi.extension(false) == "html") { - QFile f(url); + TQFile f(url); if (!f.open(IO_ReadOnly)) - return QString::null; + return TQString::null; - QTextStream ts(&f); - QString contents = ts.read(); - QRegExp re(".*<title>(.*)</title>.*"); + TQTextStream ts(&f); + TQString contents = ts.read(); + TQRegExp 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"); + TQFile *f = 0; + TQFile f1(fi.dirPath(true) + "/html/index.html"); if (f1.open(IO_ReadOnly)) f = &f1; - QFile f2(fi.dirPath(true) + "/index.html"); + TQFile 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>.*"); + TQTextStream ts(f); + TQString contents = ts.read(); + TQRegExp re(".*<title>(.*)</title>.*"); re.setCaseSensitive(false); re.search(contents); return re.cap(1); } } - return QString::null; + return TQString::null; } -QString DocDoxygenPlugin::pluginName() const +TQString DocDoxygenPlugin::pluginName() const { return i18n("Doxygen Documentation Collection"); } -QStringList DocDoxygenPlugin::fullTextSearchLocations() +TQStringList DocDoxygenPlugin::fullTextSearchLocations() { - QStringList locs; + TQStringList locs; - QMap<QString, QString> entryMap = config->entryMap("Locations"); + TQMap<TQString, TQString> entryMap = config->entryMap("Locations"); - for (QMap<QString, QString>::const_iterator it = entryMap.begin(); + for (TQMap<TQString, TQString>::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())); + TQFileInfo fi(config->readPathEntry(it.key())); locs << fi.dirPath(true); } } @@ -151,13 +151,13 @@ void DocDoxygenPlugin::setCatalogURL(DocumentationCatalogItem* item) { if (item->url().url().endsWith("tag")) { - QFileInfo fi(item->url().directory(false) + "html/index.html"); + TQFileInfo 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"); + TQFileInfo fi2(item->url().directory(false) + "index.html"); if (fi2.exists()) { item->setURL(KURL::fromPathOrURL(fi2.absFilePath())); @@ -173,9 +173,9 @@ bool DocDoxygenPlugin::needRefreshIndex(DocumentationCatalogItem* item) if (!doxyItem) return false; - QFileInfo fi(doxyItem->origUrl()); + TQFileInfo fi(doxyItem->origUrl()); config->setGroup("Index"); - if (fi.lastModified() > config->readDateTimeEntry(item->text(0), new QDateTime())) + if (fi.lastModified() > config->readDateTimeEntry(item->text(0), new TQDateTime())) { kdDebug() << "need rebuild index for " << item->text(0) << endl; config->writeEntry(item->text(0), fi.lastModified()); @@ -192,19 +192,19 @@ void DocDoxygenPlugin::autoSetupPlugin() } -void DocDoxygenPlugin::autoSetupDocs(const QString &defaultDir, const QString &searchDir, - const QString &name) +void DocDoxygenPlugin::autoSetupDocs(const TQString &defaultDir, const TQString &searchDir, + const TQString &name) { - QString doxyDocDir(defaultDir); + TQString 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 ) + TQStringList apiDirs = DocDoxygenPluginFactory::instance()->dirs()->findDirs("html", searchDir); + for (TQStringList::const_iterator it = apiDirs.begin(); it != apiDirs.end(); ++it ) { doxyDocDir = *it; - QString indexFile = doxyDocDir + "index.html"; - if (QFile::exists(indexFile)) + TQString indexFile = doxyDocDir + "index.html"; + if (TQFile::exists(indexFile)) { doxyDocDir = doxyDocDir + "/" + searchDir; break; @@ -219,13 +219,13 @@ void DocDoxygenPlugin::autoSetupDocs(const QString &defaultDir, const QString &s config->setGroup("Index Settings"); config->writeEntry(name, true); config->setGroup("Locations"); - config->writePathEntry(name, doxyDocDir + QString("/index.html")); + config->writePathEntry(name, doxyDocDir + TQString("/index.html")); } } void DocDoxygenPlugin::createIndex(IndexBox* index, DocumentationCatalogItem* item) { - QFileInfo fi(item->url().path()); + TQFileInfo fi(item->url().path()); if (!fi.exists()) return; @@ -236,11 +236,11 @@ void DocDoxygenPlugin::createIndex(IndexBox* index, DocumentationCatalogItem* it //doxygen documentation mode (if catalog points to a .tag) if (doxyItem->origUrl().endsWith("tag")) { - QString htmlUrl; - QFileInfo fi2(item->url().directory(false) + "index.html"); + TQString htmlUrl; + TQFileInfo fi2(item->url().directory(false) + "index.html"); if (fi2.exists()) htmlUrl = fi2.dirPath(true) + "/"; - QFileInfo fi(item->url().directory(false) + "html/index.html"); + TQFileInfo fi(item->url().directory(false) + "html/index.html"); if (fi.exists()) htmlUrl = fi.dirPath(true) + "/"; @@ -248,8 +248,8 @@ void DocDoxygenPlugin::createIndex(IndexBox* index, DocumentationCatalogItem* it } //KDE doxygen documentation mode (if catalog points to a index.html) - QDir d; - QValueStack<QString> dirStack; + TQDir d; + TQValueStack<TQString> dirStack; dirStack.push(fi.dirPath(true)); do { d.setPath(dirStack.pop()); @@ -258,24 +258,24 @@ void DocDoxygenPlugin::createIndex(IndexBox* index, DocumentationCatalogItem* it const QFileInfoList *dirEntries = d.entryInfoList(); if (!dirEntries) continue; - QPtrListIterator<QFileInfo> it(*dirEntries); + TQPtrListIterator<TQFileInfo> it(*dirEntries); for (; it.current(); ++it) { - QString fileName = it.current()->fileName(); + TQString 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")) + if (TQFile::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()); + TQFileInfo fi(item->url().path()); if (!fi.exists()) return; @@ -286,11 +286,11 @@ void DocDoxygenPlugin::createTOC(DocumentationCatalogItem* item) //doxygen documentation mode (if catalog points to a .tag) if (doxyItem->origUrl().endsWith("tag")) { - QString htmlUrl; - QFileInfo fi2(item->url().directory(false) + "index.html"); + TQString htmlUrl; + TQFileInfo fi2(item->url().directory(false) + "index.html"); if (fi2.exists()) htmlUrl = fi2.dirPath(true) + "/"; - QFileInfo fi(item->url().directory(false) + "html/index.html"); + TQFileInfo fi(item->url().directory(false) + "html/index.html"); if (fi.exists()) htmlUrl = fi.dirPath(true) + "/"; if (!htmlUrl.isEmpty()) @@ -298,8 +298,8 @@ void DocDoxygenPlugin::createTOC(DocumentationCatalogItem* item) } //KDE doxygen documentation mode (if catalog points to a index.html) - QDir d; - QValueStack<QString> dirStack; + TQDir d; + TQValueStack<TQString> dirStack; dirStack.push(fi.dirPath(true)); do { d.setPath(dirStack.pop()); @@ -308,17 +308,17 @@ void DocDoxygenPlugin::createTOC(DocumentationCatalogItem* item) const QFileInfoList *dirEntries = d.entryInfoList(); if (!dirEntries) continue; - QPtrListIterator<QFileInfo> it(*dirEntries); + TQPtrListIterator<TQFileInfo> it(*dirEntries); for (; it.current(); ++it) { - QString fileName = it.current()->fileName(); + TQString 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")) + if (TQFile::exists(d.absPath() + "/html/index.html")) { DocumentationItem *docItem = new DocumentationItem(DocumentationItem::Book, item, d.dirName()); docItem->setURL(KURL(d.absPath() + "/html/index.html")); @@ -328,7 +328,7 @@ void DocDoxygenPlugin::createTOC(DocumentationCatalogItem* item) } while (!dirStack.isEmpty()); } -DocumentationCatalogItem *DocDoxygenPlugin::createCatalog(KListView *contents, const QString &title, const QString &url) +DocumentationCatalogItem *DocDoxygenPlugin::createCatalog(KListView *contents, const TQString &title, const TQString &url) { kdDebug() << "DocDoxygenPlugin::createCatalog: url=" << url << endl; DocumentationCatalogItem *item = new DoxyDocumentationCatalogItem(url, this, contents, title); @@ -336,41 +336,41 @@ DocumentationCatalogItem *DocDoxygenPlugin::createCatalog(KListView *contents, c return item; } -void DocDoxygenPlugin::createBookTOC(DocumentationItem *item, const QString &tagUrl, const QString &baseHtmlUrl) +void DocDoxygenPlugin::createBookTOC(DocumentationItem *item, const TQString &tagUrl, const TQString &baseHtmlUrl) { - QString tagName; + TQString tagName; if (tagUrl.isEmpty()) tagName = item->url().upURL().directory(false) + item->text(0) + ".tag"; else tagName = tagUrl; - QString baseUrl; + TQString 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)) + if (!TQFile::exists(tagName)) return; - QStringList tagFileList; + TQStringList tagFileList; if (tagName.endsWith(".tag")) - tagFileList = tagFiles(QFileInfo(tagName).dirPath() + "/"); + tagFileList = tagFiles(TQFileInfo(tagName).dirPath() + "/"); else tagFileList += tagName; - QStringList::ConstIterator end = tagFileList.constEnd(); - for (QStringList::ConstIterator it = tagFileList.constBegin(); it != end; ++it) + TQStringList::ConstIterator end = tagFileList.constEnd(); + for (TQStringList::ConstIterator it = tagFileList.constBegin(); it != end; ++it) { - QFile f(*it); + TQFile f(*it); if (!f.open(IO_ReadOnly)) { kdDebug(9002) << "Could not open tag file: " << f.name() << endl; return; } - QDomDocument dom; + TQDomDocument dom; if (!dom.setContent(&f) || dom.documentElement().nodeName() != "tagfile") { kdDebug(9002) << "No valid tag file" << endl; @@ -378,17 +378,17 @@ void DocDoxygenPlugin::createBookTOC(DocumentationItem *item, const QString &tag } f.close(); - QDomElement docEl = dom.documentElement(); + TQDomElement docEl = dom.documentElement(); - QDomElement childEl = docEl.lastChild().toElement(); + TQDomElement 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(); + TQString classname = childEl.namedItem("name").firstChild().toText().data(); + TQString filename = childEl.namedItem("filename").firstChild().toText().data(); - if (QFile::exists(baseUrl + filename)) + if (TQFile::exists(baseUrl + filename)) { DocumentationItem *docItem = new DocumentationItem(DocumentationItem::Document, item, classname); @@ -400,27 +400,27 @@ void DocDoxygenPlugin::createBookTOC(DocumentationItem *item, const QString &tag } } -void DocDoxygenPlugin::createBookIndex(const QString &tagfile, IndexBox* index, DocumentationCatalogItem* item, const QString &baseHtmlUrl) +void DocDoxygenPlugin::createBookIndex(const TQString &tagfile, IndexBox* index, DocumentationCatalogItem* item, const TQString &baseHtmlUrl) { - QString tagName = tagfile; + TQString tagName = tagfile; kdDebug() << tagfile << endl; - if (!QFile::exists(tagName)) + if (!TQFile::exists(tagName)) return; - QString prefix = baseHtmlUrl.isEmpty() ? KURL(tagfile).directory(false) + "html/" : baseHtmlUrl; + TQString prefix = baseHtmlUrl.isEmpty() ? KURL(tagfile).directory(false) + "html/" : baseHtmlUrl; - QStringList tagFileList = tagFiles(QFileInfo(tagName).dirPath() + "/"); + TQStringList tagFileList = tagFiles(TQFileInfo(tagName).dirPath() + "/"); - QStringList::ConstIterator end = tagFileList.constEnd(); - for (QStringList::ConstIterator it = tagFileList.constBegin(); it != end; ++it) + TQStringList::ConstIterator end = tagFileList.constEnd(); + for (TQStringList::ConstIterator it = tagFileList.constBegin(); it != end; ++it) { - QFile f(*it); + TQFile f(*it); if (!f.open(IO_ReadOnly)) { kdDebug(9002) << "Could not open tag file: " << f.name() << endl; return; } - QDomDocument dom; + TQDomDocument dom; if (!dom.setContent(&f) || dom.documentElement().nodeName() != "tagfile") { kdDebug(9002) << "No valid tag file" << endl; @@ -428,17 +428,17 @@ void DocDoxygenPlugin::createBookIndex(const QString &tagfile, IndexBox* index, } f.close(); - QDomElement docEl = dom.documentElement(); + TQDomElement docEl = dom.documentElement(); createIndexFromTag(dom, index, item, docEl, prefix); } } -void DocDoxygenPlugin::createIndexFromTag(QDomDocument &dom, IndexBox *index, - DocumentationCatalogItem *item, QDomElement &parentEl, const QString &prefix) +void DocDoxygenPlugin::createIndexFromTag(TQDomDocument &dom, IndexBox *index, + DocumentationCatalogItem *item, TQDomElement &parentEl, const TQString &prefix) { - QDomElement docEl = parentEl; + TQDomElement docEl = parentEl; - QDomElement childEl = docEl.firstChild().toElement(); + TQDomElement childEl = docEl.firstChild().toElement(); while (!childEl.isNull()) { if (childEl.tagName() == "compound" && @@ -446,8 +446,8 @@ void DocDoxygenPlugin::createIndexFromTag(QDomDocument &dom, IndexBox *index, || (childEl.attribute("kind") == "struct") || (childEl.attribute("kind") == "namespace") )) { - QString classname = childEl.namedItem("name").firstChild().toText().data(); - QString filename = childEl.namedItem("filename").firstChild().toText().data(); + TQString classname = childEl.namedItem("name").firstChild().toText().data(); + TQString filename = childEl.namedItem("filename").firstChild().toText().data(); IndexItemProto *indexItem = new IndexItemProto(this, item, index, classname, i18n("%1 Class Reference").arg(classname)); @@ -460,10 +460,10 @@ void DocDoxygenPlugin::createIndexFromTag(QDomDocument &dom, IndexBox *index, || (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(); + TQString classname = parentEl.namedItem("name").firstChild().toText().data(); + TQString membername = childEl.namedItem("name").firstChild().toText().data(); + TQString anchor = childEl.namedItem("anchor").firstChild().toText().data(); + TQString arglist = childEl.namedItem("arglist").firstChild().toText().data(); if (classname != membername) { @@ -482,44 +482,44 @@ ProjectDocumentationPlugin *DocDoxygenPlugin::projectDocumentationPlugin(Project return DocumentationPlugin::projectDocumentationPlugin(type); } -QStringList DocDoxygenPlugin::tagFiles(const QString& path, int level) +TQStringList DocDoxygenPlugin::tagFiles(const TQString& path, int level) { - QStringList r; - QDir dir(path); + TQStringList r; + TQDir dir(path); if (level > 10) return r; if (!dir.isReadable()) return r; if (!dir.exists()) return r; - QStringList dirList; - QStringList fileList; - QStringList::Iterator it; + TQStringList dirList; + TQStringList fileList; + TQStringList::Iterator it; - dir.setFilter ( QDir::Dirs); + dir.setFilter ( TQDir::Dirs); dirList = dir.entryList(); dirList.remove("."); dirList.remove(".."); - dir.setFilter(QDir::Files | QDir::Hidden | QDir::System); + dir.setFilter(TQDir::Files | TQDir::Hidden | TQDir::System); fileList = dir.entryList(); - QStringList::Iterator end = dirList.end(); + TQStringList::Iterator end = dirList.end(); for ( it = dirList.begin(); it != end; ++it ) { - QString name = *it; - if (QFileInfo( dir, *it ).isSymLink()) + TQString name = *it; + if (TQFileInfo( dir, *it ).isSymLink()) continue; r += tagFiles(path + name + "/", level + 1 ); } - QStringList::Iterator fend = fileList.end(); + TQStringList::Iterator fend = fileList.end(); for ( it = fileList.begin(); it != fend; ++it ) { - QString name = *it; - QFileInfo fi( dir, *it ); + TQString name = *it; + TQFileInfo fi( dir, *it ); if (fi.isSymLink() || !fi.isFile()) continue; - if (QDir::match(QString("*.tag"), name)) + if (TQDir::match(TQString("*.tag"), name)) r += (path+name); } |