diff options
Diffstat (limited to 'part/qdom_add.cpp')
-rw-r--r-- | part/qdom_add.cpp | 130 |
1 files changed, 65 insertions, 65 deletions
diff --git a/part/qdom_add.cpp b/part/qdom_add.cpp index 142b873..ccca6bc 100644 --- a/part/qdom_add.cpp +++ b/part/qdom_add.cpp @@ -15,39 +15,39 @@ * * ***************************************************************************/ -/** This file contains useful datatypes and functions in addition to the Qt DOM classes. */ +/** This file contains useful datatypes and functions in addition to the TQt DOM classes. */ #include "qdom_add.h" #include <kiconloader.h> #include <kdebug.h> -#include <qtextstream.h> +#include <tqtextstream.h> #include "kxmleditorfactory.h" #include "kxesearchdialog.h" -QPixmap g_iconElement( UserIcon("xml_element",KXMLEditorFactory::instance()) ); -QPixmap g_iconText( UserIcon("xml_text",KXMLEditorFactory::instance()) ); -QPixmap g_iconComment( UserIcon("xml_comment",KXMLEditorFactory::instance()) ); -QPixmap g_iconCDATASection( UserIcon("xml_cdata",KXMLEditorFactory::instance()) ); -QPixmap g_iconProcessingInstruction( UserIcon("xml_procinstr",KXMLEditorFactory::instance()) ); -QPixmap g_iconElement_b( UserIcon("xml_element_b",KXMLEditorFactory::instance()) ); -QPixmap g_iconText_b( UserIcon("xml_text_b",KXMLEditorFactory::instance()) ); -QPixmap g_iconComment_b( UserIcon("xml_comment_b",KXMLEditorFactory::instance()) ); -QPixmap g_iconCDATASection_b( UserIcon("xml_cdata_b",KXMLEditorFactory::instance()) ); -QPixmap g_iconProcessingInstruction_b( UserIcon("xml_procinstr_b",KXMLEditorFactory::instance()) ); -QPixmap g_iconUnknown; - -const QPixmap & domTool_getIconForNodeType( QDomNode::NodeType type, bool bBookmarked ) +TQPixmap g_iconElement( UserIcon("xml_element",KXMLEditorFactory::instance()) ); +TQPixmap g_iconText( UserIcon("xml_text",KXMLEditorFactory::instance()) ); +TQPixmap g_iconComment( UserIcon("xml_comment",KXMLEditorFactory::instance()) ); +TQPixmap g_iconCDATASection( UserIcon("xml_cdata",KXMLEditorFactory::instance()) ); +TQPixmap g_iconProcessingInstruction( UserIcon("xml_procinstr",KXMLEditorFactory::instance()) ); +TQPixmap g_iconElement_b( UserIcon("xml_element_b",KXMLEditorFactory::instance()) ); +TQPixmap g_iconText_b( UserIcon("xml_text_b",KXMLEditorFactory::instance()) ); +TQPixmap g_iconComment_b( UserIcon("xml_comment_b",KXMLEditorFactory::instance()) ); +TQPixmap g_iconCDATASection_b( UserIcon("xml_cdata_b",KXMLEditorFactory::instance()) ); +TQPixmap g_iconProcessingInstruction_b( UserIcon("xml_procinstr_b",KXMLEditorFactory::instance()) ); +TQPixmap g_iconUnknown; + +const TQPixmap & domTool_getIconForNodeType( TQDomNode::NodeType type, bool bBookmarked ) { if(!bBookmarked) { switch(type) - { case QDomNode::ElementNode: return g_iconElement; break; - case QDomNode::TextNode: return g_iconText; break; - case QDomNode::CDATASectionNode: return g_iconCDATASection; break; - case QDomNode::CommentNode: return g_iconComment; break; - case QDomNode::ProcessingInstructionNode: return g_iconProcessingInstruction; break; + { case TQDomNode::ElementNode: return g_iconElement; break; + case TQDomNode::TextNode: return g_iconText; break; + case TQDomNode::CDATASectionNode: return g_iconCDATASection; break; + case TQDomNode::CommentNode: return g_iconComment; break; + case TQDomNode::ProcessingInstructionNode: return g_iconProcessingInstruction; break; default: kdDebug() << "domTool_getIconForNodeType: unknown node type (" << type << ")" << endl; @@ -55,11 +55,11 @@ const QPixmap & domTool_getIconForNodeType( QDomNode::NodeType type, bool bBookm } else { switch(type) - { case QDomNode::ElementNode: return g_iconElement_b; break; - case QDomNode::TextNode: return g_iconText_b; break; - case QDomNode::CDATASectionNode: return g_iconCDATASection_b; break; - case QDomNode::CommentNode: return g_iconComment_b; break; - case QDomNode::ProcessingInstructionNode: return g_iconProcessingInstruction_b; break; + { case TQDomNode::ElementNode: return g_iconElement_b; break; + case TQDomNode::TextNode: return g_iconText_b; break; + case TQDomNode::CDATASectionNode: return g_iconCDATASection_b; break; + case TQDomNode::CommentNode: return g_iconComment_b; break; + case TQDomNode::ProcessingInstructionNode: return g_iconProcessingInstruction_b; break; default: kdDebug() << "domTool_getIconForNodeType: unknown node type (" << type << ")" << endl; @@ -69,22 +69,22 @@ const QPixmap & domTool_getIconForNodeType( QDomNode::NodeType type, bool bBookm } // Obtain XPath for all nodes, instead of elements -QString domTool_getPath( const QDomNode & node ) +TQString domTool_getPath( const TQDomNode & node ) { if ( node.isNull() ) { kdDebug() << "domTool_getPath: elelent given" << endl; - return QString(); + return TQString(); } if(node.isElement()) { - kdDebug() << "use domTool_getPath( const QDomElement & domElement ) for elements" << endl; + kdDebug() << "use domTool_getPath( const TQDomElement & domElement ) for elements" << endl; } - QString strReturn; + TQString strReturn; - QDomNode parentNode = node.parentNode(); + TQDomNode parentNode = node.parentNode(); if ( (!parentNode.isNull()) && (!parentNode.isDocument()) ) { strReturn = domTool_getPath( parentNode.toElement() ); // get the parent's path @@ -98,16 +98,16 @@ QString domTool_getPath( const QDomNode & node ) } // Obtain XPath for elements -QString domTool_getPath( const QDomElement & domElement ) +TQString domTool_getPath( const TQDomElement & domElement ) { if ( domElement.isNull() ) { kdDebug() << "domTool_getPath: no node given" << endl; - return QString(); + return TQString(); } - QString strReturn; - QDomNode parentNode = domElement.parentNode(); + TQString strReturn; + TQDomNode parentNode = domElement.parentNode(); if ( (!parentNode.isNull()) && (!parentNode.isDocument()) ) { // calculate index - only for elements with the same name @@ -115,12 +115,12 @@ QString domTool_getPath( const QDomElement & domElement ) bool bUseIndex = false; // index is used only when exist sibling(s) with the same name // traverse previous sibling elements with same name and calculate index - QDomNode tmpNode = domElement.previousSibling(); + TQDomNode tmpNode = domElement.previousSibling(); while ( ! tmpNode.isNull() ) { if(tmpNode.isElement()) { - QDomElement domSiblingElement = tmpNode.toElement(); + TQDomElement domSiblingElement = tmpNode.toElement(); if(domElement.tagName() == domSiblingElement.tagName()) { i++; bUseIndex = true; @@ -133,12 +133,12 @@ QString domTool_getPath( const QDomElement & domElement ) { // traverse next sibling elements with same name // and decide, if index is necessary - QDomNode tmpNode = domElement.nextSibling(); + TQDomNode tmpNode = domElement.nextSibling(); while ( ! tmpNode.isNull() ) { if(tmpNode.isElement()) { - QDomElement domSiblingElement = tmpNode.toElement(); + TQDomElement domSiblingElement = tmpNode.toElement(); if(domElement.tagName() == domSiblingElement.tagName()) bUseIndex = true; @@ -155,7 +155,7 @@ QString domTool_getPath( const QDomElement & domElement ) if(bUseIndex) { - QString strIndex; + TQString strIndex; strIndex.setNum(i+1); strReturn += "[" + strIndex + "]"; // append the index } @@ -166,7 +166,7 @@ QString domTool_getPath( const QDomElement & domElement ) return strReturn; } -unsigned int domTool_getLevel( const QDomNode & node ) +unsigned int domTool_getLevel( const TQDomNode & node ) { if ( node.isNull() ) { @@ -175,7 +175,7 @@ unsigned int domTool_getLevel( const QDomNode & node ) } unsigned int iLevel = 0; - QDomNode parentNode = node.parentNode(); + TQDomNode parentNode = node.parentNode(); while ( ! parentNode.isNull() ) { iLevel++; @@ -185,26 +185,26 @@ unsigned int domTool_getLevel( const QDomNode & node ) return iLevel - 1; } -QString domTool_save( const QDomNode & node, int iIndent ) +TQString domTool_save( const TQDomNode & node, int iIndent ) { - QString strXML; - QTextStream ts( & strXML, IO_WriteOnly ); + TQString strXML; + TQTextStream ts( & strXML, IO_WriteOnly ); node.save(ts, iIndent); return strXML; } -QDomNode domTool_prevNode( const QDomNode & node ) +TQDomNode domTool_prevNode( const TQDomNode & node ) { if ( node.isNull() ) { kdDebug() << "domTool_prevNode: internal implementation error - the given node is an empty one" << endl; - return QDomNode(); + return TQDomNode(); } if ( ! node.previousSibling().isNull() ) // if there is a prev. sibling { // return its last grand child (if there is any) - QDomNode prevNode = node.previousSibling(); + TQDomNode prevNode = node.previousSibling(); while ( ! prevNode.lastChild().isNull() ) prevNode = prevNode.lastChild(); return prevNode; @@ -214,12 +214,12 @@ QDomNode domTool_prevNode( const QDomNode & node ) } -QDomNode domTool_nextNode( const QDomNode & node ) +TQDomNode domTool_nextNode( const TQDomNode & node ) { if ( node.isNull() ) { kdDebug() << "domTool_nextNode: internal implementation error - the given node is an empty one" << endl; - return QDomNode(); + return TQDomNode(); } // checking for a child @@ -231,7 +231,7 @@ QDomNode domTool_nextNode( const QDomNode & node ) return node.nextSibling(); // there is no next sibling -> checking for parents' next sibling(s) - QDomNode nodeParent = node.parentNode(); + TQDomNode nodeParent = node.parentNode(); while ( ! nodeParent.isNull() ) { if ( ! nodeParent.nextSibling().isNull() ) @@ -241,15 +241,15 @@ QDomNode domTool_nextNode( const QDomNode & node ) } // parent has no parents anymore - return QDomNode(); // return empty node + return TQDomNode(); // return empty node } -QDomNode domTool_matchingNode( const QDomNode & node, const QString & szPath ) +TQDomNode domTool_matchingNode( const TQDomNode & node, const TQString & szPath ) { if(szPath.length() == 0) - return QDomNode(); // return void node + return TQDomNode(); // return void node - QString szNodePath = node.isDocument() ? QString("") : domTool_getPath(node); + TQString szNodePath = node.isDocument() ? TQString("") : domTool_getPath(node); if ( szPath == szNodePath ) // test if the strings match return node; @@ -257,15 +257,15 @@ QDomNode domTool_matchingNode( const QDomNode & node, const QString & szPath ) // we will find any node in root element subtree if ( szPath.length() <= szNodePath.length() ) // the given string must be longer - return QDomNode(); // otherwise we don't need to check the childs + return TQDomNode(); // otherwise we don't need to check the childs if ( szPath.left(szNodePath.length()) != szNodePath ) // the nodes path must be left part of the given path - return QDomNode(); // otherwise we don't need to check the childs + return TQDomNode(); // otherwise we don't need to check the childs */ // recursively check the childs - QDomNode nodeChild = node.firstChild(); - QDomNode nodeTmp; + TQDomNode nodeChild = node.firstChild(); + TQDomNode nodeTmp; while ( ! nodeChild.isNull() ) { nodeTmp = domTool_matchingNode( nodeChild, szPath ); @@ -274,10 +274,10 @@ QDomNode domTool_matchingNode( const QDomNode & node, const QString & szPath ) nodeChild = nodeChild.nextSibling(); } - return QDomNode(); // nothing found -> return empty node + return TQDomNode(); // nothing found -> return empty node } -bool domTool_match( QDomNode node, const KXESearchDialog * const pConditions ) +bool domTool_match( TQDomNode node, const KXESearchDialog * const pConditions ) { if ( node.isNull() ) { @@ -293,7 +293,7 @@ bool domTool_match( QDomNode node, const KXESearchDialog * const pConditions ) switch ( node.nodeType() ) { - case QDomNode::ElementNode: // ---------------------------------------- + case TQDomNode::ElementNode: // ---------------------------------------- { if ( pConditions->getInElementNames() ) { @@ -303,7 +303,7 @@ bool domTool_match( QDomNode node, const KXESearchDialog * const pConditions ) if ( ( pConditions->getInAttributeNames() ) || ( pConditions->getInAttributeValues() ) ) { - QDomNamedNodeMap list = node.toElement().attributes(); + TQDomNamedNodeMap list = node.toElement().attributes(); unsigned int iLength = list.length(); if ( iLength <= 0 ) return false; // no attributes @@ -324,9 +324,9 @@ bool domTool_match( QDomNode node, const KXESearchDialog * const pConditions ) break; } - case QDomNode::TextNode: // ---------------------------------------- - case QDomNode::CDATASectionNode: - case QDomNode::CommentNode: + case TQDomNode::TextNode: // ---------------------------------------- + case TQDomNode::CDATASectionNode: + case TQDomNode::CommentNode: { if ( pConditions->getInContents() ) { |