From e985f7e545f4739493965aad69bbecb136dc9346 Mon Sep 17 00:00:00 2001 From: tpearson Date: Thu, 16 Jun 2011 19:02:47 +0000 Subject: 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 --- klinkstatus/src/utils/utils.cpp | 12 ++++---- klinkstatus/src/utils/xsl.cpp | 66 ++++++++++++++++++++--------------------- klinkstatus/src/utils/xsl.h | 14 +++++---- 3 files changed, 48 insertions(+), 44 deletions(-) (limited to 'klinkstatus/src/utils') diff --git a/klinkstatus/src/utils/utils.cpp b/klinkstatus/src/utils/utils.cpp index 25384b4b..83956dee 100644 --- a/klinkstatus/src/utils/utils.cpp +++ b/klinkstatus/src/utils/utils.cpp @@ -131,14 +131,14 @@ TQString htmlDocCharset[NUMBER_OF_HTML_CODES][2] = { void decode(TQString& url) { - if( (int)url.find('&') != -1) + if( (int)url.tqfind('&') != -1) { for(int i = 0; i != NUMBER_OF_HTML_CODES; ++i) { - int index = url.find(htmlDocCharset[i][0]); + int index = url.tqfind(htmlDocCharset[i][0]); if(index != - 1) { - url.replace(htmlDocCharset[i][0], htmlDocCharset[i][1]); + url.tqreplace(htmlDocCharset[i][0], htmlDocCharset[i][1]); } } } @@ -146,15 +146,15 @@ void decode(TQString& url) /* void decode(string& url) { - if( (int)url.find('&') != -1) + if( (int)url.tqfind('&') != -1) { for(int i = 0; i != NUMBER_OF_HTML_CODES; ++i) { - int index = url.find(htmlDocCharset[i][0].latin1()); + int index = url.tqfind(htmlDocCharset[i][0].latin1()); if(index != - 1) { int length = htmlDocCharset[i][0].length(); - url.replace(index, length, htmlDocCharset[i][1].latin1()); + url.tqreplace(index, length, htmlDocCharset[i][1].latin1()); } } } diff --git a/klinkstatus/src/utils/xsl.cpp b/klinkstatus/src/utils/xsl.cpp index 27f61cb8..320f14cd 100644 --- a/klinkstatus/src/utils/xsl.cpp +++ b/klinkstatus/src/utils/xsl.cpp @@ -51,7 +51,7 @@ * The thread class that actually performs the XSL processing. * Using a thread allows async operation. */ -class KopeteXSLThread : public TQObject, public QThread +class KopeteXSLThread : public TQObject, public TQThread { public: /** @@ -106,7 +106,7 @@ void KopeteXSLThread::run() m_resultString = xsltTransform( m_xml, m_xsl ); dataMutex.unlock(); // get back to the main thread - qApp->postEvent( this, new TQEvent( TQEvent::User ) ); + tqApp->postEvent( this, new TQEvent( TQEvent::User ) ); } bool KopeteXSLThread::event( TQEvent *event ) @@ -141,7 +141,7 @@ TQString KopeteXSLThread::xsltTransform( const TQString &xmlString, xsltStyleshe { if ( styleSheet ) { - static TQCString appPath( TQString::fromLatin1("\"%1\"").arg( KApplication::kApplication()->dirs()->findDirs("appdata", TQString::fromLatin1("styles/data") ).front() ).utf8() ); + static TQCString appPath( TQString::tqfromLatin1("\"%1\"").tqarg( KApplication::kApplication()->dirs()->findDirs("appdata", TQString::tqfromLatin1("styles/data") ).front() ).utf8() ); static const char* params[3] = { "appdata", @@ -152,7 +152,7 @@ TQString KopeteXSLThread::xsltTransform( const TQString &xmlString, xsltStyleshe xmlDocPtr resultDoc = xsltApplyStylesheet( styleSheet, xmlDoc, params ); if ( resultDoc ) { - // Save the result into the QString + // Save the result into the TQString xmlChar *mem; int size; xmlDocDumpMemory( resultDoc, &mem, &size ); @@ -179,7 +179,7 @@ TQString KopeteXSLThread::xsltTransform( const TQString &xmlString, xsltStyleshe if ( resultString.isEmpty() ) { - resultString = i18n( "
KLinkStatus encountered the following error while parsing a message:
%1
" ).arg( errorMsg ); + resultString = i18n( "
KLinktqStatus encountered the following error while parsing a message:
%1
" ).tqarg( errorMsg ); } #ifdef RAWXSL @@ -196,8 +196,8 @@ public: unsigned int flags; }; -XSLT::XSLT( const TQString &document, TQObject *parent ) - : TQObject( parent ), d(new XSLTPrivate) +XSLT::XSLT( const TQString &document, TQObject *tqparent ) + : TQObject( tqparent ), d(new XSLTPrivate) { d->flags = 0; d->xslDoc = 0; @@ -228,14 +228,14 @@ void XSLT::setXSLT( const TQString &_document ) // depend on the strings in the current styles. If these strings change // they may break the parsing here. // - // The reason I'm doing it like this is because of issues with QDOM and - // namespaces in earlier Qt versions. When we drop Qt 3.1.x support we + // The reason I'm doing it like this is because of issues with TQDOM and + // namespaces in earlier TQt versions. When we drop TQt 3.1.x support we // should probably convert this to more accurate DOM code. - Martijn // // Actually, since we need to parse into a libxml2 document anyway, this whole // nonsense could be replaced with some simple XPath expressions - JK // - TQRegExp elementMatch( TQString::fromLatin1( "(.*)" ) ); + TQRegExp elementMatch( TQString::tqfromLatin1( "(.*)" ) ); elementMatch.setMinimal( true ); TQString document = _document; int pos; @@ -261,21 +261,21 @@ void XSLT::setXSLT( const TQString &_document ) { prependPercent = false; - if ( *it == TQString::fromLatin1( "TIME" ) ) + if ( *it == TQString::tqfromLatin1( "TIME" ) ) { - trans += TQString::fromLatin1( "" ); + trans += TQString::tqfromLatin1( "" ); } - else if ( *it == TQString::fromLatin1( "TIMESTAMP" ) ) + else if ( *it == TQString::tqfromLatin1( "TIMESTAMP" ) ) { - trans += TQString::fromLatin1( "" ); + trans += TQString::tqfromLatin1( "" ); } - else if ( *it == TQString::fromLatin1( "FORMATTEDTIMESTAMP" ) ) + else if ( *it == TQString::tqfromLatin1( "FORMATTEDTIMESTAMP" ) ) { - trans += TQString::fromLatin1( "" ); + trans += TQString::tqfromLatin1( "" ); } - else if ( *it == TQString::fromLatin1( "FROM_CONTACT_DISPLAYNAME" ) ) + else if ( *it == TQString::tqfromLatin1( "FROM_CONTACT_DISPLAYNAME" ) ) { - trans += TQString::fromLatin1( "" + trans += TQString::tqfromLatin1( "" "" "" "" @@ -290,9 +290,9 @@ void XSLT::setXSLT( const TQString &_document ) "" "" ); } - else if ( *it == TQString::fromLatin1( "TO_CONTACT_DISPLAYNAME" ) ) + else if ( *it == TQString::tqfromLatin1( "TO_CONTACT_DISPLAYNAME" ) ) { - trans += TQString::fromLatin1( "" + trans += TQString::tqfromLatin1( "" "" "" "" @@ -307,37 +307,37 @@ void XSLT::setXSLT( const TQString &_document ) "" "" ); } - else if ( *it == TQString::fromLatin1( "FROM_METACONTACT_DISPLAYNAME" ) ) + else if ( *it == TQString::tqfromLatin1( "FROM_METACONTACT_DISPLAYNAME" ) ) { - trans += TQString::fromLatin1( "" + trans += TQString::tqfromLatin1( "" "" "" "" "" ); } - else if ( *it == TQString::fromLatin1( "TO_METACONTACT_DISPLAYNAME" ) ) + else if ( *it == TQString::tqfromLatin1( "TO_METACONTACT_DISPLAYNAME" ) ) { - trans += TQString::fromLatin1( "" + trans += TQString::tqfromLatin1( "" "" "" "" "" ); } - else if ( *it == TQString::fromLatin1( "FROM_CONTACT_ID" ) ) + else if ( *it == TQString::tqfromLatin1( "FROM_CONTACT_ID" ) ) { - trans += TQString::fromLatin1( "" + trans += TQString::tqfromLatin1( "" "" "" ); } - else if ( *it == TQString::fromLatin1( "TO_CONTACT_ID" ) ) + else if ( *it == TQString::tqfromLatin1( "TO_CONTACT_ID" ) ) { - trans += TQString::fromLatin1( "" + trans += TQString::tqfromLatin1( "" "" "" ); } - else if ( *it == TQString::fromLatin1( "BODY" ) ) + else if ( *it == TQString::tqfromLatin1( "BODY" ) ) { - trans += TQString::fromLatin1( "" ); + trans += TQString::tqfromLatin1( "" ); } else { @@ -349,7 +349,7 @@ void XSLT::setXSLT( const TQString &_document ) } //kdDebug( 14010 ) << k_funcinfo << "Translated text: " << trans << endl; // Add "" and "" to length, hence the '+ 27' - document.replace( uint( pos ), orig.length() + 27, trans ); + document.tqreplace( uint( pos ), orig.length() + 27, trans ); } #ifdef RAWXSL @@ -379,7 +379,7 @@ void XSLT::setXSLT( const TQString &_document ) //We have a flag. Enable it; TQCString flagData( (const char*)child->content ); - if( flagData.contains( "Flag:" ) ) + if( flagData.tqcontains( "Flag:" ) ) { flags += flagData.mid(5); } @@ -387,7 +387,7 @@ void XSLT::setXSLT( const TQString &_document ) } if( !flags.isEmpty() ) - setProperty("flags", flags.join( TQString::fromLatin1("|") ) ); + setProperty("flags", flags.join( TQString::tqfromLatin1("|") ) ); } else { diff --git a/klinkstatus/src/utils/xsl.h b/klinkstatus/src/utils/xsl.h index 7fb6af70..93d6a74b 100644 --- a/klinkstatus/src/utils/xsl.h +++ b/klinkstatus/src/utils/xsl.h @@ -32,14 +32,15 @@ class XSLTPrivate; * This class provides an easy to use interface to basic * libxslt transformations. */ -class XSLT : public QObject +class XSLT : public TQObject { Q_OBJECT + TQ_OBJECT - Q_PROPERTY( Flags flags READ flags WRITE setFlags ) - Q_PROPERTY( bool isValid READ isValid ) + TQ_PROPERTY( Flags flags READ flagsProperty WRITE setFlagsProperty ) + TQ_PROPERTY( bool isValid READ isValid ) - Q_SETS( Flags ) + TQ_SETS( Flags ) public: /** @@ -56,7 +57,7 @@ public: * * Constructs a new XSLT parser using the provided XSLT document */ - XSLT( const TQString &xsltDocument, TQObject *parent = 0L ); + XSLT( const TQString &xsltDocument, TQObject *tqparent = 0L ); virtual ~XSLT(); @@ -104,6 +105,9 @@ public: */ void setFlags( unsigned int flags ); + inline XSLT::Flags flagsProperty() const { return (XSLT::Flags)flags(); } + inline void setFlagsProperty( XSLT::Flags newflags ) { setFlags((XSLT::Flags)newflags); } + private: XSLTPrivate *d; }; -- cgit v1.2.1