diff options
Diffstat (limited to 'parts/documentation/interfaces/kdevdocumentationplugin.cpp')
-rw-r--r-- | parts/documentation/interfaces/kdevdocumentationplugin.cpp | 176 |
1 files changed, 88 insertions, 88 deletions
diff --git a/parts/documentation/interfaces/kdevdocumentationplugin.cpp b/parts/documentation/interfaces/kdevdocumentationplugin.cpp index fc63d9e8..3364f71a 100644 --- a/parts/documentation/interfaces/kdevdocumentationplugin.cpp +++ b/parts/documentation/interfaces/kdevdocumentationplugin.cpp @@ -18,11 +18,11 @@ */ #include "kdevdocumentationplugin.h" -#include <qfile.h> -#include <qpainter.h> -#include <qstyle.h> -#include <qheader.h> -#include <qtextstream.h> +#include <tqfile.h> +#include <tqpainter.h> +#include <tqstyle.h> +#include <tqheader.h> +#include <tqtextstream.h> #include <kstandarddirs.h> #include <kiconloader.h> @@ -34,28 +34,28 @@ //class DocumentationItem DocumentationItem::DocumentationItem(DocumentationItem::Type type, KListView *parent, - const QString &name) + const TQString &name) :KListViewItem(parent, name), m_type(type) { init(); } DocumentationItem::DocumentationItem(DocumentationItem::Type type, KListViewItem *parent, - const QString &name) + const TQString &name) :KListViewItem(parent, name), m_type(type) { init(); } DocumentationItem::DocumentationItem(DocumentationItem::Type type, KListView *parent, - KListViewItem *after, const QString &name) + KListViewItem *after, const TQString &name) :KListViewItem(parent, after, name), m_type(type) { init(); } DocumentationItem::DocumentationItem(DocumentationItem::Type type, KListViewItem * parent, - KListViewItem * after, const QString & name ) + KListViewItem * after, const TQString & name ) :KListViewItem(parent, after, name), m_type(type) { init(); @@ -64,7 +64,7 @@ DocumentationItem::DocumentationItem(DocumentationItem::Type type, KListViewItem void DocumentationItem::init( ) { - QString icon; + TQString icon; switch (m_type) { @@ -90,7 +90,7 @@ void DocumentationItem::init( ) DocumentationCatalogItem::DocumentationCatalogItem(DocumentationPlugin* plugin, - KListView *parent, const QString &name) + KListView *parent, const TQString &name) :DocumentationItem(DocumentationItem::Catalog, parent, name), m_plugin(plugin), isLoaded(false), isActivated(false), m_isProjectDocumentationItem(false) { @@ -99,7 +99,7 @@ DocumentationCatalogItem::DocumentationCatalogItem(DocumentationPlugin* plugin, } DocumentationCatalogItem::DocumentationCatalogItem(DocumentationPlugin* plugin, - DocumentationItem *parent, const QString &name) + DocumentationItem *parent, const TQString &name) :DocumentationItem(DocumentationItem::Catalog, parent, name), m_plugin(plugin), isLoaded(false), isActivated(false), m_isProjectDocumentationItem(false) { @@ -146,7 +146,7 @@ void DocumentationCatalogItem::activate() //class IndexItemProto IndexItemProto::IndexItemProto(DocumentationPlugin *plugin, DocumentationCatalogItem *catalog, - IndexBox *listbox, const QString &text, const QString &description) + IndexBox *listbox, const TQString &text, const TQString &description) : m_listbox(listbox), m_text(text), m_description(description) { plugin->indexes[catalog].append(this); @@ -161,16 +161,16 @@ IndexItemProto::~IndexItemProto() //class IndexItem -IndexItem::IndexItem(IndexBox *listbox, const QString &text) - :QListBoxText(listbox, text), m_listbox(listbox) +IndexItem::IndexItem(IndexBox *listbox, const TQString &text) + :TQListBoxText(listbox, text), m_listbox(listbox) { } IndexItem::List IndexItem::urls() const { List urlList; - QValueList<IndexItemProto*> itemProtos = m_listbox->items[text()]; - for (QValueList<IndexItemProto*>::const_iterator it = itemProtos.begin(); + TQValueList<IndexItemProto*> itemProtos = m_listbox->items[text()]; + for (TQValueList<IndexItemProto*>::const_iterator it = itemProtos.begin(); it != itemProtos.end(); ++it) urlList.append(qMakePair((*it)->description(), (*it)->url())); return urlList; @@ -181,9 +181,9 @@ IndexItem::List IndexItem::urls() const //class ConfigurationItem -ConfigurationItem::ConfigurationItem(QListView *parent, DocumentationPlugin * plugin, const QString &title, const QString &url, +ConfigurationItem::ConfigurationItem(TQListView *parent, DocumentationPlugin * plugin, const TQString &title, const TQString &url, bool indexPossible, bool fullTextSearchPossible) - :QCheckListItem(parent, "", QCheckListItem::CheckBox), m_title(title), m_url(url), + :TQCheckListItem(parent, "", TQCheckListItem::CheckBox), m_title(title), m_url(url), m_origTitle(title), m_contents(true), m_index(false), m_fullTextSearch(false), m_indexPossible(indexPossible), m_fullTextSearchPossible(fullTextSearchPossible), m_docPlugin( plugin ) @@ -192,7 +192,7 @@ ConfigurationItem::ConfigurationItem(QListView *parent, DocumentationPlugin * pl setText(4, m_url); } -void ConfigurationItem::paintCell(QPainter *p, const QColorGroup &cg, int column, +void ConfigurationItem::paintCell(TQPainter *p, const TQColorGroup &cg, int column, int width, int align) { if ( (column == 0) || (column == 1) || (column == 2) ) @@ -200,25 +200,25 @@ void ConfigurationItem::paintCell(QPainter *p, const QColorGroup &cg, int column if ( !p ) return; - QListView *lv = listView(); + TQListView *lv = listView(); if ( !lv ) return; const BackgroundMode bgmode = lv->viewport()->backgroundMode(); - const QColorGroup::ColorRole crole = QPalette::backgroundRoleFromMode( bgmode ); + const TQColorGroup::ColorRole crole = TQPalette::backgroundRoleFromMode( bgmode ); p->fillRect(0, 0, width, height(), cg.brush(crole)); - QFontMetrics fm(lv->fontMetrics()); - int boxsize = lv->style().pixelMetric(QStyle::PM_CheckListButtonSize, lv); + TQFontMetrics fm(lv->fontMetrics()); + int boxsize = lv->style().pixelMetric(TQStyle::PM_CheckListButtonSize, lv); int marg = lv->itemMargin(); - int styleflags = QStyle::Style_Default; + int styleflags = TQStyle::Style_Default; if (((column == 0) && m_contents) || ((column == 1) && m_index) || ((column == 2) && m_fullTextSearch)) - styleflags |= QStyle::Style_On; + styleflags |= TQStyle::Style_On; else - styleflags |= QStyle::Style_Off; + styleflags |= TQStyle::Style_Off; if ((column == 0) || ((column == 1) && m_indexPossible) || ((column == 2) && m_fullTextSearchPossible)) - styleflags |= QStyle::Style_Enabled; + styleflags |= TQStyle::Style_Enabled; int x = 0; int y = 0; @@ -228,20 +228,20 @@ void ConfigurationItem::paintCell(QPainter *p, const QColorGroup &cg, int column else y = (fm.height() + 2 + marg - boxsize) / 2; - QStyleOption opt(this); - lv->style().drawPrimitive(QStyle::PE_CheckListIndicator, p, - QRect(x, y, boxsize, fm.height() + 2 + marg), cg, styleflags, opt); + TQStyleOption opt(this); + lv->style().drawPrimitive(TQStyle::PE_CheckListIndicator, p, + TQRect(x, y, boxsize, fm.height() + 2 + marg), cg, styleflags, opt); return; } - QListViewItem::paintCell(p, cg, column, width, align); + TQListViewItem::paintCell(p, cg, column, width, align); } -int ConfigurationItem::width(const QFontMetrics &fm, const QListView *lv, int c) const +int ConfigurationItem::width(const TQFontMetrics &fm, const TQListView *lv, int c) const { if ((c == 0) || (c == 1) || (c == 2)) - return lv->style().pixelMetric(QStyle::PM_CheckListButtonSize, lv) + 4; - return QListViewItem::width(fm, lv, c); + return lv->style().pixelMetric(TQStyle::PM_CheckListButtonSize, lv) + 4; + return TQListViewItem::width(fm, lv, c); } @@ -253,8 +253,8 @@ int ConfigurationItem::width(const QFontMetrics &fm, const QListView *lv, int c) //class DocumentationPlugin -DocumentationPlugin::DocumentationPlugin(KConfig *pluginConfig, QObject *parent, const char *name) - :QObject(parent, name), config(pluginConfig), m_indexCreated(false) +DocumentationPlugin::DocumentationPlugin(KConfig *pluginConfig, TQObject *parent, const char *name) + :TQObject(parent, name), config(pluginConfig), m_indexCreated(false) { } @@ -277,7 +277,7 @@ void DocumentationPlugin::autoSetup() void DocumentationPlugin::reload() { clear(); - for (QValueList<DocumentationCatalogItem *>::iterator it = catalogs.begin(); + for (TQValueList<DocumentationCatalogItem *>::iterator it = catalogs.begin(); it != catalogs.end(); ++it) { createTOC(*it); @@ -286,7 +286,7 @@ void DocumentationPlugin::reload() void DocumentationPlugin::clear() { - for (QValueList<DocumentationCatalogItem *>::iterator it = catalogs.begin(); + for (TQValueList<DocumentationCatalogItem *>::iterator it = catalogs.begin(); it != catalogs.end(); ++it) { clearCatalog(*it); @@ -296,7 +296,7 @@ void DocumentationPlugin::clear() void DocumentationPlugin::clearCatalog(DocumentationCatalogItem *item) { //clear named catalog map - for (QMap<QString, DocumentationCatalogItem*>::iterator it = namedCatalogs.begin(); + for (TQMap<TQString, DocumentationCatalogItem*>::iterator it = namedCatalogs.begin(); it != namedCatalogs.end(); ++it) { if (it.data() == item) @@ -306,8 +306,8 @@ void DocumentationPlugin::clearCatalog(DocumentationCatalogItem *item) } } //clear indexes for catalog - QValueList<IndexItemProto *> idx = indexes[item]; - for (QValueList<IndexItemProto *>::iterator it = idx.begin(); it != idx.end(); ++it) + TQValueList<IndexItemProto *> idx = indexes[item]; + for (TQValueList<IndexItemProto *>::iterator it = idx.begin(); it != idx.end(); ++it) { delete *it; } @@ -322,7 +322,7 @@ void DocumentationPlugin::createIndex(IndexBox *index) if (m_indexCreated) return; - for (QValueList<DocumentationCatalogItem *>::iterator it = catalogs.begin(); + for (TQValueList<DocumentationCatalogItem *>::iterator it = catalogs.begin(); it != catalogs.end(); ++it) { loadIndex(index, *it); @@ -334,17 +334,17 @@ void DocumentationPlugin::cacheIndex(DocumentationCatalogItem *item) { kdDebug() << "Creating index cache for " << item->text(0) << endl; - QString cacheName = locateLocal("data", QString("kdevdocumentation/index/cache_") + item->text(0)); - QFile cacheFile(cacheName); + TQString cacheName = locateLocal("data", TQString("kdevdocumentation/index/cache_") + item->text(0)); + TQFile cacheFile(cacheName); if (!cacheFile.open(IO_WriteOnly)) return; - QTextStream str(&cacheFile); - str.setEncoding(QTextStream::Unicode); + TQTextStream str(&cacheFile); + str.setEncoding(TQTextStream::Unicode); str << CACHE_VERSION << endl; - QValueList<IndexItemProto*> catalogIndexes = indexes[item]; - for (QValueList<IndexItemProto*>::const_iterator it = catalogIndexes.constBegin(); + TQValueList<IndexItemProto*> catalogIndexes = indexes[item]; + for (TQValueList<IndexItemProto*>::const_iterator it = catalogIndexes.constBegin(); it != catalogIndexes.constEnd(); ++it) { str << (*it)->text() << endl; @@ -357,26 +357,26 @@ void DocumentationPlugin::cacheIndex(DocumentationCatalogItem *item) bool DocumentationPlugin::loadCachedIndex(IndexBox *index, DocumentationCatalogItem *item) { - QString cacheName = locateLocal("data", QString("kdevdocumentation/index/cache_") + item->cacheVersion() + item->text(0)); - QFile cacheFile(cacheName); + TQString cacheName = locateLocal("data", TQString("kdevdocumentation/index/cache_") + item->cacheVersion() + item->text(0)); + TQFile cacheFile(cacheName); if (!cacheFile.open(IO_ReadOnly)) return false; kdDebug() << "Using cached index for item: " << item->text(0) << endl; - QTextStream str(&cacheFile); - str.setEncoding(QTextStream::Unicode); - QString cache = str.read(); - QStringList cacheList = QStringList::split("\n", cache, true); - QString ver = cacheList.first(); + TQTextStream str(&cacheFile); + str.setEncoding(TQTextStream::Unicode); + TQString cache = str.read(); + TQStringList cacheList = TQStringList::split("\n", cache, true); + TQString ver = cacheList.first(); if (ver != CACHE_VERSION) { kdDebug() << "Wrong cache version: " << ver << endl; return false; } - QStringList::const_iterator it = cacheList.begin(); + TQStringList::const_iterator it = cacheList.begin(); it++; - QString s[3]; int c = 0; + TQString s[3]; int c = 0; for (; it != cacheList.end(); ++it) { s[c] = *it; @@ -397,18 +397,18 @@ void DocumentationPlugin::addCatalog(DocumentationCatalogItem *item) { catalogs.append(item); namedCatalogs[item->text(0)] = item; -// indexes[item] = QValueList<IndexItem*>(); +// indexes[item] = TQValueList<IndexItem*>(); } void DocumentationPlugin::addCatalogConfiguration(KListView *configurationView, - const QString &title, const QString &url) + const TQString &title, const TQString &url) { new ConfigurationItem(configurationView, this, title, url, hasCapability(Index), hasCapability(FullTextSearch)); } void DocumentationPlugin::editCatalogConfiguration(ConfigurationItem *configurationItem, - const QString &title, const QString &url) + const TQString &title, const TQString &url) { configurationItem->setTitle(title); configurationItem->setURL(url); @@ -422,8 +422,8 @@ void DocumentationPlugin::deleteCatalogConfiguration(const ConfigurationItem *co void DocumentationPlugin::clearCatalogIndex(DocumentationCatalogItem *item) { //clear indexes for catalog - QValueList<IndexItemProto *> idx = indexes[item]; - for (QValueList<IndexItemProto *>::iterator it = idx.begin(); it != idx.end(); ++it) + TQValueList<IndexItemProto *> idx = indexes[item]; + for (TQValueList<IndexItemProto *>::iterator it = idx.begin(); it != idx.end(); ++it) { delete *it; } @@ -443,9 +443,9 @@ void DocumentationPlugin::loadIndex(IndexBox *index, DocumentationCatalogItem *i void DocumentationPlugin::init(KListView *contents) { config->setGroup("Locations"); - 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) { if (catalogEnabled(it.key())) @@ -453,13 +453,13 @@ void DocumentationPlugin::init(KListView *contents) } } -void DocumentationPlugin::reinit(KListView *contents, IndexBox *index, QStringList restrictions) +void DocumentationPlugin::reinit(KListView *contents, IndexBox *index, TQStringList restrictions) { config->setGroup("Locations"); - QMap<QString, QString> entryMap = config->entryMap("Locations"); + TQMap<TQString, TQString> entryMap = config->entryMap("Locations"); //remove deleted in configuration catalogs - for (QStringList::const_iterator it = deletedConfigurationItems.constBegin(); + for (TQStringList::const_iterator it = deletedConfigurationItems.constBegin(); it != deletedConfigurationItems.constEnd(); ++it) { if (namedCatalogs.contains(*it)) @@ -468,7 +468,7 @@ void DocumentationPlugin::reinit(KListView *contents, IndexBox *index, QStringLi deletedConfigurationItems.clear(); //update configuration - for (QMap<QString, QString>::const_iterator it = entryMap.begin(); + for (TQMap<TQString, TQString>::const_iterator it = entryMap.begin(); it != entryMap.end(); ++it) { config->setGroup("Locations"); @@ -507,9 +507,9 @@ void DocumentationPlugin::reinit(KListView *contents, IndexBox *index, QStringLi void DocumentationPlugin::loadCatalogConfiguration(KListView *configurationView) { config->setGroup("Locations"); - 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) { if (namedCatalogs.contains(it.key()) @@ -533,13 +533,13 @@ void DocumentationPlugin::saveCatalogConfiguration(KListView *configurationView) { config->setGroup("Locations"); - for (QStringList::const_iterator it = deletedConfigurationItems.constBegin(); + for (TQStringList::const_iterator it = deletedConfigurationItems.constBegin(); it != deletedConfigurationItems.constEnd(); ++it) { config->deleteEntry(*it); } - QListViewItemIterator it(configurationView); + TQListViewItemIterator it(configurationView); while (it.current()) { ConfigurationItem *confItem = dynamic_cast<ConfigurationItem*>(it.current()); @@ -576,7 +576,7 @@ void DocumentationPlugin::saveCatalogConfiguration(KListView *configurationView) void DocumentationPlugin::setIndexEnabled( DocumentationCatalogItem * item, bool e ) { - QString group = config->group(); + TQString group = config->group(); config->setGroup("Index Settings"); config->writeEntry(item->text(0), e); config->setGroup(group); @@ -584,25 +584,25 @@ void DocumentationPlugin::setIndexEnabled( DocumentationCatalogItem * item, bool bool DocumentationPlugin::indexEnabled( DocumentationCatalogItem * item ) const { - QString group = config->group(); + TQString group = config->group(); config->setGroup("Index Settings"); bool b = config->readBoolEntry(item->text(0), false); config->setGroup(group); return b; } -bool DocumentationPlugin::catalogEnabled(const QString &name) const +bool DocumentationPlugin::catalogEnabled(const TQString &name) const { - QString group = config->group(); + TQString group = config->group(); config->setGroup("TOC Settings"); bool b = config->readBoolEntry(name, true); config->setGroup(group); return b; } -void DocumentationPlugin::setCatalogEnabled(const QString &name, bool e) +void DocumentationPlugin::setCatalogEnabled(const TQString &name, bool e) { - QString group = config->group(); + TQString group = config->group(); config->setGroup("TOC Settings"); config->writeEntry(name, e); config->setGroup(group); @@ -613,7 +613,7 @@ void DocumentationPlugin::setCatalogEnabled(const QString &name, bool e) //class IndexBox -IndexBox::IndexBox(QWidget *parent, const char *name) +IndexBox::IndexBox(TQWidget *parent, const char *name) :KListBox(parent, name), m_dirty(false) { } @@ -625,12 +625,12 @@ void IndexBox::addIndexItem(IndexItemProto *item) void IndexBox::removeIndexItem(IndexItemProto *item) { - QString text = item->text(); + TQString text = item->text(); items[text].remove(item); if (items[text].count() == 0) { items.remove(text); - QListBoxItem *item = findItem(text, Qt::CaseSensitive | Qt::ExactMatch); + TQListBoxItem *item = findItem(text, Qt::CaseSensitive | Qt::ExactMatch); if (item) delete item; } @@ -638,7 +638,7 @@ void IndexBox::removeIndexItem(IndexItemProto *item) void IndexBox::fill() { - for (QMap<QString, QValueList<IndexItemProto*> >::const_iterator it = items.begin(); + for (TQMap<TQString, TQValueList<IndexItemProto*> >::const_iterator it = items.begin(); it != items.end(); ++it) { new IndexItem(this, it.key()); @@ -662,12 +662,12 @@ void IndexBox::refill() ProjectDocumentationPlugin::ProjectDocumentationPlugin(DocumentationPlugin *docPlugin, DocumentationPlugin::ProjectDocType type) - :QObject(0, 0), m_docPlugin(docPlugin), m_catalog(0), m_type(type), m_contents(0), m_index(0) + :TQObject(0, 0), m_docPlugin(docPlugin), m_catalog(0), m_type(type), m_contents(0), m_index(0) { kdDebug() << "ProjectDocumentationPlugin::ProjectDocumentationPlugin for type " << type << endl; m_watch = new KDirWatch(this); - connect(m_watch, SIGNAL(dirty(const QString&)), this, SLOT(reinit())); + connect(m_watch, TQT_SIGNAL(dirty(const TQString&)), this, TQT_SLOT(reinit())); m_watch->startScan(); } @@ -676,7 +676,7 @@ ProjectDocumentationPlugin::~ProjectDocumentationPlugin() deinit(); } -void ProjectDocumentationPlugin::init(KListView *contents, IndexBox *index, const QString &url) +void ProjectDocumentationPlugin::init(KListView *contents, IndexBox *index, const TQString &url) { m_contents = contents; m_index = index; @@ -708,12 +708,12 @@ void ProjectDocumentationPlugin::deinit() m_catalog = 0; } -QString ProjectDocumentationPlugin::pluginName() const +TQString ProjectDocumentationPlugin::pluginName() const { return m_docPlugin->pluginName(); } -QString ProjectDocumentationPlugin::catalogURL() const +TQString ProjectDocumentationPlugin::catalogURL() const { return m_url; } |