diff options
Diffstat (limited to 'quanta/parts/kafka/wkafkapart.cpp')
-rw-r--r-- | quanta/parts/kafka/wkafkapart.cpp | 174 |
1 files changed, 87 insertions, 87 deletions
diff --git a/quanta/parts/kafka/wkafkapart.cpp b/quanta/parts/kafka/wkafkapart.cpp index 73e2a019..6eae1afc 100644 --- a/quanta/parts/kafka/wkafkapart.cpp +++ b/quanta/parts/kafka/wkafkapart.cpp @@ -61,7 +61,7 @@ KafkaWidget *kafkaWidget; KafkaDocument *kafkaDoc; -KafkaDocument::KafkaDocument(TQWidget *parent, TQWidget *widgetParent, const char *name) +KafkaDocument::KafkaDocument(TQWidget *tqparent, TQWidget *widgetParent, const char *name) :domNodeProps(1021), _docLoaded(false) { // i18n reserve @@ -88,7 +88,7 @@ TQString ab = i18n("Ident all"); kafkaDoc = this; - m_kafkaPart = new KafkaWidget(parent, widgetParent,this, name); + m_kafkaPart = new KafkaWidget(tqparent, widgetParent,this, name); kafkaWidget = m_kafkaPart; //m_kafkaPart->showDomTree(); m_currentDoc = 0L; @@ -107,9 +107,9 @@ TQString ab = i18n("Ident all"); { tmp = t.readLine(); if(tmp.left(2) == "//") continue;//comments - int begin = tmp.find("(") + 1; + int begin = tmp.tqfind("(") + 1; if(begin == (-1 + 1)) continue;//"(" not found : invalid line - int length = tmp.find(")") - begin; + int length = tmp.tqfind(")") - begin; decodedChars.insert(tmp.left(1), tmp.mid(begin, length)); encodedChars.insert(tmp.mid(begin, length), tmp.left(1)); } @@ -428,7 +428,7 @@ kNodeAttrs* KafkaDocument::connectDomNodeToQuantaNode(DOM::Node domNode, Node *n else { kdDebug(25001)<< "KafkaDocument::connectDomNodeToQuantaNode () - " << - "No QTag found! Setting default parameters..." << endl; + "No TQTag found! Setting default parameters..." << endl; props->setCHCursorFocus(kNodeAttrs::no); props->setCCEnter(false); props->setCBModified(false); @@ -513,7 +513,7 @@ bool KafkaDocument::buildKafkaNodeFromNode(Node *node, bool insertNode) DOM::Node newNode, newNode2, attr, nextNode, parentNode, *ptDomNode; bool removeLeftWhitespaces, removeRightWhitespaces; TQString str, nodeValue; - Node *n, *parent; + Node *n, *tqparent; int i; // Don't create DOM::Nodes from Quanta empty nodes outside the body or inside other not allowed element, or KHTML @@ -521,14 +521,14 @@ bool KafkaDocument::buildKafkaNodeFromNode(Node *node, bool insertNode) bool canInsertEmptyNode = false; if(node->tag->type == Tag::Empty) { - if(!m_currentDoc->defaultDTD()->name.contains("HTML", false)) + if(!m_currentDoc->defaultDTD()->name.tqcontains("HTML", false)) canInsertEmptyNode = true; else canInsertEmptyNode = kafkaCommon::hasParent(node, "body"); - Node* parent_node = node->parent; - QTag* parent_node_description_tag = QuantaCommon::tagFromDTD(parent_node); - if(parent_node_description_tag && !parent_node_description_tag->isChild(node, false, true)) + Node* tqparent_node = node->tqparent; + TQTag* tqparent_node_description_tag = QuantaCommon::tagFromDTD(tqparent_node); + if(tqparent_node_description_tag && !tqparent_node_description_tag->isChild(node, false, true)) canInsertEmptyNode = false; } @@ -540,7 +540,7 @@ bool KafkaDocument::buildKafkaNodeFromNode(Node *node, bool insertNode) //The basics DOM::Nodes HTML, HEAD and BODY are loaded anyway, but we must now // link the real HTML,... to their Nodes. //A basic Common tree is !doctype<-html<-(head, body) - if(!node->parent) + if(!node->tqparent) {//FIXME:html, head and body are HTML-specific tag, for others DTDs it might result to some pbs. if(str == "html") { @@ -575,30 +575,30 @@ bool KafkaDocument::buildKafkaNodeFromNode(Node *node, bool insertNode) } } } - else if(str == "html" && (!node->parent || (node->parent && !node->parent->parent))) + else if(str == "html" && (!node->tqparent || (node->tqparent && !node->tqparent->tqparent))) { if(!html.isNull())//delete the empty Node disconnectDomNodeFromQuantaNode(html); newNode = html; insertNode = false; } - else if(str == "body" && ((node->parent && !node->parent->parent) || (node->parent && - node->parent->parent && !node->parent->parent->parent))) + else if(str == "body" && ((node->tqparent && !node->tqparent->tqparent) || (node->tqparent && + node->tqparent->tqparent && !node->tqparent->tqparent->tqparent))) { if(!body.isNull()) disconnectDomNodeFromQuantaNode(body); newNode = body; insertNode = false; } - else if(str == "head" && ((node->parent && !node->parent->parent) || (node->parent && - node->parent->parent && !node->parent->parent->parent))) + else if(str == "head" && ((node->tqparent && !node->tqparent->tqparent) || (node->tqparent && + node->tqparent->tqparent && !node->tqparent->tqparent->tqparent))) { if(!head.isNull()) disconnectDomNodeFromQuantaNode(head); newNode = head; insertNode = false; } - /** else if(node->parent->tag->str == "html")*/ + /** else if(node->tqparent->tag->str == "html")*/ else { if(node->tag->type == Tag::Text || node->tag->type == Tag::Empty) @@ -631,16 +631,16 @@ bool KafkaDocument::buildKafkaNodeFromNode(Node *node, bool insertNode) //- It is the last child of a BLOCK removeLeftWhitespaces = false; n = node; - parent = node->parent; - while(parent && parent->SFirstChild() == n) + tqparent = node->tqparent; + while(tqparent && tqparent->SFirstChild() == n) { - if(!kafkaCommon::isInline(parent->tag->name)) + if(!kafkaCommon::isInline(tqparent->tag->name)) { removeLeftWhitespaces = true; break; } - n = parent; - parent = parent->parent; + n = tqparent; + tqparent = tqparent->tqparent; } if(!removeLeftWhitespaces) { @@ -661,16 +661,16 @@ bool KafkaDocument::buildKafkaNodeFromNode(Node *node, bool insertNode) removeRightWhitespaces = false; n = node; - parent = node->parent; - while(parent && parent->SLastChild() == n) + tqparent = node->tqparent; + while(tqparent && tqparent->SLastChild() == n) { - if(!kafkaCommon::isInline(parent->tag->name)) + if(!kafkaCommon::isInline(tqparent->tag->name)) { removeRightWhitespaces = true; break; } - n = parent; - parent = parent->parent; + n = tqparent; + tqparent = tqparent->tqparent; } nodeValue = node->tag->tagStr(); @@ -714,11 +714,11 @@ bool KafkaDocument::buildKafkaNodeFromNode(Node *node, bool insertNode) break; } } - if(node->parent && node->parent->leafNode()) - parentNode = *node->parent->leafNode(); - else if(node->parent && !node->parent->leafNode()) + if(node->tqparent && node->tqparent->leafNode()) + parentNode = *node->tqparent->leafNode(); + else if(node->tqparent && !node->tqparent->leafNode()) { - //the parent tag was invalid and khtml refuse to insert it + //the tqparent tag was invalid and khtml refuse to insert it //so impossible to inser the current node disconnectDomNodeFromQuantaNode(newNode); if(node->rootNode()) @@ -734,7 +734,7 @@ bool KafkaDocument::buildKafkaNodeFromNode(Node *node, bool insertNode) node->setLeafNode(ptDomNode); mainEnhancer->enhanceNode(node, parentNode, nextNode); - QTag* qTag = QuantaCommon::tagFromDTD(getCurrentDoc()->defaultDTD(), + TQTag* qTag = QuantaCommon::tagFromDTD(getCurrentDoc()->defaultDTD(), parentNode.nodeName().string()); if(qTag && qTag->isChild(node, false)) @@ -774,8 +774,8 @@ bool KafkaDocument::buildKafkaNodeFromNode(Node *node, bool insertNode) } else { - if(node->parent && node->parent->leafNode()) - parentNode = *node->parent->leafNode(); + if(node->tqparent && node->tqparent->leafNode()) + parentNode = *node->tqparent->leafNode(); else parentNode = body; n = node; @@ -807,8 +807,8 @@ void KafkaDocument::buildNodeFromKafkaNode(Node *node, DOM::Node domNode) if(domNode.nodeType() == DOM::Node::TEXT_NODE) { TQString text = domNode.nodeValue().string(); - text.replace("<", "<"); - text.replace(">", ">"); + text.tqreplace("<", "<"); + text.tqreplace(">", ">"); node->tag->setStr(text); } else @@ -875,7 +875,7 @@ Node * KafkaDocument::buildNodeFromKafkaNode(DOM::Node domNode, Node *nodeParent TQString KafkaDocument::getDecodedChar(const TQString &encodedChar) { - TQMap<TQString, TQString>::Iterator it = encodedChars.find(encodedChar); + TQMap<TQString, TQString>::Iterator it = encodedChars.tqfind(encodedChar); if(it == encodedChars.end()) { //try this @@ -950,7 +950,7 @@ TQString KafkaDocument::getEncodedChar(const TQString &decodedChar, const TQStri else if(decodedChar[0].isSpace()) //FIXME:for an unknown reason, by default it return ¿ instead of return " "; - TQMap<TQString, TQString>::Iterator it = decodedChars.find(decodedChar); + TQMap<TQString, TQString>::Iterator it = decodedChars.tqfind(decodedChar); if(it == decodedChars.end()) return decodedChar; @@ -1074,10 +1074,10 @@ TQString KafkaDocument::generateCodeFromNode(Node *node, int bLine, int bCol, in openingNode = node->getOpeningNode(); if(openingNode && openingNode->tag->type == Tag::ScriptTag) { - if(openingNode->tag->name.contains("XML PI", false) || - openingNode->tag->name.contains("PHP", false)) + if(openingNode->tag->name.tqcontains("XML PI", false) || + openingNode->tag->name.tqcontains("PHP", false)) text = "?>"; - else if(openingNode->tag->name.contains("DTD", false)) + else if(openingNode->tag->name.tqcontains("DTD", false)) text = ">"; else text = ">"; @@ -1102,26 +1102,26 @@ TQString KafkaDocument::generateCodeFromNode(Node *node, int bLine, int bCol, in /** Can't use KGlobal::charsets()->toEntity() : * It translate all chars into entities! */ else if(!hasPreParent) - text = node->tag->tagStr().replace(TQRegExp("\\s+"), " "); + text = node->tag->tagStr().tqreplace(TQRegExp("\\s+"), " "); else text = node->tag->tagStr(); } else if(node->tag->type == Tag::ScriptTag) { //WARNING : HTML SPECIFIC - if(node->tag->name.contains("style", false)) + if(node->tag->name.tqcontains("style", false)) { text = "<" + QuantaCommon::tagCase("style") + ">"; } - else if(node->tag->name.contains("DTD", false)) + else if(node->tag->name.tqcontains("DTD", false)) { text = "<!"; } - else if(node->tag->name.contains("XML PI", false)) + else if(node->tag->name.tqcontains("XML PI", false)) { text = "<?xml"; } - else if(node->tag->name.contains("PHP", false)) + else if(node->tag->name.tqcontains("PHP", false)) { text = "<?php"; } @@ -1697,13 +1697,13 @@ void KafkaDocument::translateNodeIntoQuantaCursorPosition(Node *node, int offset } } -bool KafkaDocument::insertDomNode(DOM::Node node, DOM::Node parent, +bool KafkaDocument::insertDomNode(DOM::Node node, DOM::Node tqparent, DOM::Node nextSibling, DOM::Node rootNode) { DOM::Node siblingNSpecial; //First insert the node - if(!kafkaCommon::insertDomNode(node, parent, nextSibling, rootNode)) + if(!kafkaCommon::insertDomNode(node, tqparent, nextSibling, rootNode)) return false; //Then unEnhance and reEnhance the nearest non special nodes so that everything's fine. @@ -1728,12 +1728,12 @@ bool KafkaDocument::insertDomNode(DOM::Node node, DOM::Node parent, bool KafkaDocument::removeDomNode(DOM::Node node) { - DOM::Node nextSiblingNSpecial, prevSiblingNSpecial, parent; + DOM::Node nextSiblingNSpecial, prevSiblingNSpecial, tqparent; //First remove the node prevSiblingNSpecial = getPrevSiblingNSpecial(node); nextSiblingNSpecial = getNextSiblingNSpecial(node); - parent = node.parentNode(); + tqparent = node.parentNode(); if(!kafkaCommon::removeDomNode(node)) return false; @@ -1748,8 +1748,8 @@ bool KafkaDocument::removeDomNode(DOM::Node node) mainEnhancer->postUnenhanceNode(nextSiblingNSpecial); mainEnhancer->postEnhanceNode(nextSiblingNSpecial); } - mainEnhancer->postUnenhanceNode(parent); - mainEnhancer->postEnhanceNode(parent); + mainEnhancer->postUnenhanceNode(tqparent); + mainEnhancer->postEnhanceNode(tqparent); return true; } @@ -1832,9 +1832,9 @@ void KafkaDocument::coutLinkTree(Node *, int) dots.fill('*', indent); output = dots; if (node->tag->type != Tag::Text) - output += node->tag->name.replace('\n'," "); + output += node->tag->name.tqreplace('\n'," "); else - output+= node->tag->tagStr().replace('\n'," "); + output+= node->tag->tagStr().tqreplace('\n'," "); output += " ("; output += node->tag->type; output += ") "; @@ -1930,9 +1930,9 @@ void KafkaDocument::slotDomNodeModified(DOM::Node domNode, NodeModifsSet* modifs Node *node = 0L; NodeModif *modif; kNodeAttrs *props, *newProps; - DOM::Node newDomNode, parentDomNode, nextSiblingDomNode; + DOM::Node newDomNode, tqparentDomNode, nextSiblingDomNode; DOM::Node *ptDomNode; - QTag *qTag; + TQTag *qTag; #ifdef LIGHT_DEBUG TQTime t; @@ -1985,7 +1985,7 @@ void KafkaDocument::slotDomNodeModified(DOM::Node domNode, NodeModifsSet* modifs //let's create the corresponding Text Node and the P tag only if necessary modifs = new NodeModifsSet(); modif = new NodeModif(); - parentDomNode = domNode.parentNode(); + tqparentDomNode = domNode.parentNode(); nextSiblingDomNode = domNode.nextSibling(); if(!qTag->isChild("#text", false)) @@ -1993,7 +1993,7 @@ void KafkaDocument::slotDomNodeModified(DOM::Node domNode, NodeModifsSet* modifs newDomNode = kafkaCommon::createDomNode("p", getNode(domNode.parentNode())->tag->dtd(), m_kafkaPart->document()); kafkaCommon::removeDomNode(domNode); - kafkaCommon::insertDomNode(newDomNode, parentDomNode, nextSiblingDomNode); + kafkaCommon::insertDomNode(newDomNode, tqparentDomNode, nextSiblingDomNode); kafkaCommon::insertDomNode(domNode, newDomNode); node = kafkaCommon::createNode("p", "", Tag::XmlTag, m_currentDoc); @@ -2002,12 +2002,12 @@ void KafkaDocument::slotDomNodeModified(DOM::Node domNode, NodeModifsSet* modifs node->setRootNode(ptDomNode); ptDomNode = new DOM::Node(newDomNode); node->setLeafNode(ptDomNode); - node = kafkaCommon::insertNode(node, getNode(parentDomNode), + node = kafkaCommon::insertNode(node, getNode(tqparentDomNode), getNode(nextSiblingDomNode), getNode(nextSiblingDomNode), modifs); newProps->setNode(node); modifs->addNodeModif(modif); - parentDomNode = newDomNode; + tqparentDomNode = newDomNode; nextSiblingDomNode = DOM::Node(); modif = new NodeModif(); } @@ -2019,7 +2019,7 @@ void KafkaDocument::slotDomNodeModified(DOM::Node domNode, NodeModifsSet* modifs ptDomNode = new DOM::Node(domNode); node->setLeafNode(ptDomNode); //avoid the merging of Text Nodes - node = kafkaCommon::insertNode(node, getNode(parentDomNode), + node = kafkaCommon::insertNode(node, getNode(tqparentDomNode), getNode(nextSiblingDomNode), modifs, false); props->setNode(node); modifs->addNodeModif(modif); @@ -2080,13 +2080,13 @@ void KafkaDocument::slotDomNodeAboutToBeRemoved(DOM::Node _domNode, bool deleteC //If we are deleting a PHP Node which is embedded into a tag e.g. <a <? echo boo; ?> > //We must regenerate the <a> tag string. - if(_node->tag->type == Tag::ScriptTag && _node->parent) + if(_node->tag->type == Tag::ScriptTag && _node->tqparent) { - _node->parent->tag->beginPos(bLine, bCol); - _node->parent->tag->endPos(eLine, eCol); + _node->tqparent->tag->beginPos(bLine, bCol); + _node->tqparent->tag->endPos(eLine, eCol); _node->tag->beginPos(bLine2, bCol2); if(QuantaCommon::isBetween(bLine2, bCol2, bLine, bCol, eLine,eCol) == 0) - _node->parent->tag->setCleanStrBuilt(false); + _node->tqparent->tag->setCleanStrBuilt(false); } if(_node->prev) @@ -2099,15 +2099,15 @@ void KafkaDocument::slotDomNodeAboutToBeRemoved(DOM::Node _domNode, bool deleteC modif = new NodeModif(); modif->setType(NodeModif::NodeRemoved); modif->setLocation(kafkaCommon::getLocation(_node)); - if(_node->parent && _node->parent->child == _node) - _node->parent->child = _node->next; + if(_node->tqparent && _node->tqparent->child == _node) + _node->tqparent->child = _node->next; if(_node->prev) _node->prev->next = _node->next; if(_node->next) _node->next->prev = _node->prev; if(_node == baseNode) baseNode = _node->next; - _node->parent = 0L; + _node->tqparent = 0L; _node->prev = 0L; _node->next = 0L; _node->child = 0L; @@ -2131,8 +2131,8 @@ void KafkaDocument::slotDomNodeAboutToBeRemoved(DOM::Node _domNode, bool deleteC hasClosingNode = false; //_node->removeAll = false; - if(_node->parent && _node->parent->child == _node) - _node->parent->child = _node->next; + if(_node->tqparent && _node->tqparent->child == _node) + _node->tqparent->child = _node->next; if(_node->next) _node->next->prev = _node->prev; if(_node->prev) @@ -2155,15 +2155,15 @@ void KafkaDocument::slotDomNodeAboutToBeRemoved(DOM::Node _domNode, bool deleteC } else if(_node->child)// && !deleteChilds { - if(_node->parent && !_node->parent->child) - _node->parent->child = _node->child; + if(_node->tqparent && !_node->tqparent->child) + _node->tqparent->child = _node->child; if(_node->prev) _node->prev->next = _node->child; _tmpNode = _node->child; while(_tmpNode) { i++; - _tmpNode->parent = _node->parent; + _tmpNode->tqparent = _node->tqparent; n = _tmpNode; _tmpNode = _tmpNode->next; if(!_tmpNode) @@ -2181,7 +2181,7 @@ void KafkaDocument::slotDomNodeAboutToBeRemoved(DOM::Node _domNode, bool deleteC disconnectDomNodeFromQuantaNode(*_node->rootNode()); if(_node->leafNode()) disconnectDomNodeFromQuantaNode(*_node->leafNode()); - _node->parent = 0L; + _node->tqparent = 0L; _nodeNext = _node->next; _node->next = 0L; _node->prev = 0L; @@ -2195,13 +2195,13 @@ void KafkaDocument::slotDomNodeAboutToBeRemoved(DOM::Node _domNode, bool deleteC if(hasClosingNode) { //delete the closing Node if present - if(_node->parent && _node->parent->child == _node) - _node->parent->child = _node->next; + if(_node->tqparent && _node->tqparent->child == _node) + _node->tqparent->child = _node->next; if(_node->prev) _node->prev->next = _node->next; if(_node->next) _node->next->prev = _node->prev; - _node->parent = 0L; + _node->tqparent = 0L; _nodeNext = _node->next; _node->next = 0L; _node->prev = 0L; @@ -2221,13 +2221,13 @@ void KafkaDocument::slotDomNodeAboutToBeRemoved(DOM::Node _domNode, bool deleteC modif = new NodeModif(); modif->setType(NodeModif::NodeRemoved); modif->setLocation(kafkaCommon::getLocation(_node)); - if(_node->parent && _node->parent->child == _node) - _node->parent->child = _node->next; + if(_node->tqparent && _node->tqparent->child == _node) + _node->tqparent->child = _node->next; if(_node->prev) _node->prev->next = _node->next; if(_node->next) _node->next->prev = _node->prev; - _node->parent = 0L; + _node->tqparent = 0L; _nodeNext = _node->next; _node->prev = 0L; _node->next = 0L; @@ -2251,13 +2251,13 @@ void KafkaDocument::slotDomNodeAboutToBeRemoved(DOM::Node _domNode, bool deleteC void KafkaDocument::slotDomNodeIsAboutToBeMoved(DOM::Node domNode, DOM::Node newParent, DOM::Node before, NodeModifsSet* modifs) { - Node *node, *parent, *nextSibling, *closingNode; + Node *node, *tqparent, *nextSibling, *closingNode; if(domNode.isNull()) return; node = getNode(domNode); - parent = getNode(newParent); + tqparent = getNode(newParent); nextSibling = getNode(before); if(!node) @@ -2265,10 +2265,10 @@ void KafkaDocument::slotDomNodeIsAboutToBeMoved(DOM::Node domNode, DOM::Node new closingNode = node->getClosingNode(); - kafkaCommon::moveNode(node, parent, nextSibling, modifs, false); + kafkaCommon::moveNode(node, tqparent, nextSibling, modifs, false); if(closingNode) - kafkaCommon::moveNode(closingNode, parent, nextSibling, modifs, false); + kafkaCommon::moveNode(closingNode, tqparent, nextSibling, modifs, false); } @@ -2328,7 +2328,7 @@ void KafkaDocument::slotCut(Node* startNode, int startOffset, Node* endNode, int drag_object->addDragObject(node_drag); drag_object->addDragObject(text_drag); - TQApplication::clipboard()->setData(drag_object); + TQApplication::tqclipboard()->setData(drag_object); #ifdef LIGHT_DEBUG kafkaCommon::coutTree(subtree_root, 3); #endif @@ -2365,7 +2365,7 @@ void KafkaDocument::slotCopy(Node* startNode, int startOffset, Node* endNode, in drag_object->addDragObject(node_drag); drag_object->addDragObject(text_drag); - TQApplication::clipboard()->setData(drag_object); + TQApplication::tqclipboard()->setData(drag_object); // FIXME delete the subtree #ifdef LIGHT_DEBUG kafkaCommon::coutTree(subtree_root, 3); @@ -2375,7 +2375,7 @@ void KafkaDocument::slotCopy(Node* startNode, int startOffset, Node* endNode, in void KafkaDocument::slotPaste() { - QClipboard *cb = TQApplication::clipboard(); + TQClipboard *cb = TQApplication::tqclipboard(); TQMimeSource* e = cb->data(); Node* node = new Node(0); |