From d6f8bbb45b267065a6907e71ff9c98bb6d161241 Mon Sep 17 00:00:00 2001 From: tpearson Date: Sat, 31 Jul 2010 19:56:07 +0000 Subject: Trinity Qt initial conversion git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdevelop@1157658 283d02a7-25f6-0310-bc7c-ecb5cbfe19da --- .../plugins/devhelp/docdevhelpplugin.cpp | 156 ++++++++++----------- .../plugins/devhelp/docdevhelpplugin.h | 22 +-- 2 files changed, 89 insertions(+), 89 deletions(-) (limited to 'parts/documentation/plugins/devhelp') diff --git a/parts/documentation/plugins/devhelp/docdevhelpplugin.cpp b/parts/documentation/plugins/devhelp/docdevhelpplugin.cpp index 95c404ae..11c2b6a7 100644 --- a/parts/documentation/plugins/devhelp/docdevhelpplugin.cpp +++ b/parts/documentation/plugins/devhelp/docdevhelpplugin.cpp @@ -21,10 +21,10 @@ #include -#include -#include -#include -#include +#include +#include +#include +#include #include #include @@ -40,32 +40,32 @@ class DevHelpDocumentationCatalogItem: public DocumentationCatalogItem { public: - DevHelpDocumentationCatalogItem(const QString &devHelpFile, DocumentationPlugin* plugin, - KListView *parent, const QString &name) + DevHelpDocumentationCatalogItem(const TQString &devHelpFile, DocumentationPlugin* plugin, + KListView *parent, const TQString &name) :DocumentationCatalogItem(plugin, parent, name), m_devHelpFile(devHelpFile) { } - DevHelpDocumentationCatalogItem(const QString &devHelpFile, DocumentationPlugin* plugin, - DocumentationItem *parent, const QString &name) + DevHelpDocumentationCatalogItem(const TQString &devHelpFile, DocumentationPlugin* plugin, + DocumentationItem *parent, const TQString &name) :DocumentationCatalogItem(plugin, parent, name), m_devHelpFile(devHelpFile) { } - QString devHelpFile() const { return m_devHelpFile; } + TQString devHelpFile() const { return m_devHelpFile; } - virtual QString cacheVersion() const { + virtual TQString cacheVersion() const { unsigned int checksum=0; for(int a=0;a DocDevHelpPluginFactory; K_EXPORT_COMPONENT_FACTORY( libdocdevhelpplugin, DocDevHelpPluginFactory(data) ) -DocDevHelpPlugin::DocDevHelpPlugin(QObject* parent, const char* name, - const QStringList /*args*/) +DocDevHelpPlugin::DocDevHelpPlugin(TQObject* parent, const char* name, + const TQStringList /*args*/) :DocumentationPlugin(DocDevHelpPluginFactory::instance()->config(), parent, name) { setCapabilities(Index | FullTextSearch | ProjectDocumentation); @@ -85,55 +85,55 @@ DocDevHelpPlugin::~DocDevHelpPlugin() { } -DocumentationCatalogItem* DocDevHelpPlugin::createCatalog(KListView* contents, const QString& title, const QString& url) +DocumentationCatalogItem* DocDevHelpPlugin::createCatalog(KListView* contents, const TQString& title, const TQString& url) { return new DevHelpDocumentationCatalogItem(url, this, contents, title); } -QPair DocDevHelpPlugin::catalogLocatorProps() +QPair DocDevHelpPlugin::catalogLocatorProps() { - return QPair(KFile::File, "*.devhelp"); + return QPair(KFile::File, "*.devhelp"); } -QString DocDevHelpPlugin::catalogTitle(const QString& url) +TQString DocDevHelpPlugin::catalogTitle(const TQString& url) { - QFileInfo fi(url); + TQFileInfo fi(url); if (!fi.exists()) - return QString::null; + return TQString::null; - QFile f(url); + TQFile f(url); if (!f.open(IO_ReadOnly)) - return QString::null; + return TQString::null; - QDomDocument doc; + TQDomDocument doc; if (!doc.setContent(&f)) - return QString::null; + return TQString::null; f.close(); - QDomElement docEl = doc.documentElement(); + TQDomElement docEl = doc.documentElement(); - return docEl.attribute("title", QString::null); + return docEl.attribute("title", TQString::null); } -QString DocDevHelpPlugin::pluginName() const +TQString DocDevHelpPlugin::pluginName() const { return i18n("Devhelp Documentation Collection"); } -QStringList DocDevHelpPlugin::fullTextSearchLocations() +TQStringList DocDevHelpPlugin::fullTextSearchLocations() { - QStringList locs; + TQStringList locs; - QMap entryMap = config->entryMap("Locations"); + TQMap entryMap = config->entryMap("Locations"); - for (QMap::const_iterator it = entryMap.begin(); + for (TQMap::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); } } @@ -147,9 +147,9 @@ bool DocDevHelpPlugin::needRefreshIndex(DocumentationCatalogItem* item) if (!dhItem) return false; - QFileInfo fi(dhItem->devHelpFile()); + TQFileInfo fi(dhItem->devHelpFile()); config->setGroup("Index"); - if (fi.lastModified() > config->readDateTimeEntry(dhItem->text(0), new QDateTime())) + if (fi.lastModified() > config->readDateTimeEntry(dhItem->text(0), new TQDateTime())) { kdDebug() << "need rebuild index for " << dhItem->text(0) << endl; config->writeEntry(item->text(0), fi.lastModified()); @@ -161,16 +161,16 @@ bool DocDevHelpPlugin::needRefreshIndex(DocumentationCatalogItem* item) void DocDevHelpPlugin::autoSetupPlugin() { - QValueStack scanStack; + TQValueStack scanStack; pushToScanStack(scanStack, getenv("DEVHELP_SEARCH_PATH")); - pushToScanStack(scanStack, QString(getenv("HOME")) + "/.devhelp/books"); + pushToScanStack(scanStack, TQString(getenv("HOME")) + "/.devhelp/books"); - QString dhexepath = DocDevHelpPluginFactory::instance()->dirs()->findExe("devhelp"); + TQString dhexepath = DocDevHelpPluginFactory::instance()->dirs()->findExe("devhelp"); if (!dhexepath.isEmpty()) { - QFileInfo fi(dhexepath); - QString path = KURL(fi.dirPath(true)).upURL().path(1); + TQFileInfo fi(dhexepath); + TQString path = KURL(fi.dirPath(true)).upURL().path(1); pushToScanStack(scanStack, path + "share/devhelp/books"); pushToScanStack(scanStack, path + "share/gtk-doc/html"); } @@ -185,8 +185,8 @@ void DocDevHelpPlugin::autoSetupPlugin() pushToScanStack(scanStack, "/opt/gnome2/share/gtk-doc/html"); //fill the list of scan dirs (with subdirectories) - QStringList scanList; - QDir dir; + TQStringList scanList; + TQDir dir; do { dir.setPath(scanStack.pop()); @@ -196,13 +196,13 @@ void DocDevHelpPlugin::autoSetupPlugin() const QFileInfoList *dirEntries = dir.entryInfoList(); if ( !dirEntries ) continue; - QPtrListIterator it(*dirEntries); + TQPtrListIterator it(*dirEntries); for (; it.current(); ++it) { - QString fileName = it.current()->fileName(); + TQString fileName = it.current()->fileName(); if (fileName == "." || fileName == "..") continue; - QString path = it.current()->absFilePath(); + TQString path = it.current()->absFilePath(); if (it.current()->isDir()) { scanStack.push(path); @@ -210,23 +210,23 @@ void DocDevHelpPlugin::autoSetupPlugin() } } while (!scanStack.isEmpty()); - for (QStringList::const_iterator it = scanList.begin(); it != scanList.end(); ++it) + for (TQStringList::const_iterator it = scanList.begin(); it != scanList.end(); ++it) { scanDevHelpDir(*it); } } -void DocDevHelpPlugin::scanDevHelpDir(const QString &path) +void DocDevHelpPlugin::scanDevHelpDir(const TQString &path) { - QDir d(path); + TQDir d(path); if (! d.exists() || !d.isReadable()) return; - d.setFilter(QDir::Files); + d.setFilter(TQDir::Files); //scan for *.devhelp files const QFileInfoList *list = d.entryInfoList(); QFileInfoListIterator it( *list ); - QFileInfo *fi; + TQFileInfo *fi; while ( (fi = it.current()) != 0 ) { if (fi->extension() == "devhelp") @@ -238,7 +238,7 @@ void DocDevHelpPlugin::scanDevHelpDir(const QString &path) } } -void DocDevHelpPlugin::pushToScanStack(QValueStack &stack, const QString &value) +void DocDevHelpPlugin::pushToScanStack(TQValueStack &stack, const TQString &value) { if ( (!value.isEmpty()) && (!stack.contains(value)) ) { @@ -253,16 +253,16 @@ void DocDevHelpPlugin::createIndex(IndexBox* index, DocumentationCatalogItem* it if (!dhItem) return; - QFileInfo fi(dhItem->devHelpFile()); + TQFileInfo fi(dhItem->devHelpFile()); - QFile f(dhItem->devHelpFile()); + TQFile f(dhItem->devHelpFile()); if (!f.open(IO_ReadOnly)) { kdDebug(9002) << "Could not read" << dhItem->devHelpFile() << endl; return; } - QDomDocument doc; + TQDomDocument doc; if (!doc.setContent(&f)) { kdDebug() << "Not a valid devhelp file: " << dhItem->devHelpFile() << endl; @@ -270,17 +270,17 @@ void DocDevHelpPlugin::createIndex(IndexBox* index, DocumentationCatalogItem* it } f.close(); - QString baseUrl = KURL(dhItem->devHelpFile()).directory(); + TQString baseUrl = KURL(dhItem->devHelpFile()).directory(); - QDomElement docEl = doc.documentElement(); - QDomElement chaptersEl = docEl.namedItem("functions").toElement(); - QDomElement childEl = chaptersEl.firstChild().toElement(); + TQDomElement docEl = doc.documentElement(); + TQDomElement chaptersEl = docEl.namedItem("functions").toElement(); + TQDomElement childEl = chaptersEl.firstChild().toElement(); while (!childEl.isNull()) { if (childEl.tagName() == "function") { - QString name = childEl.attribute("name"); - QString url = childEl.attribute("link"); + TQString name = childEl.attribute("name"); + TQString url = childEl.attribute("link"); IndexItemProto *ii = new IndexItemProto(this, item, index, name, item->text(0)); ii->addURL(KURL(baseUrl+"/"+url)); @@ -295,16 +295,16 @@ void DocDevHelpPlugin::createTOC(DocumentationCatalogItem* item) if (!dhItem) return; - QFileInfo fi(dhItem->devHelpFile()); + TQFileInfo fi(dhItem->devHelpFile()); - QFile f(dhItem->devHelpFile()); + TQFile f(dhItem->devHelpFile()); if (!f.open(IO_ReadOnly)) { kdDebug(9002) << "Could not read" << dhItem->devHelpFile() << endl; return; } - QDomDocument doc; + TQDomDocument doc; if (!doc.setContent(&f)) { kdDebug() << "Not a valid devhelp file: " << dhItem->devHelpFile() << endl; @@ -312,23 +312,23 @@ void DocDevHelpPlugin::createTOC(DocumentationCatalogItem* item) } f.close(); - QDomElement docEl = doc.documentElement(); - QDomElement chaptersEl = docEl.namedItem("chapters").toElement(); + TQDomElement docEl = doc.documentElement(); + TQDomElement chaptersEl = docEl.namedItem("chapters").toElement(); - QDomElement childEl = chaptersEl.lastChild().toElement(); - QString baseUrl = KURL(dhItem->devHelpFile()).directory(); + TQDomElement childEl = chaptersEl.lastChild().toElement(); + TQString baseUrl = KURL(dhItem->devHelpFile()).directory(); addTocSect(dhItem, childEl, baseUrl, true); } -void DocDevHelpPlugin::addTocSect(DocumentationItem *parent, QDomElement childEl, - QString baseUrl, bool book) +void DocDevHelpPlugin::addTocSect(DocumentationItem *parent, TQDomElement childEl, + TQString baseUrl, bool book) { while (!childEl.isNull()) { if ( (childEl.tagName() == "sub") || (childEl.tagName() == "chapter")) { - QString name = childEl.attribute("name"); - QString url = childEl.attribute("link"); + TQString name = childEl.attribute("name"); + TQString url = childEl.attribute("link"); if (name.isEmpty() && url.contains("ix")) name = "Index"; @@ -337,7 +337,7 @@ void DocDevHelpPlugin::addTocSect(DocumentationItem *parent, QDomElement childEl book ? DocumentationItem::Book : DocumentationItem::Document, parent, name); item->setURL(KURL(baseUrl+"/"+url)); - QDomElement grandchildEl = childEl.lastChild().toElement(); + TQDomElement grandchildEl = childEl.lastChild().toElement(); addTocSect(item, grandchildEl, baseUrl); } childEl = childEl.previousSibling().toElement(); @@ -350,15 +350,15 @@ void DocDevHelpPlugin::setCatalogURL(DocumentationCatalogItem* item) if (!dhItem) return; - QFileInfo fi(dhItem->devHelpFile()); + TQFileInfo fi(dhItem->devHelpFile()); - QFile f(dhItem->devHelpFile()); + TQFile f(dhItem->devHelpFile()); if (!f.open(IO_ReadOnly)) { kdDebug(9002) << "Could not read" << dhItem->devHelpFile() << endl; return; } - QDomDocument doc; + TQDomDocument doc; if (!doc.setContent(&f)) { kdDebug(9002) << "Not a valid Devhelp file: " << dhItem->devHelpFile() << endl; @@ -366,12 +366,12 @@ void DocDevHelpPlugin::setCatalogURL(DocumentationCatalogItem* item) } f.close(); - QDomElement docEl = doc.documentElement(); - QDomElement titleEl = docEl.namedItem("book").toElement(); + TQDomElement docEl = doc.documentElement(); + TQDomElement titleEl = docEl.namedItem("book").toElement(); if (item->url().isEmpty()) { - KURL url(fi.dirPath(true) + "/" + docEl.attribute("link", QString::null)); + KURL url(fi.dirPath(true) + "/" + docEl.attribute("link", TQString::null)); item->setURL(url); } } diff --git a/parts/documentation/plugins/devhelp/docdevhelpplugin.h b/parts/documentation/plugins/devhelp/docdevhelpplugin.h index 3d73cb63..9e4df5c2 100644 --- a/parts/documentation/plugins/devhelp/docdevhelpplugin.h +++ b/parts/documentation/plugins/devhelp/docdevhelpplugin.h @@ -20,8 +20,8 @@ #ifndef DOCDEVHELPPLUGIN_H #define DOCDEVHELPPLUGIN_H -#include -#include +#include +#include #include @@ -29,32 +29,32 @@ class DocDevHelpPlugin: public DocumentationPlugin { Q_OBJECT public: - DocDevHelpPlugin(QObject* parent, const char* name, const QStringList args = QStringList()); + DocDevHelpPlugin(TQObject* parent, const char* name, const TQStringList args = TQStringList()); ~DocDevHelpPlugin(); - virtual QString pluginName() const; + virtual TQString pluginName() const; - virtual QString catalogTitle(const QString& url); + virtual TQString catalogTitle(const TQString& url); virtual void setCatalogURL(DocumentationCatalogItem* item); virtual void createTOC(DocumentationCatalogItem* item); - virtual DocumentationCatalogItem* createCatalog(KListView* contents, const QString& title, const QString& url); + virtual DocumentationCatalogItem* createCatalog(KListView* contents, const TQString& title, const TQString& url); virtual bool needRefreshIndex(DocumentationCatalogItem* item); virtual void createIndex(IndexBox* index, DocumentationCatalogItem* item); - virtual QStringList fullTextSearchLocations(); + virtual TQStringList fullTextSearchLocations(); virtual void autoSetupPlugin(); - virtual QPair catalogLocatorProps(); + virtual QPair catalogLocatorProps(); virtual ProjectDocumentationPlugin *projectDocumentationPlugin(ProjectDocType type); protected: - void pushToScanStack(QValueStack &stack, const QString &value); - void scanDevHelpDir(const QString &path); - void addTocSect(DocumentationItem *parent, QDomElement childEl, QString baseUrl, bool book=false); + void pushToScanStack(TQValueStack &stack, const TQString &value); + void scanDevHelpDir(const TQString &path); + void addTocSect(DocumentationItem *parent, TQDomElement childEl, TQString baseUrl, bool book=false); }; #endif -- cgit v1.2.1