diff options
author | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2011-06-16 19:02:47 +0000 |
---|---|---|
committer | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2011-06-16 19:02:47 +0000 |
commit | e985f7e545f4739493965aad69bbecb136dc9346 (patch) | |
tree | 54afd409d8acd6202dd8ab611d24e78c28e4c0a0 /quanta/src/dtds.cpp | |
parent | f7670c198945adc3b95ad69a959fe5f8ae55b493 (diff) | |
download | tdewebdev-e985f7e545f4739493965aad69bbecb136dc9346.tar.gz tdewebdev-e985f7e545f4739493965aad69bbecb136dc9346.zip |
TQt4 port kdewebdev
This enables compilation under both Qt3 and Qt4
git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdewebdev@1237029 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'quanta/src/dtds.cpp')
-rw-r--r-- | quanta/src/dtds.cpp | 122 |
1 files changed, 61 insertions, 61 deletions
diff --git a/quanta/src/dtds.cpp b/quanta/src/dtds.cpp index cc25516f..e1c5a742 100644 --- a/quanta/src/dtds.cpp +++ b/quanta/src/dtds.cpp @@ -56,12 +56,12 @@ const TQString m_rcFilename("description.rc"); This constructor reads the dictionary of known dtd's, the attributes and tags will be loaded on the first access to one dtd. */ -DTDs::DTDs(TQObject *parent) - :TQObject(parent) +DTDs::DTDs(TQObject *tqparent) + :TQObject(tqparent) { - connect(this, TQT_SIGNAL(hideSplash()), parent, TQT_SLOT(slotHideSplash())); - connect(this, TQT_SIGNAL(enableIdleTimer(bool)), parent, TQT_SLOT(slotEnableIdleTimer(bool))); - connect(this, TQT_SIGNAL(loadToolbarForDTD(const TQString&)), parent, TQT_SLOT(slotLoadToolbarForDTD(const TQString&))); + connect(this, TQT_SIGNAL(hideSplash()), tqparent, TQT_SLOT(slotHideSplash())); + connect(this, TQT_SIGNAL(enableIdleTimer(bool)), tqparent, TQT_SLOT(slotEnableIdleTimer(bool))); + connect(this, TQT_SIGNAL(loadToolbarForDTD(const TQString&)), tqparent, TQT_SLOT(slotLoadToolbarForDTD(const TQString&))); // kdDebug(24000) << "dtds::dtds" << endl; m_dict = new TQDict<DTDStruct>(119, false); //optimized for max 119 DTD. This should be enough. m_dict->setAutoDelete(true); @@ -120,9 +120,9 @@ DTDs::DTDs(TQObject *parent) DTDStruct * dtd = it.current(); for (uint i = 0; i < dtd->insideDTDs.count(); i++) { - const DTDStruct *insideDTD = m_dict->find(dtd->insideDTDs[i]); // search but don't load + const DTDStruct *insideDTD = m_dict->tqfind(dtd->insideDTDs[i]); // search but don't load if (!insideDTD) - insideDTD = m_dict->find(getDTDNameFromNickName(dtd->insideDTDs[i])); // search but don't load + insideDTD = m_dict->tqfind(getDTDNameFromNickName(dtd->insideDTDs[i])); // search but don't load if (insideDTD && !insideDTD->toplevel) dtd->mimeTypes += insideDTD->mimeTypes; } @@ -168,7 +168,7 @@ bool DTDs::readTagDir(const TQString &dirName, bool loadAll) KConfig *dtdConfig = new KConfig(tmpStr, true); dtdConfig->setGroup("General"); TQString dtdName = dtdConfig->readEntry("Name", "Unknown"); - if (m_dict->find(dtdName.lower())) + if (m_dict->tqfind(dtdName.lower())) { delete dtdConfig; kdDebug(24000) << "dtds::readTagDir from " << dirName @@ -205,8 +205,8 @@ bool DTDs::readTagDir(const TQString &dirName, bool loadAll) for (uint i = 0; i < tmpStrList.count(); i++) { tmpStr = tmpStrList[i].stripWhiteSpace(); - int pos = tmpStr.find('('); - dtd->definitionTags[tmpStr.left(pos).stripWhiteSpace()] = tmpStr.mid(pos+1, tmpStr.findRev(')')-pos-1).stripWhiteSpace(); + int pos = tmpStr.tqfind('('); + dtd->definitionTags[tmpStr.left(pos).stripWhiteSpace()] = tmpStr.mid(pos+1, tmpStr.tqfindRev(')')-pos-1).stripWhiteSpace(); } //Which DTD can be present in this one? dtd->insideDTDs = dtdConfig->readListEntry("MayContain"); @@ -239,7 +239,7 @@ bool DTDs::readTagDir2(DTDStruct *dtd) if (!TQFile::exists(dtd->fileName)) return false; - kapp->setOverrideCursor( TQCursor(Qt::WaitCursor) ); + kapp->setOverrideCursor( TQCursor(TQt::WaitCursor) ); KConfig *dtdConfig = new KConfig(dtd->fileName, true); @@ -264,7 +264,7 @@ bool DTDs::readTagDir2(DTDStruct *dtd) dtd->defaultExtension = dtdConfig->readEntry("DefaultExtension"); dtd->caseSensitive = caseSensitive; int numOfTags = 0; - QTagList *tagList = new QTagList(119, false); //max 119 tag in a DTD + TQTagList *tagList = new TQTagList(119, false); //max 119 tag in a DTD tagList->setAutoDelete(true); //read all the tag files KURL dirURL(dtd->fileName); @@ -272,10 +272,10 @@ bool DTDs::readTagDir2(DTDStruct *dtd) TQString dirName = dirURL.path(1); if (TQFile::exists(dirName + "common.tag")) readTagFile(dirName + "common.tag", dtd, 0L); - //bool idleTimerStatus = quantaApp->slotEnableIdleTimer(false); + //bool idleTimertqStatus = quantaApp->slotEnableIdleTimer(false); emit enableIdleTimer(false); - KURL::List files = QExtFileInfo::allFilesRelative(dirURL, "*.tag", 0L); - //quantaApp->slotEnableIdleTimer(idleTimerStatus); + KURL::List files = TQExtFileInfo::allFilesRelative(dirURL, "*.tag", 0L); + //quantaApp->slotEnableIdleTimer(idleTimertqStatus); emit enableIdleTimer(true); TQString tmpStr; KURL::List::ConstIterator end_f = files.constEnd(); @@ -313,16 +313,16 @@ bool DTDs::readTagDir2(DTDStruct *dtd) TQStrList attrList; for (uint i = 0 ; i < extraTagsList.count(); i++) { - QTag *tag = new QTag(); + TQTag *tag = new TQTag(); tag->setName(TQString(extraTagsList.at(i)).stripWhiteSpace()); tmpStr = (dtd->caseSensitive) ? tag->name() : tag->name().upper(); - if (tagList->find(tmpStr)) //the tag is already defined in a .tag file + if (tagList->tqfind(tmpStr)) //the tag is already defined in a .tag file { delete tag; continue; //skip this tag } - tag->parentDTD = dtd; + tag->tqparentDTD = dtd; //read the possible stopping tags TQStrList stoppingTags; dtdConfig->readListEntry(tag->name() + "_stoppingtags",stoppingTags); @@ -422,8 +422,8 @@ bool DTDs::readTagDir2(DTDStruct *dtd) for (uint i = 0; i < tmpStrList.count(); i++) { tmpStr = tmpStrList[i].stripWhiteSpace(); - int pos = tmpStr.find('('); - dtd->specialTags[tmpStr.left(pos).stripWhiteSpace()] = tmpStr.mid(pos+1, tmpStr.findRev(')')-pos-1).stripWhiteSpace(); + int pos = tmpStr.tqfind('('); + dtd->specialTags[tmpStr.left(pos).stripWhiteSpace()] = tmpStr.mid(pos+1, tmpStr.tqfindRev(')')-pos-1).stripWhiteSpace(); } //static const TQString quotationStr = "\\\\\"|\\\\'"; @@ -533,7 +533,7 @@ bool DTDs::readTagDir2(DTDStruct *dtd) TQString tagStr; for (uint index = 1; index <= structGroupsCount; index++) { - dtdConfig->setGroup(TQString("StructGroup_%1").arg(index)); + dtdConfig->setGroup(TQString("StructGroup_%1").tqarg(index)); //new code group.name = dtdConfig->readEntry("Name").stripWhiteSpace(); group.noName = dtdConfig->readEntry("No_Name").stripWhiteSpace(); @@ -547,7 +547,7 @@ bool DTDs::readTagDir2(DTDStruct *dtd) group.hasDefinitionRx = !group.definitionRx.pattern().isEmpty(); group.isMinimalDefinitionRx = dtdConfig->readBoolEntry("DefinitionRx_Minimal", false); group.appendToTags = dtdConfig->readBoolEntry("AppendToTags", false); - group.parentGroup = dtdConfig->readEntry("ParentGroup").stripWhiteSpace(); + group.tqparentGroup = dtdConfig->readEntry("ParentGroup").stripWhiteSpace(); tagStr = dtdConfig->readEntry("TagType", "Text").stripWhiteSpace(); if (tagStr == "XmlTag") group.tagType = Tag::XmlTag; @@ -583,19 +583,19 @@ bool DTDs::readTagDir2(DTDStruct *dtd) TQString tagName; for (uint index = 1; index <= structGroupsCount; index++) { - dtdConfig->setGroup(TQString("StructGroup_%1").arg(index)); + dtdConfig->setGroup(TQString("StructGroup_%1").tqarg(index)); group.name = dtdConfig->readEntry("Name").stripWhiteSpace(); group.noName = dtdConfig->readEntry("No_Name").stripWhiteSpace(); group.icon = dtdConfig->readEntry("Icon").stripWhiteSpace(); group.appendToTags = dtdConfig->readBoolEntry("AppendToTags", false); - group.parentGroup = dtdConfig->readEntry("ParentGroup").stripWhiteSpace(); + group.tqparentGroup = dtdConfig->readEntry("ParentGroup").stripWhiteSpace(); TQString tagStr = dtdConfig->readEntry("Tag").stripWhiteSpace(); if (!tagStr.isEmpty()) { attrRx.search(tagStr); tmpStr = attrRx.cap(); tmpStrList = TQStringList::split(',', tmpStr.mid(1, tmpStr.length()-2)); - tagName = tagStr.left(tagStr.find('(')).lower(); + tagName = tagStr.left(tagStr.tqfind('(')).lower(); group.attributes.clear(); for (uint i = 0; i < tmpStrList.count(); i++) group.attributes += tmpStrList[i].stripWhiteSpace(); @@ -620,15 +620,15 @@ void DTDs::resolveInherited (DTDStruct *dtd) //Resolve the inheritence if (!dtd->inheritsTagsFrom.isEmpty()) { - DTDStruct *parent = (DTDStruct *) find(dtd->inheritsTagsFrom); // this loads the dtd, if not present in memory - TQDictIterator<QTag> tag_it(*(parent->tagsList)); + DTDStruct *tqparent = (DTDStruct *) tqfind(dtd->inheritsTagsFrom); // this loads the dtd, if not present in memory + TQDictIterator<TQTag> tag_it(*(tqparent->tagsList)); for ( ; tag_it.current(); ++tag_it) { - QTag *tag = tag_it.current(); + TQTag *tag = tag_it.current(); TQString searchForTag = (dtd->caseSensitive) ? tag->name() : tag->name().upper(); - if (!dtd->tagsList->find(searchForTag)) + if (!dtd->tagsList->tqfind(searchForTag)) { - QTag *newTag = new QTag(*tag); + TQTag *newTag = new TQTag(*tag); dtd->tagsList->insert(searchForTag, newTag); } } @@ -642,9 +642,9 @@ void DTDs::resolveInherited (DTDStruct *dtd) specialAreaStartRxStr += "|"; for (uint i = 0; i < dtd->insideDTDs.count(); i++) { - const DTDStruct *insideDTD = m_dict->find(dtd->insideDTDs[i]); // search but don't load + const DTDStruct *insideDTD = m_dict->tqfind(dtd->insideDTDs[i]); // search but don't load if (!insideDTD) - insideDTD = m_dict->find(getDTDNameFromNickName(dtd->insideDTDs[i])); // search but don't load + insideDTD = m_dict->tqfind(getDTDNameFromNickName(dtd->insideDTDs[i])); // search but don't load if (insideDTD) { for (mapIt = insideDTD->definitionAreas.begin(); mapIt != insideDTD->definitionAreas.end(); ++mapIt) @@ -667,7 +667,7 @@ void DTDs::resolveInherited (DTDStruct *dtd) /** Reads the tags for the tag files. Returns the number of read tags. */ -uint DTDs::readTagFile(const TQString& fileName, DTDStruct* parentDTD, QTagList *tagList) +uint DTDs::readTagFile(const TQString& fileName, DTDStruct* tqparentDTD, TQTagList *tagList) { // kdDebug(24000) << "dtds::readTagFile:" << fileName << endl; TQFile f(fileName); @@ -678,14 +678,14 @@ uint DTDs::readTagFile(const TQString& fileName, DTDStruct* parentDTD, QTagList bool result = f.open( IO_ReadOnly ); if (! result) kdError() << "dtds::readTagFile unable to open:" << fileName - << " Status: " << f.status() << endl; + << " tqStatus: " << f.status() << endl; } TQString errorMsg; int errorLine, errorCol; if (!m_doc->setContent( &f, &errorMsg, &errorLine, &errorCol )) { emit hideSplash(); - KMessageBox::error(0L, i18n("<qt>The DTD tag file %1 is not valid.<br> The error message is: <i>%2 in line %3, column %4.</i></qt>").arg(fileName).arg(errorMsg).arg(errorLine).arg(errorCol), + KMessageBox::error(0L, i18n("<qt>The DTD tag file %1 is not valid.<br> The error message is: <i>%2 in line %3, column %4.</i></qt>").tqarg(fileName).tqarg(errorMsg).tqarg(errorLine).tqarg(errorCol), i18n("Invalid Tag File")); kdWarning() << fileName << ": " << errorMsg << ": " << errorLine << "," << errorCol << endl; } @@ -702,13 +702,13 @@ uint DTDs::readTagFile(const TQString& fileName, DTDStruct* parentDTD, QTagList TQString extends = e.attribute("extends"); TQString name = e.attribute("name"); if (!name.isEmpty() && !extends.isEmpty()) - parentDTD->classInheritance[name] = extends; + tqparentDTD->classInheritance[name] = extends; continue; } - QTag *tag = new QTag(); + TQTag *tag = new TQTag(); tag->setName(e.attribute("name")); tag->setFileName(fileName); - tag->parentDTD = parentDTD; + tag->tqparentDTD = tqparentDTD; bool common = false; setAttributes(&n, tag, common); if (common) @@ -720,15 +720,15 @@ uint DTDs::readTagFile(const TQString& fileName, DTDStruct* parentDTD, QTagList commonAttrList->setAutoDelete(true); *commonAttrList = *attrs; //delete tag; - parentDTD->commonAttrs->insert(groupName, commonAttrList); + tqparentDTD->commonAttrs->insert(groupName, commonAttrList); } else { - if (parentDTD->caseSensitive) + if (tqparentDTD->caseSensitive) { - tagList->replace(tag->name(), tag); //append the tag to the list for this DTD + tagList->tqreplace(tag->name(), tag); //append the tag to the list for this DTD } else { - tagList->replace(tag->name().upper(), tag); + tagList->tqreplace(tag->name().upper(), tag); } } } @@ -739,7 +739,7 @@ uint DTDs::readTagFile(const TQString& fileName, DTDStruct* parentDTD, QTagList /** Parse the dom document and retrieve the tag attributes */ -void DTDs::setAttributes(TQDomNode *dom, QTag* tag, bool &common) +void DTDs::setAttributes(TQDomNode *dom, TQTag* tag, bool &common) { common = false; Attribute *attr; @@ -750,9 +750,9 @@ void DTDs::setAttributes(TQDomNode *dom, QTag* tag, bool &common) tmpStr = el.attribute("common"); if ((tmpStr != "1" && tmpStr != "yes")) //in case of common tags, we are not interested in these options { - if (tag->parentDTD->commonAttrs) + if (tag->tqparentDTD->commonAttrs) { - TQDictIterator<AttributeList> it(*(tag->parentDTD->commonAttrs)); + TQDictIterator<AttributeList> it(*(tag->tqparentDTD->commonAttrs)); for( ; it.current(); ++it ) { TQString lookForAttr = "has" + TQString(it.currentKey()).stripWhiteSpace(); @@ -794,7 +794,7 @@ void DTDs::setAttributes(TQDomNode *dom, QTag* tag, bool &common) for ( TQDomNode n = dom->firstChild(); !n.isNull(); n = n.nextSibling() ) { tmpStr = n.nodeName(); - if (tmpStr == "children") + if (tmpStr == "tqchildren") { TQDomElement el = n.toElement(); TQDomElement item = el.firstChild().toElement(); @@ -804,7 +804,7 @@ void DTDs::setAttributes(TQDomNode *dom, QTag* tag, bool &common) if (tmpStr == "child") { TQString childTag = item.attribute("name"); - if (!tag->parentDTD->caseSensitive) + if (!tag->tqparentDTD->caseSensitive) childTag = childTag.upper(); tag->childTags.insert(childTag, item.attribute("usage") == "required"); } @@ -820,7 +820,7 @@ void DTDs::setAttributes(TQDomNode *dom, QTag* tag, bool &common) if (item.tagName() == "stoppingtag") { TQString stopTag = item.attribute("name"); - if (!tag->parentDTD->caseSensitive) + if (!tag->tqparentDTD->caseSensitive) stopTag = stopTag.upper(); tag->stoppingTags.append(stopTag); } @@ -837,7 +837,7 @@ void DTDs::setAttributes(TQDomNode *dom, QTag* tag, bool &common) attr->method = el.attribute("method"); attr->arguments = el.attribute("arguments"); - attr->type = el.attribute("type",tag->parentDTD->defaultAttrType); + attr->type = el.attribute("type",tag->tqparentDTD->defaultAttrType); attr->defaultValue = el.attribute("defaultValue"); attr->status = el.attribute("status"); @@ -912,9 +912,9 @@ void DTDs::slotLoadDTD() dtdcfg.setGroup("General"); TQString dtdName = dtdcfg.readEntry("Name"); TQString nickName = dtdcfg.readEntry("NickName", dtdName); - DTDStruct * dtd = m_dict->find(dtdName) ; + DTDStruct * dtd = m_dict->tqfind(dtdName) ; if (dtd && - KMessageBox::warningYesNo(0L, i18n("<qt>Do you want to replace the existing <b>%1</b> DTD?</qt>").arg(nickName), TQString::null, i18n("Replace"), i18n("Do Not Replace")) == KMessageBox::No) + KMessageBox::warningYesNo(0L, i18n("<qt>Do you want to replace the existing <b>%1</b> DTD?</qt>").tqarg(nickName), TQString(), i18n("Replace"), i18n("Do Not Replace")) == KMessageBox::No) { return; } @@ -924,7 +924,7 @@ void DTDs::slotLoadDTD() TQString family = dtdcfg.readEntry("Family", "1"); Document *w = ViewManager::ref()->activeDocument(); if (family == "1" && w && - KMessageBox::questionYesNo(0L, i18n("<qt>Use the newly loaded <b>%1</b> DTD for the current document?</qt>").arg(nickName), i18n("Change DTD"), i18n("Use"), i18n("Do Not Use")) == KMessageBox::Yes) + KMessageBox::questionYesNo(0L, i18n("<qt>Use the newly loaded <b>%1</b> DTD for the current document?</qt>").tqarg(nickName), i18n("Change DTD"), i18n("Use"), i18n("Do Not Use")) == KMessageBox::Yes) { w->setDTDIdentifier(dtdName); emit loadToolbarForDTD(w->getDTDIdentifier()); @@ -944,20 +944,20 @@ void DTDs::slotLoadDTEP(const TQString &_dirName, bool askForAutoload) dtdcfg.setGroup("General"); TQString dtdName = dtdcfg.readEntry("Name"); TQString nickName = dtdcfg.readEntry("NickName", dtdName); - DTDStruct * dtd = m_dict->find(dtdName) ; + DTDStruct * dtd = m_dict->tqfind(dtdName) ; if ( dtd && - KMessageBox::warningYesNo(0L, i18n("<qt>Do you want to replace the existing <b>%1</b> DTD?</qt>").arg(nickName), TQString::null, i18n("Replace"), i18n("Do Not Replace")) == KMessageBox::No) + KMessageBox::warningYesNo(0L, i18n("<qt>Do you want to replace the existing <b>%1</b> DTD?</qt>").tqarg(nickName), TQString(), i18n("Replace"), i18n("Do Not Replace")) == KMessageBox::No) { return; } removeDTD(dtd); if (!readTagDir(dirName)) { - KMessageBox::error(0L, i18n("<qt>Cannot read the DTEP from <b>%1</b>. Check that the folder contains a valid DTEP (<i>description.rc and *.tag files</i>).</qt>").arg(dirName), i18n("Error Loading DTEP")); + KMessageBox::error(0L, i18n("<qt>Cannot read the DTEP from <b>%1</b>. Check that the folder contains a valid DTEP (<i>description.rc and *.tag files</i>).</qt>").tqarg(dirName), i18n("Error Loading DTEP")); } else { TQString family = dtdcfg.readEntry("Family", "1"); - if (askForAutoload && KMessageBox::questionYesNo(0L, i18n("<qt>Autoload the <b>%1</b> DTD in the future?</qt>").arg(nickName), TQString::null, i18n("Load"), i18n("Do Not Load")) == KMessageBox::Yes) + if (askForAutoload && KMessageBox::questionYesNo(0L, i18n("<qt>Autoload the <b>%1</b> DTD in the future?</qt>").tqarg(nickName), TQString(), i18n("Load"), i18n("Do Not Load")) == KMessageBox::Yes) { KURL src; src.setPath(dirName); @@ -968,7 +968,7 @@ void DTDs::slotLoadDTEP(const TQString &_dirName, bool askForAutoload) } Document *w = ViewManager::ref()->activeDocument(); if (family == "1" && w && - KMessageBox::questionYesNo(0L, i18n("<qt>Use the newly loaded <b>%1</b> DTD for the current document?</qt>").arg(nickName), i18n("Change DTD"), i18n("Use"), i18n("Do Not Use")) == KMessageBox::Yes) + KMessageBox::questionYesNo(0L, i18n("<qt>Use the newly loaded <b>%1</b> DTD for the current document?</qt>").tqarg(nickName), i18n("Change DTD"), i18n("Use"), i18n("Do Not Use")) == KMessageBox::Yes) { w->setDTDIdentifier(dtdName); emit loadToolbarForDTD(w->getDTDIdentifier()); @@ -987,12 +987,12 @@ void DTDs::slotLoadEntities() if (w) { TQString nickName = DTDs::ref()->getDTDNickNameFromName(w->getDTDIdentifier()); - entitiesWidget.targetDTEPCombo->setCurrentItem(lst.findIndex(nickName)); + entitiesWidget.targetDTEPCombo->setCurrentItem(lst.tqfindIndex(nickName)); } dlg.setMainWidget(&entitiesWidget); if (dlg.exec()) { - DTDStruct * dtd = m_dict->find(getDTDNameFromNickName(entitiesWidget.targetDTEPCombo->currentText())); + DTDStruct * dtd = m_dict->tqfind(getDTDNameFromNickName(entitiesWidget.targetDTEPCombo->currentText())); DTDParser dtdParser(KURL::fromPathOrURL(entitiesWidget.sourceDTDRequester->url()), KGlobal::dirs()->saveLocation("data") + resourceDir + "dtep"); TQString dtdDir = TQFileInfo(dtd->fileName).dirPath(); if (dtdParser.parse(dtdDir, true)) @@ -1077,7 +1077,7 @@ const DTDStruct * DTDs::DTDforURL(const KURL &url) } } if (foundList.isEmpty()) - return find("empty"); + return tqfind("empty"); else { TQString path = url.path(); @@ -1093,7 +1093,7 @@ const DTDStruct * DTDs::DTDforURL(const KURL &url) bool DTDs::canHandle(const DTDStruct *dtd, const KURL &url) { TQString mimetype = KMimeType::findByURL(url)->name(); - if (dtd->mimeTypes.contains(mimetype)) + if (dtd->mimeTypes.tqcontains(mimetype)) return true; if (url.path().endsWith('.' + dtd->defaultExtension)) return true; |