diff options
author | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2010-07-31 19:56:07 +0000 |
---|---|---|
committer | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2010-07-31 19:56:07 +0000 |
commit | d6f8bbb45b267065a6907e71ff9c98bb6d161241 (patch) | |
tree | d109539636691d7b03036ca1c0ed29dbae6577cf /parts/documentation/plugins/qt/docqtplugin.cpp | |
parent | 3331a47a9cad24795c7440ee8107143ce444ef34 (diff) | |
download | tdevelop-d6f8bbb45b267065a6907e71ff9c98bb6d161241.tar.gz tdevelop-d6f8bbb45b267065a6907e71ff9c98bb6d161241.zip |
Trinity Qt initial conversion
git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdevelop@1157658 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'parts/documentation/plugins/qt/docqtplugin.cpp')
-rw-r--r-- | parts/documentation/plugins/qt/docqtplugin.cpp | 136 |
1 files changed, 68 insertions, 68 deletions
diff --git a/parts/documentation/plugins/qt/docqtplugin.cpp b/parts/documentation/plugins/qt/docqtplugin.cpp index 90237b7c..b4118f97 100644 --- a/parts/documentation/plugins/qt/docqtplugin.cpp +++ b/parts/documentation/plugins/qt/docqtplugin.cpp @@ -21,9 +21,9 @@ #include <unistd.h> -#include <qfile.h> -#include <qfileinfo.h> -#include <qdialog.h> +#include <tqfile.h> +#include <tqfileinfo.h> +#include <tqdialog.h> #include <kurl.h> #include <kaboutdata.h> @@ -40,27 +40,27 @@ class QtDocumentationCatalogItem: public DocumentationCatalogItem { public: - QtDocumentationCatalogItem(const QString &dcfFile, DocumentationPlugin* plugin, - KListView *parent, const QString &name) + QtDocumentationCatalogItem(const TQString &dcfFile, DocumentationPlugin* plugin, + KListView *parent, const TQString &name) :DocumentationCatalogItem(plugin, parent, name), m_dcfFile(dcfFile) { } - QtDocumentationCatalogItem(const QString &dcfFile, DocumentationPlugin* plugin, - DocumentationItem *parent, const QString &name) + QtDocumentationCatalogItem(const TQString &dcfFile, DocumentationPlugin* plugin, + DocumentationItem *parent, const TQString &name) :DocumentationCatalogItem(plugin, parent, name), m_dcfFile(dcfFile) { } - QString dcfFile() const { return m_dcfFile; } + TQString dcfFile() const { return m_dcfFile; } private: - QString m_dcfFile; + TQString 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) +DocQtPlugin::DocQtPlugin(TQObject* parent, const char* name, const TQStringList) :DocumentationPlugin(DocQtPluginFactory::instance()->config(), parent, name) { setCapabilities(Index | FullTextSearch | CustomDocumentationTitles); @@ -77,15 +77,15 @@ void DocQtPlugin::createTOC(DocumentationCatalogItem *item) if (!qtItem) return; - QFileInfo fi(qtItem->dcfFile()); + TQFileInfo fi(qtItem->dcfFile()); - QFile f(qtItem->dcfFile()); + TQFile f(qtItem->dcfFile()); if (!f.open(IO_ReadOnly)) { kdDebug(9002) << "Could not read" << qtItem->dcfFile() << endl; return; } - QDomDocument doc; + TQDomDocument doc; if (!doc.setContent(&f) || doc.doctype().name() != "DCF") { kdDebug(9002) << "Not a valid DCF file: " << qtItem->dcfFile() << endl; @@ -93,28 +93,28 @@ void DocQtPlugin::createTOC(DocumentationCatalogItem *item) } f.close(); - QDomElement docEl = doc.documentElement(); - QDomElement titleEl = docEl.namedItem("DCF").toElement(); + TQDomElement docEl = doc.documentElement(); + TQDomElement titleEl = docEl.namedItem("DCF").toElement(); - QDomElement childEl = docEl.lastChild().toElement(); + TQDomElement childEl = docEl.lastChild().toElement(); while (!childEl.isNull()) { if (childEl.tagName() == "section") { - QString ref = childEl.attribute("ref"); - QString title = childEl.attribute("title"); + TQString ref = childEl.attribute("ref"); + TQString 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(); + TQDomElement grandChild = childEl.lastChild().toElement(); while(!grandChild.isNull()) { if (grandChild.tagName() == "keyword") { - QString keyRef = grandChild.attribute("ref"); - QString keyTitle = grandChild.text(); + TQString keyRef = grandChild.attribute("ref"); + TQString keyTitle = grandChild.text(); DocumentationItem *keyItem = new DocumentationItem(DocumentationItem::Document, sectionItem, keyTitle); KURL keyUrl(fi.dirPath(true) + "/" + keyRef); @@ -122,8 +122,8 @@ void DocQtPlugin::createTOC(DocumentationCatalogItem *item) } if (grandChild.tagName() == "section") { - QString keyRef = grandChild.attribute("ref"); - QString keyTitle = grandChild.attribute("title"); + TQString keyRef = grandChild.attribute("ref"); + TQString keyTitle = grandChild.attribute("title"); DocumentationItem *keyItem = new DocumentationItem(DocumentationItem::Book, sectionItem, keyTitle); KURL keyUrl(fi.dirPath(true) + "/" + keyRef); keyItem->setURL(keyUrl); @@ -137,7 +137,7 @@ void DocQtPlugin::createTOC(DocumentationCatalogItem *item) void DocQtPlugin::autoSetupPlugin() { - QString qtDocDir(QT_DOCDIR); + TQString qtDocDir(QT_DOCDIR); qtDocDir = URLUtil::envExpand(qtDocDir); if (qtDocDir.isEmpty()) { @@ -150,11 +150,11 @@ void DocQtPlugin::autoSetupPlugin() 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")); + config->writePathEntry("Qt Reference Documentation", qtDocDir + TQString("/qt.dcf")); + config->writePathEntry("Qt Assistant Manual", qtDocDir + TQString("/assistant.dcf")); + config->writePathEntry("Qt Designer Manual", qtDocDir + TQString("/designer.dcf")); + config->writePathEntry("Guide to the Qt Translation Tools", qtDocDir + TQString("/linguist.dcf")); + config->writePathEntry("qmake User Guide", qtDocDir + TQString("/qmake.dcf")); } } @@ -164,15 +164,15 @@ void DocQtPlugin::setCatalogURL(DocumentationCatalogItem *item) if (!qtItem) return; - QFileInfo fi(qtItem->dcfFile()); + TQFileInfo fi(qtItem->dcfFile()); - QFile f(qtItem->dcfFile()); + TQFile f(qtItem->dcfFile()); if (!f.open(IO_ReadOnly)) { kdDebug(9002) << "Could not read" << qtItem->dcfFile() << endl; return; } - QDomDocument doc; + TQDomDocument doc; if (!doc.setContent(&f) || doc.doctype().name() != "DCF") { kdDebug(9002) << "Not a valid DCF file: " << qtItem->dcfFile() << endl; @@ -180,17 +180,17 @@ void DocQtPlugin::setCatalogURL(DocumentationCatalogItem *item) } f.close(); - QDomElement docEl = doc.documentElement(); - QDomElement titleEl = docEl.namedItem("DCF").toElement(); + TQDomElement docEl = doc.documentElement(); + TQDomElement titleEl = docEl.namedItem("DCF").toElement(); if (item->url().isEmpty()) { - KURL url(fi.dirPath(true) + "/" + docEl.attribute("ref", QString::null)); + KURL url(fi.dirPath(true) + "/" + docEl.attribute("ref", TQString::null)); item->setURL(url); } } -QString DocQtPlugin::pluginName() const +TQString DocQtPlugin::pluginName() const { return i18n("Qt Documentation Collection"); } @@ -201,9 +201,9 @@ bool DocQtPlugin::needRefreshIndex(DocumentationCatalogItem *item) if (!qtItem) return false; - QFileInfo fi(qtItem->dcfFile()); + TQFileInfo fi(qtItem->dcfFile()); config->setGroup("Index"); - if (fi.lastModified() > config->readDateTimeEntry(qtItem->text(0), new QDateTime())) + if (fi.lastModified() > config->readDateTimeEntry(qtItem->text(0), new TQDateTime())) { kdDebug() << "need rebuild index for " << qtItem->text(0) << endl; config->writeEntry(item->text(0), fi.lastModified()); @@ -219,15 +219,15 @@ void DocQtPlugin::createIndex(IndexBox *index, DocumentationCatalogItem *item) if (!qtItem) return; - QFileInfo fi(qtItem->dcfFile()); + TQFileInfo fi(qtItem->dcfFile()); - QFile f(qtItem->dcfFile()); + TQFile f(qtItem->dcfFile()); if (!f.open(IO_ReadOnly)) { kdDebug(9002) << "Could not read" << qtItem->dcfFile() << endl; return; } - QDomDocument doc; + TQDomDocument doc; if (!doc.setContent(&f) || doc.doctype().name() != "DCF") { kdDebug(9002) << "Not a valid DCF file: " << qtItem->dcfFile() << endl; @@ -235,10 +235,10 @@ void DocQtPlugin::createIndex(IndexBox *index, DocumentationCatalogItem *item) } f.close(); - QDomElement docEl = doc.documentElement(); - QDomElement titleEl = docEl.namedItem("DCF").toElement(); + TQDomElement docEl = doc.documentElement(); + TQDomElement titleEl = docEl.namedItem("DCF").toElement(); - QDomElement childEl = docEl.firstChild().toElement(); + TQDomElement childEl = docEl.firstChild().toElement(); while (!childEl.isNull()) { if (childEl.tagName() == "section") @@ -249,26 +249,26 @@ void DocQtPlugin::createIndex(IndexBox *index, DocumentationCatalogItem *item) } } -void DocQtPlugin::createSectionIndex(QFileInfo &fi, IndexBox *index, DocumentationCatalogItem *item, - QDomElement section) +void DocQtPlugin::createSectionIndex(TQFileInfo &fi, IndexBox *index, DocumentationCatalogItem *item, + TQDomElement section) { //adymo: do not load section to index for Qt reference documentation - QString title = section.attribute("title"); + TQString title = section.attribute("title"); if (fi.fileName() != "qt.dcf") { - QString ref = section.attribute("ref"); + TQString 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(); + TQDomElement grandChild = section.firstChild().toElement(); while(!grandChild.isNull()) { if (grandChild.tagName() == "keyword") { - QString keyRef = grandChild.attribute("ref"); - QString keyTitle = grandChild.text(); + TQString keyRef = grandChild.attribute("ref"); + TQString keyTitle = grandChild.text(); //adymo: a little hack to avoid unwanted elements if (keyRef != "qdir-example.html") @@ -285,20 +285,20 @@ void DocQtPlugin::createSectionIndex(QFileInfo &fi, IndexBox *index, Documentati } } -QStringList DocQtPlugin::fullTextSearchLocations() +TQStringList DocQtPlugin::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); } } @@ -306,32 +306,32 @@ QStringList DocQtPlugin::fullTextSearchLocations() return locs; } -QPair<KFile::Mode, QString> DocQtPlugin::catalogLocatorProps() +QPair<KFile::Mode, TQString> DocQtPlugin::catalogLocatorProps() { - return QPair<KFile::Mode, QString>(KFile::File, "*.xml *.dcf"); + return QPair<KFile::Mode, TQString>(KFile::File, "*.xml *.dcf"); } -QString DocQtPlugin::catalogTitle(const QString &url) +TQString DocQtPlugin::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) || (doc.doctype().name() != "DCF")) - 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); } -DocumentationCatalogItem *DocQtPlugin::createCatalog(KListView *contents, const QString &title, const QString &url) +DocumentationCatalogItem *DocQtPlugin::createCatalog(KListView *contents, const TQString &title, const TQString &url) { return new QtDocumentationCatalogItem(url, this, contents, title); } |