summaryrefslogtreecommitdiffstats
path: root/parts/documentation/plugins/devhelp/docdevhelpplugin.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'parts/documentation/plugins/devhelp/docdevhelpplugin.cpp')
-rw-r--r--parts/documentation/plugins/devhelp/docdevhelpplugin.cpp156
1 files changed, 78 insertions, 78 deletions
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 <unistd.h>
-#include <qdom.h>
-#include <qfile.h>
-#include <qfileinfo.h>
-#include <qdialog.h>
+#include <tqdom.h>
+#include <tqfile.h>
+#include <tqfileinfo.h>
+#include <tqdialog.h>
#include <kurl.h>
#include <kaboutdata.h>
@@ -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<m_devHelpFile.length(); a++) {
checksum += (a+1) * (int)m_devHelpFile[a];
}
- QString str;
- QTextOStream( &str ) << checksum;
+ TQString str;
+ TQTextOStream( &str ) << checksum;
return str;
}
protected:
private:
- QString m_devHelpFile;
+ TQString m_devHelpFile;
};
@@ -73,8 +73,8 @@ 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*/)
+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<KFile::Mode, QString> DocDevHelpPlugin::catalogLocatorProps()
+QPair<KFile::Mode, TQString> DocDevHelpPlugin::catalogLocatorProps()
{
- return QPair<KFile::Mode, QString>(KFile::File, "*.devhelp");
+ return QPair<KFile::Mode, TQString>(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<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);
}
}
@@ -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<QString> scanStack;
+ TQValueStack<TQString> 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<QFileInfo> it(*dirEntries);
+ TQPtrListIterator<TQFileInfo> 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<QString> &stack, const QString &value)
+void DocDevHelpPlugin::pushToScanStack(TQValueStack<TQString> &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);
}
}