summaryrefslogtreecommitdiffstats
path: root/kbugbuster/backend/domprocessor.cpp
diff options
context:
space:
mode:
authortpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2010-07-31 19:51:49 +0000
committertpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2010-07-31 19:51:49 +0000
commit4ae0c208b66e0f7954e194384464fe2d0a2c56dd (patch)
treeb0a7cd1c184f0003c0292eb416ed27f674f9cc43 /kbugbuster/backend/domprocessor.cpp
parent1964ea0fb4ab57493ca2ebb709c8d3b5395fd653 (diff)
downloadtdesdk-4ae0c208b66e0f7954e194384464fe2d0a2c56dd.tar.gz
tdesdk-4ae0c208b66e0f7954e194384464fe2d0a2c56dd.zip
Trinity Qt initial conversion
git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdesdk@1157652 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'kbugbuster/backend/domprocessor.cpp')
-rw-r--r--kbugbuster/backend/domprocessor.cpp142
1 files changed, 71 insertions, 71 deletions
diff --git a/kbugbuster/backend/domprocessor.cpp b/kbugbuster/backend/domprocessor.cpp
index 7643ca11..bfef2ca6 100644
--- a/kbugbuster/backend/domprocessor.cpp
+++ b/kbugbuster/backend/domprocessor.cpp
@@ -23,8 +23,8 @@
#include "domprocessor.h"
-#include <qregexp.h>
-#include <qstylesheet.h>
+#include <tqregexp.h>
+#include <tqstylesheet.h>
#include <kdebug.h>
#include <kmdcodec.h>
@@ -44,15 +44,15 @@ DomProcessor::~DomProcessor()
{
}
-KBB::Error DomProcessor::parsePackageList( const QByteArray &data,
+KBB::Error DomProcessor::parsePackageList( const TQByteArray &data,
Package::List &packages )
{
- QDomDocument doc;
+ TQDomDocument doc;
if ( !doc.setContent( data ) ) {
return KBB::Error( "Error parsing xml response for package list request." );
}
- QDomElement bugzilla = doc.documentElement();
+ TQDomElement bugzilla = doc.documentElement();
if ( bugzilla.isNull() ) {
return KBB::Error( "No document in xml response." );
@@ -63,14 +63,14 @@ KBB::Error DomProcessor::parsePackageList( const QByteArray &data,
return err;
}
-KBB::Error DomProcessor::parseBugList( const QByteArray &data, Bug::List &bugs )
+KBB::Error DomProcessor::parseBugList( const TQByteArray &data, Bug::List &bugs )
{
- QDomDocument doc;
+ TQDomDocument doc;
if ( !doc.setContent( data ) ) {
return KBB::Error( "Error parsing xml response for bug list request" );
}
- QDomElement bugzilla = doc.documentElement();
+ TQDomElement bugzilla = doc.documentElement();
if ( bugzilla.isNull() ) {
return KBB::Error( "No document in xml response." );
@@ -81,23 +81,23 @@ KBB::Error DomProcessor::parseBugList( const QByteArray &data, Bug::List &bugs )
return err;
}
-KBB::Error DomProcessor::parseBugDetails( const QByteArray &data,
+KBB::Error DomProcessor::parseBugDetails( const TQByteArray &data,
BugDetails &bugDetails )
{
- QDomDocument doc;
+ TQDomDocument doc;
if ( !doc.setContent( data ) ) {
return KBB::Error( "Error parsing xml response for bug details request." );
}
- QDomElement bugzilla = doc.documentElement();
+ TQDomElement bugzilla = doc.documentElement();
if ( bugzilla.isNull() ) {
return KBB::Error( "No document in xml response." );
}
- QDomNode p;
+ TQDomNode p;
for ( p = bugzilla.firstChild(); !p.isNull(); p = p.nextSibling() ) {
- QDomElement bug = p.toElement();
+ TQDomElement bug = p.toElement();
if ( bug.tagName() != "bug" ) continue;
KBB::Error err = parseDomBugDetails( bug, bugDetails );
@@ -109,24 +109,24 @@ KBB::Error DomProcessor::parseBugDetails( const QByteArray &data,
}
-KBB::Error DomProcessor::parseDomPackageList( const QDomElement &element,
+KBB::Error DomProcessor::parseDomPackageList( const TQDomElement &element,
Package::List &packages )
{
- QDomNode p;
+ TQDomNode p;
for ( p = element.firstChild(); !p.isNull(); p = p.nextSibling() ) {
- QDomElement bug = p.toElement();
+ TQDomElement bug = p.toElement();
if ( bug.tagName() != "product" ) continue;
- QString pkgName = bug.attribute( "name" );
+ TQString pkgName = bug.attribute( "name" );
uint bugCount = 999;
Person maintainer;
- QString description;
- QStringList components;
+ TQString description;
+ TQStringList components;
- QDomNode n;
+ TQDomNode n;
for( n = bug.firstChild(); !n.isNull(); n = n.nextSibling() ) {
- QDomElement e = n.toElement();
+ TQDomElement e = n.toElement();
if ( e.tagName() == "descr" ) description= e.text().stripWhiteSpace();
if ( e.tagName() == "component" ) components += e.text().stripWhiteSpace();
}
@@ -141,13 +141,13 @@ KBB::Error DomProcessor::parseDomPackageList( const QDomElement &element,
return KBB::Error();
}
-KBB::Error DomProcessor::parseDomBugList( const QDomElement &topElement,
+KBB::Error DomProcessor::parseDomBugList( const TQDomElement &topElement,
Bug::List &bugs )
{
- QDomElement element;
+ TQDomElement element;
if ( topElement.tagName() != "querybugids" ) {
- QDomNode buglist = topElement.namedItem( "querybugids" );
+ TQDomNode buglist = topElement.namedItem( "querybugids" );
element = buglist.toElement();
if ( element.isNull() ) {
return KBB::Error( "No querybugids element found." );
@@ -156,9 +156,9 @@ KBB::Error DomProcessor::parseDomBugList( const QDomElement &topElement,
element = topElement;
}
- QDomNode p;
+ TQDomNode p;
for ( p = element.firstChild(); !p.isNull(); p = p.nextSibling() ) {
- QDomElement hit = p.toElement();
+ TQDomElement hit = p.toElement();
kdDebug() << "DomProcessor::parseDomBugList(): tag: " << hit.tagName() << endl;
@@ -166,20 +166,20 @@ KBB::Error DomProcessor::parseDomBugList( const QDomElement &topElement,
return KBB::Error( "Error: " + hit.text() );
} else if ( hit.tagName() != "hit" ) continue;
- QString title;
- QString submitterName;
- QString submitterEmail;
- QString bugNr;
+ TQString title;
+ TQString submitterName;
+ TQString submitterEmail;
+ TQString bugNr;
Bug::Status status = Bug::StatusUndefined;
Bug::Severity severity = Bug::SeverityUndefined;
Person developerTodo;
Bug::BugMergeList mergedList;
uint age = 0xFFFFFFFF;
- QDomNode n;
+ TQDomNode n;
for ( n = hit.firstChild(); !n.isNull(); n = n.nextSibling() )
{
- QDomElement e = n.toElement();
+ TQDomElement e = n.toElement();
if ( e.tagName() == "bugid" )
bugNr = e.text();
@@ -194,7 +194,7 @@ KBB::Error DomProcessor::parseDomBugList( const QDomElement &topElement,
else if ( e.tagName() == "severity" )
severity = Bug::stringToSeverity( e.text() );
else if ( e.tagName() == "creationdate" )
- age = ( QDateTime::fromString( e.text(), Qt::ISODate ) ).daysTo( QDateTime::currentDateTime() );
+ age = ( TQDateTime::fromString( e.text(), Qt::ISODate ) ).daysTo( TQDateTime::currentDateTime() );
}
Person submitter( submitterName, submitterEmail );
@@ -210,57 +210,57 @@ KBB::Error DomProcessor::parseDomBugList( const QDomElement &topElement,
return KBB::Error();
}
-KBB::Error DomProcessor::parseDomBugDetails( const QDomElement &element,
+KBB::Error DomProcessor::parseDomBugDetails( const TQDomElement &element,
BugDetails &bugDetails )
{
if ( element.tagName() != "bug" ) return KBB::Error( "No <bug> tag found" );
BugDetailsPart::List parts;
- QValueList<BugDetailsImpl::AttachmentDetails> attachments;
+ TQValueList<BugDetailsImpl::AttachmentDetails> attachments;
- QString versionXml;
- QString osXml;
+ TQString versionXml;
+ TQString osXml;
- QString version;
- QString source;
- QString compiler;
- QString os;
+ TQString version;
+ TQString source;
+ TQString compiler;
+ TQString os;
- QDomNode n;
+ TQDomNode n;
for( n = element.firstChild(); !n.isNull(); n = n.nextSibling() ) {
- QDomElement e = n.toElement();
+ TQDomElement e = n.toElement();
if ( e.tagName() == "version" ) versionXml = e.text().stripWhiteSpace();
if ( e.tagName() == "op_sys" ) osXml = e.text().stripWhiteSpace();
if ( e.tagName() == "long_desc" ) {
- QString encoding = e.attribute( "encoding" );
+ TQString encoding = e.attribute( "encoding" );
Person sender;
- QDateTime date;
- QString text;
+ TQDateTime date;
+ TQString text;
- QDomNode n2;
+ TQDomNode n2;
for( n2 = e.firstChild(); !n2.isNull(); n2 = n2.nextSibling() ) {
- QDomElement e2 = n2.toElement();
+ TQDomElement e2 = n2.toElement();
if ( e2.tagName() == "who" ) {
sender = Person::parseFromString( e2.text() );
} else if ( e2.tagName() == "bug_when" ) {
date = parseDate( e2.text().stripWhiteSpace() );
} else if ( e2.tagName() == "thetext" ) {
- QString in;
+ TQString in;
if ( encoding == "base64" ) {
in = KCodecs::base64Decode( e2.text().latin1() );
} else {
in = e2.text();
}
- QString raw = QStyleSheet::escape( in );
+ TQString raw = TQStyleSheet::escape( in );
if ( parts.isEmpty() )
{
- QTextStream ts( &raw, IO_ReadOnly );
- QString line;
+ TQTextStream ts( &raw, IO_ReadOnly );
+ TQString line;
while( !( line = ts.readLine() ).isNull() ) {
if ( parseAttributeLine( line, "Version", version ) ) continue;
if ( parseAttributeLine( line, "Installed from", source ) ) continue;
@@ -272,8 +272,8 @@ KBB::Error DomProcessor::parseDomBugDetails( const QDomElement &element,
} else {
text += raw;
}
- QString bugBaseURL = server()->serverConfig().baseUrl().htmlURL();
- text = "<pre>" + wrapLines( text ).replace( QRegExp( "(Created an attachment \\(id=([0-9]+)\\))" ),
+ TQString bugBaseURL = server()->serverConfig().baseUrl().htmlURL();
+ text = "<pre>" + wrapLines( text ).replace( TQRegExp( "(Created an attachment \\(id=([0-9]+)\\))" ),
"<a href=\"" + bugBaseURL + "/attachment.cgi?id=\\2&action=view\">\\1</a>" ) + "\n</pre>";
}
}
@@ -282,15 +282,15 @@ KBB::Error DomProcessor::parseDomBugDetails( const QDomElement &element,
}
if ( e.tagName() == "attachment" ) {
- QString attachid, date, desc;
- for( QDomNode node = e.firstChild(); !node.isNull(); node = node.nextSibling() ) {
- QDomElement e2 = node.toElement();
+ TQString attachid, date, desc;
+ for( TQDomNode node = e.firstChild(); !node.isNull(); node = node.nextSibling() ) {
+ TQDomElement e2 = node.toElement();
if ( e2.tagName() == "attachid" ) {
attachid = e2.text();
} else if ( e2.tagName() == "date" ) {
date = e2.text().stripWhiteSpace();
} else if ( e2.tagName() == "desc" ) {
- desc = "<pre>" + wrapLines( QStyleSheet::escape(e2.text()) ) + "\n</pre>";
+ desc = "<pre>" + wrapLines( TQStyleSheet::escape(e2.text()) ) + "\n</pre>";
}
}
attachments.append( BugDetailsImpl::AttachmentDetails( desc, date, attachid ) );
@@ -313,7 +313,7 @@ void DomProcessor::setPackageListQuery( KURL &url )
url.setQuery( "?data=versiontable" );
}
-void DomProcessor::setBugListQuery( KURL &url, const Package &product, const QString &component )
+void DomProcessor::setBugListQuery( KURL &url, const Package &product, const TQString &component )
{
if ( server()->serverConfig().bugzillaVersion() == "Bugworld" ) {
url.setFileName( "bugworld.cgi" );
@@ -321,7 +321,7 @@ void DomProcessor::setBugListQuery( KURL &url, const Package &product, const QSt
url.setFileName( "xmlquery.cgi" );
}
- QString user = server()->serverConfig().user();
+ TQString user = server()->serverConfig().user();
if ( component.isEmpty() )
url.setQuery( "?user=" + user + "&product=" + product.name() );
@@ -338,18 +338,18 @@ void DomProcessor::setBugDetailsQuery( KURL &url, const Bug &bug )
url.setQuery( "?id=" + bug.number() );
}
-QString DomProcessor::wrapLines( const QString &text )
+TQString DomProcessor::wrapLines( const TQString &text )
{
int wrap = KBBPrefs::instance()->mWrapColumn;
- QStringList lines = QStringList::split( '\n', text, true );
+ TQStringList lines = TQStringList::split( '\n', text, true );
//kdDebug() << lines.count() << " lines." << endl;
- QString out;
+ TQString out;
bool removeBlankLines = true;
- for ( QStringList::Iterator it = lines.begin() ; it != lines.end() ; ++it )
+ for ( TQStringList::Iterator it = lines.begin() ; it != lines.end() ; ++it )
{
- QString line = *it;
+ TQString line = *it;
if ( removeBlankLines ) {
if ( line.isEmpty() ) continue;
@@ -358,7 +358,7 @@ QString DomProcessor::wrapLines( const QString &text )
//kdDebug() << "BugDetailsJob::processNode IN line='" << line << "'" << endl;
- QString wrappedLine;
+ TQString wrappedLine;
while ( line.length() > uint( wrap ) )
{
int breakPoint = line.findRev( ' ', wrap );
@@ -380,14 +380,14 @@ QString DomProcessor::wrapLines( const QString &text )
return out;
}
-bool DomProcessor::parseAttributeLine( const QString &line, const QString &key,
- QString &result )
+bool DomProcessor::parseAttributeLine( const TQString &line, const TQString &key,
+ TQString &result )
{
if ( !result.isEmpty() ) return false;
if ( !line.startsWith( key + ":" ) ) return false;
- QString value = line.mid( key.length() + 1 );
+ TQString value = line.mid( key.length() + 1 );
value = value.stripWhiteSpace();
result = value;
@@ -395,9 +395,9 @@ bool DomProcessor::parseAttributeLine( const QString &line, const QString &key,
return true;
}
-QDateTime DomProcessor::parseDate( const QString &dateStr )
+TQDateTime DomProcessor::parseDate( const TQString &dateStr )
{
- QDateTime date = QDateTime::fromString( dateStr, Qt::ISODate );
+ TQDateTime date = TQDateTime::fromString( dateStr, Qt::ISODate );
return date;
}