diff options
Diffstat (limited to 'klinkstatus/src/utils')
-rw-r--r-- | klinkstatus/src/utils/utils.cpp | 12 | ||||
-rw-r--r-- | klinkstatus/src/utils/xsl.cpp | 66 | ||||
-rw-r--r-- | klinkstatus/src/utils/xsl.h | 14 |
3 files changed, 48 insertions, 44 deletions
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( "<div><b>KLinkStatus encountered the following error while parsing a message:</b><br />%1</div>" ).arg( errorMsg ); + resultString = i18n( "<div><b>KLinktqStatus encountered the following error while parsing a message:</b><br />%1</div>" ).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( "<kopete-i18n>(.*)</kopete-i18n>" ) ); + TQRegExp elementMatch( TQString::tqfromLatin1( "<kopete-i18n>(.*)</kopete-i18n>" ) ); 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( "<xsl:value-of select=\"@time\"/>" ); + trans += TQString::tqfromLatin1( "<xsl:value-of select=\"@time\"/>" ); } - else if ( *it == TQString::fromLatin1( "TIMESTAMP" ) ) + else if ( *it == TQString::tqfromLatin1( "TIMESTAMP" ) ) { - trans += TQString::fromLatin1( "<xsl:value-of select=\"@timestamp\"/>" ); + trans += TQString::tqfromLatin1( "<xsl:value-of select=\"@timestamp\"/>" ); } - else if ( *it == TQString::fromLatin1( "FORMATTEDTIMESTAMP" ) ) + else if ( *it == TQString::tqfromLatin1( "FORMATTEDTIMESTAMP" ) ) { - trans += TQString::fromLatin1( "<xsl:value-of select=\"@formattedTimestamp\"/>" ); + trans += TQString::tqfromLatin1( "<xsl:value-of select=\"@formattedTimestamp\"/>" ); } - else if ( *it == TQString::fromLatin1( "FROM_CONTACT_DISPLAYNAME" ) ) + else if ( *it == TQString::tqfromLatin1( "FROM_CONTACT_DISPLAYNAME" ) ) { - trans += TQString::fromLatin1( "<span><xsl:attribute name=\"title\">" + trans += TQString::tqfromLatin1( "<span><xsl:attribute name=\"title\">" "<xsl:choose>" "<xsl:when test='from/contact/@contactId=from/contact/contactDisplayName/@text'>" "<xsl:value-of disable-output-escaping=\"yes\" select=\"from/contact/metaContactDisplayName/@text\"/>" @@ -290,9 +290,9 @@ void XSLT::setXSLT( const TQString &_document ) "</xsl:attribute>" "<xsl:value-of disable-output-escaping=\"yes\" select=\"from/contact/contactDisplayName/@text\"/></span>" ); } - else if ( *it == TQString::fromLatin1( "TO_CONTACT_DISPLAYNAME" ) ) + else if ( *it == TQString::tqfromLatin1( "TO_CONTACT_DISPLAYNAME" ) ) { - trans += TQString::fromLatin1( "<span><xsl:attribute name=\"title\">" + trans += TQString::tqfromLatin1( "<span><xsl:attribute name=\"title\">" "<xsl:choose>" "<xsl:when test='to/contact/@contactId=from/contact/contactDisplayName/@text'>" "<xsl:value-of disable-output-escaping=\"yes\" select=\"to/contact/metaContactDisplayName/@text\"/>" @@ -307,37 +307,37 @@ void XSLT::setXSLT( const TQString &_document ) "</xsl:attribute>" "<xsl:value-of disable-output-escaping=\"yes\" select=\"to/contact/contactDisplayName/@text\"/></span>" ); } - else if ( *it == TQString::fromLatin1( "FROM_METACONTACT_DISPLAYNAME" ) ) + else if ( *it == TQString::tqfromLatin1( "FROM_METACONTACT_DISPLAYNAME" ) ) { - trans += TQString::fromLatin1( "<span>" + trans += TQString::tqfromLatin1( "<span>" "<xsl:attribute name=\"dir\">" "<xsl:value-of select=\"from/contact/metaContactDisplayName/@dir\"/>" "</xsl:attribute>" "<xsl:value-of disable-output-escaping=\"yes\" select=\"from/contact/metaContactDisplayName/@text\"/></span>" ); } - else if ( *it == TQString::fromLatin1( "TO_METACONTACT_DISPLAYNAME" ) ) + else if ( *it == TQString::tqfromLatin1( "TO_METACONTACT_DISPLAYNAME" ) ) { - trans += TQString::fromLatin1( "<span>" + trans += TQString::tqfromLatin1( "<span>" "<xsl:attribute name=\"dir\">" "<xsl:value-of select=\"to/contact/metaContactDisplayName/@dir\"/>" "</xsl:attribute>" "<xsl:value-of disable-output-escaping=\"yes\" select=\"to/contact/metaContactDisplayName/@text\"/></span>" ); } - else if ( *it == TQString::fromLatin1( "FROM_CONTACT_ID" ) ) + else if ( *it == TQString::tqfromLatin1( "FROM_CONTACT_ID" ) ) { - trans += TQString::fromLatin1( "<span><xsl:attribute name=\"title\">" + trans += TQString::tqfromLatin1( "<span><xsl:attribute name=\"title\">" "<xsl:value-of disable-output-escaping=\"yes\" select=\"from/contact/contactDisplayName/@text\"/></xsl:attribute>" "<xsl:value-of disable-output-escaping=\"yes\" select=\"from/contact/@contactId\"/></span>" ); } - else if ( *it == TQString::fromLatin1( "TO_CONTACT_ID" ) ) + else if ( *it == TQString::tqfromLatin1( "TO_CONTACT_ID" ) ) { - trans += TQString::fromLatin1( "<span><xsl:attribute name=\"title\">" + trans += TQString::tqfromLatin1( "<span><xsl:attribute name=\"title\">" "<xsl:value-of disable-output-escaping=\"yes\" select=\"to/contact/contactDisplayName/@text\"/></xsl:attribute>" "<xsl:value-of disable-output-escaping=\"yes\" select=\"to/contact/@contactId\"/></span>" ); } - else if ( *it == TQString::fromLatin1( "BODY" ) ) + else if ( *it == TQString::tqfromLatin1( "BODY" ) ) { - trans += TQString::fromLatin1( "<xsl:value-of disable-output-escaping=\"yes\" select=\"body\"/>" ); + trans += TQString::tqfromLatin1( "<xsl:value-of disable-output-escaping=\"yes\" select=\"body\"/>" ); } else { @@ -349,7 +349,7 @@ void XSLT::setXSLT( const TQString &_document ) } //kdDebug( 14010 ) << k_funcinfo << "Translated text: " << trans << endl; // Add "<kopete-i18n>" and "</kopete-i18n>" 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; }; |