diff options
author | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2010-07-31 19:54:04 +0000 |
---|---|---|
committer | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2010-07-31 19:54:04 +0000 |
commit | dc6b8e72fed2586239e3514819238c520636c9d9 (patch) | |
tree | 88b200df0a0b7fab9d6f147596173556f1ed9a13 /klinkstatus/src/utils | |
parent | 6927d4436e54551917f600b706a8d6109e49de1c (diff) | |
download | tdewebdev-dc6b8e72fed2586239e3514819238c520636c9d9.tar.gz tdewebdev-dc6b8e72fed2586239e3514819238c520636c9d9.zip |
Trinity Qt initial conversion
git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdewebdev@1157656 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'klinkstatus/src/utils')
-rw-r--r-- | klinkstatus/src/utils/utils.cpp | 18 | ||||
-rw-r--r-- | klinkstatus/src/utils/utils.h | 8 | ||||
-rw-r--r-- | klinkstatus/src/utils/xsl.cpp | 130 | ||||
-rw-r--r-- | klinkstatus/src/utils/xsl.h | 14 |
4 files changed, 85 insertions, 85 deletions
diff --git a/klinkstatus/src/utils/utils.cpp b/klinkstatus/src/utils/utils.cpp index 6259f8d0..25384b4b 100644 --- a/klinkstatus/src/utils/utils.cpp +++ b/klinkstatus/src/utils/utils.cpp @@ -20,15 +20,15 @@ #include "utils.h" -#include <qprocess.h> -#include <qwidget.h> +#include <tqprocess.h> +#include <tqwidget.h> #include <kapplication.h> #include <kmessagebox.h> #include <kdebug.h> -QString htmlDocCharset[NUMBER_OF_HTML_CODES][2] = { +TQString htmlDocCharset[NUMBER_OF_HTML_CODES][2] = { { "€", "@" }, { "	", "\t" }, @@ -129,7 +129,7 @@ QString htmlDocCharset[NUMBER_OF_HTML_CODES][2] = { }; -void decode(QString& url) +void decode(TQString& url) { if( (int)url.find('&') != -1) { @@ -184,18 +184,18 @@ int smallerUnsigned(int a, int b) namespace FileManager { -QString read(QString const& path) +TQString read(TQString const& path) { - QFile file(path); + TQFile file(path); if(!file.open(IO_ReadOnly)) { kdDebug() << "File " << path << " not found." << endl; - return QString(); + return TQString(); } - QTextStream stream(&file); - QString fileString = stream.read(); + TQTextStream stream(&file); + TQString fileString = stream.read(); file.close(); diff --git a/klinkstatus/src/utils/utils.h b/klinkstatus/src/utils/utils.h index 97d81ea0..f44d94c4 100644 --- a/klinkstatus/src/utils/utils.h +++ b/klinkstatus/src/utils/utils.h @@ -22,7 +22,7 @@ #define UTILS_H #include <kurl.h> -#include <qstring.h> +#include <tqstring.h> //#include <string> @@ -31,14 +31,14 @@ using namespace std; int const NUMBER_OF_HTML_CODES = 92; -extern QString htmlDocCharset[NUMBER_OF_HTML_CODES][2]; +extern TQString htmlDocCharset[NUMBER_OF_HTML_CODES][2]; /** Decode the html charset. e.g. decode("mail@server.org") => "mail@server.org" */ -void decode(QString& url); +void decode(TQString& url); //void decode(string& url); /** @@ -57,7 +57,7 @@ int smallerUnsigned(int a, int b); namespace FileManager { -QString read(QString const& path); +TQString read(TQString const& path); } diff --git a/klinkstatus/src/utils/xsl.cpp b/klinkstatus/src/utils/xsl.cpp index c3b13412..27f61cb8 100644 --- a/klinkstatus/src/utils/xsl.cpp +++ b/klinkstatus/src/utils/xsl.cpp @@ -33,12 +33,12 @@ // stdlib.h is required to build on Solaris #include <stdlib.h> -#include <qregexp.h> -#include <qsignal.h> -#include <qstylesheet.h> -#include <qthread.h> -#include <qevent.h> -#include <qmutex.h> +#include <tqregexp.h> +#include <tqsignal.h> +#include <tqstylesheet.h> +#include <tqthread.h> +#include <tqevent.h> +#include <tqmutex.h> #include <kapplication.h> #include <kdebug.h> @@ -51,7 +51,7 @@ * The thread class that actually performs the XSL processing. * Using a thread allows async operation. */ -class KopeteXSLThread : public QObject, public QThread +class KopeteXSLThread : public TQObject, public QThread { public: /** @@ -62,36 +62,36 @@ public: * @param target Target object to connect to for async operation * @param slotCompleted Slot to fire on completion in asnc operation */ - KopeteXSLThread( const QString &xmlString, xsltStylesheetPtr xslDoc, QObject *target = 0L, const char *slotCompleted = 0L ); + KopeteXSLThread( const TQString &xmlString, xsltStylesheetPtr xslDoc, TQObject *target = 0L, const char *slotCompleted = 0L ); /** - * Reimplemented from QThread. Does the processing. + * Reimplemented from TQThread. Does the processing. */ virtual void run(); /** * A user event is used to get back to the UI thread to emit the completed signal */ - bool event( QEvent *event ); + bool event( TQEvent *event ); - static QString xsltTransform( const QString &xmlString, xsltStylesheetPtr xslDoc ); + static TQString xsltTransform( const TQString &xmlString, xsltStylesheetPtr xslDoc ); /** * Returns the result string */ - const QString &result() + const TQString &result() { return m_resultString; }; private: - QString m_xml; + TQString m_xml; xsltStylesheetPtr m_xsl; - QString m_resultString; - QObject *m_target; + TQString m_resultString; + TQObject *m_target; const char *m_slotCompleted; - QMutex dataMutex; + TQMutex dataMutex; }; -KopeteXSLThread::KopeteXSLThread( const QString &xmlString, xsltStylesheetPtr xslDoc, QObject *target, const char *slotCompleted ) +KopeteXSLThread::KopeteXSLThread( const TQString &xmlString, xsltStylesheetPtr xslDoc, TQObject *target, const char *slotCompleted ) { m_xml = xmlString; m_xsl = xslDoc; @@ -106,17 +106,17 @@ void KopeteXSLThread::run() m_resultString = xsltTransform( m_xml, m_xsl ); dataMutex.unlock(); // get back to the main thread - qApp->postEvent( this, new QEvent( QEvent::User ) ); + qApp->postEvent( this, new TQEvent( TQEvent::User ) ); } -bool KopeteXSLThread::event( QEvent *event ) +bool KopeteXSLThread::event( TQEvent *event ) { - if ( event->type() == QEvent::User ) + if ( event->type() == TQEvent::User ) { dataMutex.lock(); if( m_target && m_slotCompleted ) { - QSignal completeSignal( m_target ); + TQSignal completeSignal( m_target ); completeSignal.connect( m_target, m_slotCompleted ); completeSignal.setValue( m_resultString ); completeSignal.activate(); @@ -125,23 +125,23 @@ bool KopeteXSLThread::event( QEvent *event ) delete this; return true; } - return QObject::event( event ); + return TQObject::event( event ); } -QString KopeteXSLThread::xsltTransform( const QString &xmlString, xsltStylesheetPtr styleSheet ) +TQString KopeteXSLThread::xsltTransform( const TQString &xmlString, xsltStylesheetPtr styleSheet ) { - // Convert QString into a C string - QCString xmlCString = xmlString.utf8(); + // Convert TQString into a C string + TQCString xmlCString = xmlString.utf8(); - QString resultString; - QString errorMsg; + TQString resultString; + TQString errorMsg; xmlDocPtr xmlDoc = xmlParseMemory( xmlCString, xmlCString.length() ); if ( xmlDoc ) { if ( styleSheet ) { - static QCString appPath( QString::fromLatin1("\"%1\"").arg( KApplication::kApplication()->dirs()->findDirs("appdata", QString::fromLatin1("styles/data") ).front() ).utf8() ); + static TQCString appPath( TQString::fromLatin1("\"%1\"").arg( KApplication::kApplication()->dirs()->findDirs("appdata", TQString::fromLatin1("styles/data") ).front() ).utf8() ); static const char* params[3] = { "appdata", @@ -156,7 +156,7 @@ QString KopeteXSLThread::xsltTransform( const QString &xmlString, xsltStylesheet xmlChar *mem; int size; xmlDocDumpMemory( resultDoc, &mem, &size ); - resultString = QString::fromUtf8( QCString( ( char * )( mem ), size + 1 ) ); + resultString = TQString::fromUtf8( TQCString( ( char * )( mem ), size + 1 ) ); xmlFree( mem ); xmlFreeDoc( resultDoc ); } @@ -196,8 +196,8 @@ public: unsigned int flags; }; -XSLT::XSLT( const QString &document, QObject *parent ) - : QObject( parent ), d(new XSLTPrivate) +XSLT::XSLT( const TQString &document, TQObject *parent ) + : TQObject( parent ), d(new XSLTPrivate) { d->flags = 0; d->xslDoc = 0; @@ -217,12 +217,12 @@ XSLT::~XSLT() delete d; } -void XSLT::setXSLT( const QString &_document ) +void XSLT::setXSLT( const TQString &_document ) { // Search for '<kopete-i18n>' elements and feed them through i18n(). // After that replace the %VAR% variables with their proper XSLT counterpart. // - // FIXME: Preprocessing the document using the QString API is fast and simple, + // FIXME: Preprocessing the document using the TQString API is fast and simple, // but also error-sensitive. // In fact, there are a couple of known issues with this algorithm that // depend on the strings in the current styles. If these strings change @@ -235,47 +235,47 @@ void XSLT::setXSLT( const QString &_document ) // Actually, since we need to parse into a libxml2 document anyway, this whole // nonsense could be replaced with some simple XPath expressions - JK // - QRegExp elementMatch( QString::fromLatin1( "<kopete-i18n>(.*)</kopete-i18n>" ) ); + TQRegExp elementMatch( TQString::fromLatin1( "<kopete-i18n>(.*)</kopete-i18n>" ) ); elementMatch.setMinimal( true ); - QString document = _document; + TQString document = _document; int pos; while ( ( pos = elementMatch.search( document ) ) != -1 ) { - QString orig = elementMatch.cap( 1 ); + TQString orig = elementMatch.cap( 1 ); //kdDebug( 14010 ) << k_funcinfo << "Original text: " << orig << endl; // Split on % and go over all parts // WARNING: If you change the translator comment, also change it in the // styles/extracti18n Perl script, because the strings have to be // identical! - QStringList parts = QStringList::split( '%', i18n( + TQStringList parts = TQStringList::split( '%', i18n( "Translators: The %FOO% placeholders are variables that are substituted " "in the code, please leave them untranslated", orig.utf8() ), true ); // The first part is always text, as our variables are written like %FOO% - QStringList::Iterator it = parts.begin(); - QString trans = *it; + TQStringList::Iterator it = parts.begin(); + TQString trans = *it; bool prependPercent = true; it = parts.remove( it ); for ( it = parts.begin(); it != parts.end(); ++it ) { prependPercent = false; - if ( *it == QString::fromLatin1( "TIME" ) ) + if ( *it == TQString::fromLatin1( "TIME" ) ) { - trans += QString::fromLatin1( "<xsl:value-of select=\"@time\"/>" ); + trans += TQString::fromLatin1( "<xsl:value-of select=\"@time\"/>" ); } - else if ( *it == QString::fromLatin1( "TIMESTAMP" ) ) + else if ( *it == TQString::fromLatin1( "TIMESTAMP" ) ) { - trans += QString::fromLatin1( "<xsl:value-of select=\"@timestamp\"/>" ); + trans += TQString::fromLatin1( "<xsl:value-of select=\"@timestamp\"/>" ); } - else if ( *it == QString::fromLatin1( "FORMATTEDTIMESTAMP" ) ) + else if ( *it == TQString::fromLatin1( "FORMATTEDTIMESTAMP" ) ) { - trans += QString::fromLatin1( "<xsl:value-of select=\"@formattedTimestamp\"/>" ); + trans += TQString::fromLatin1( "<xsl:value-of select=\"@formattedTimestamp\"/>" ); } - else if ( *it == QString::fromLatin1( "FROM_CONTACT_DISPLAYNAME" ) ) + else if ( *it == TQString::fromLatin1( "FROM_CONTACT_DISPLAYNAME" ) ) { - trans += QString::fromLatin1( "<span><xsl:attribute name=\"title\">" + trans += TQString::fromLatin1( "<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 QString &_document ) "</xsl:attribute>" "<xsl:value-of disable-output-escaping=\"yes\" select=\"from/contact/contactDisplayName/@text\"/></span>" ); } - else if ( *it == QString::fromLatin1( "TO_CONTACT_DISPLAYNAME" ) ) + else if ( *it == TQString::fromLatin1( "TO_CONTACT_DISPLAYNAME" ) ) { - trans += QString::fromLatin1( "<span><xsl:attribute name=\"title\">" + trans += TQString::fromLatin1( "<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 QString &_document ) "</xsl:attribute>" "<xsl:value-of disable-output-escaping=\"yes\" select=\"to/contact/contactDisplayName/@text\"/></span>" ); } - else if ( *it == QString::fromLatin1( "FROM_METACONTACT_DISPLAYNAME" ) ) + else if ( *it == TQString::fromLatin1( "FROM_METACONTACT_DISPLAYNAME" ) ) { - trans += QString::fromLatin1( "<span>" + trans += TQString::fromLatin1( "<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 == QString::fromLatin1( "TO_METACONTACT_DISPLAYNAME" ) ) + else if ( *it == TQString::fromLatin1( "TO_METACONTACT_DISPLAYNAME" ) ) { - trans += QString::fromLatin1( "<span>" + trans += TQString::fromLatin1( "<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 == QString::fromLatin1( "FROM_CONTACT_ID" ) ) + else if ( *it == TQString::fromLatin1( "FROM_CONTACT_ID" ) ) { - trans += QString::fromLatin1( "<span><xsl:attribute name=\"title\">" + trans += TQString::fromLatin1( "<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 == QString::fromLatin1( "TO_CONTACT_ID" ) ) + else if ( *it == TQString::fromLatin1( "TO_CONTACT_ID" ) ) { - trans += QString::fromLatin1( "<span><xsl:attribute name=\"title\">" + trans += TQString::fromLatin1( "<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 == QString::fromLatin1( "BODY" ) ) + else if ( *it == TQString::fromLatin1( "BODY" ) ) { - trans += QString::fromLatin1( "<xsl:value-of disable-output-escaping=\"yes\" select=\"body\"/>" ); + trans += TQString::fromLatin1( "<xsl:value-of disable-output-escaping=\"yes\" select=\"body\"/>" ); } else { @@ -362,7 +362,7 @@ void XSLT::setXSLT( const QString &_document ) d->xslDoc = 0; d->flags = 0; - QCString rawDocument = document.utf8(); + TQCString rawDocument = document.utf8(); d->xslDoc = xmlParseMemory( rawDocument, rawDocument.length() ); if( d->xslDoc ) @@ -371,13 +371,13 @@ void XSLT::setXSLT( const QString &_document ) if( d->styleSheet ) { // Check for flags - QStringList flags; + TQStringList flags; for( xmlNodePtr child = d->xslDoc->children; child != d->xslDoc->last; child = child->next ) { if( child->type == XML_PI_NODE ) { //We have a flag. Enable it; - QCString flagData( (const char*)child->content ); + TQCString flagData( (const char*)child->content ); if( flagData.contains( "Flag:" ) ) { @@ -387,7 +387,7 @@ void XSLT::setXSLT( const QString &_document ) } if( !flags.isEmpty() ) - setProperty("flags", flags.join( QString::fromLatin1("|") ) ); + setProperty("flags", flags.join( TQString::fromLatin1("|") ) ); } else { @@ -406,12 +406,12 @@ void XSLT::setXSLT( const QString &_document ) } } -QString XSLT::transform( const QString &xmlString ) +TQString XSLT::transform( const TQString &xmlString ) { return KopeteXSLThread::xsltTransform( xmlString, d->styleSheet ); } -void XSLT::transformAsync( const QString &xmlString, QObject *target, const char *slotCompleted ) +void XSLT::transformAsync( const TQString &xmlString, TQObject *target, const char *slotCompleted ) { ( new KopeteXSLThread( xmlString, d->styleSheet, target, slotCompleted ) )->start(); } diff --git a/klinkstatus/src/utils/xsl.h b/klinkstatus/src/utils/xsl.h index 9d12c1c1..7fb6af70 100644 --- a/klinkstatus/src/utils/xsl.h +++ b/klinkstatus/src/utils/xsl.h @@ -20,7 +20,7 @@ #ifndef XSL_H #define XSL_H -#include <qobject.h> +#include <tqobject.h> class XSLTPrivate; @@ -56,7 +56,7 @@ public: * * Constructs a new XSLT parser using the provided XSLT document */ - XSLT( const QString &xsltDocument, QObject *parent = 0L ); + XSLT( const TQString &xsltDocument, TQObject *parent = 0L ); virtual ~XSLT(); @@ -65,7 +65,7 @@ public: * * @return an ORed set of @ref Flags, or 0 if none */ - void setXSLT( const QString &document ); + void setXSLT( const TQString &document ); /** * Transforms the XML string using the XSLT document, synchronously @@ -73,17 +73,17 @@ public: * @param xmlString The source XML * @return The result of the transformation */ - QString transform( const QString &xmlString ); + TQString transform( const TQString &xmlString ); /** * Transforms the XML string using the XSLT document, asynchronously * * @param xmlString The source XML - * @param target The QObject that contains the slot to be executed when processing is complete - * @param slotCompleted A slot that accepts a QVariant & paramater, that is the result + * @param target The TQObject that contains the slot to be executed when processing is complete + * @param slotCompleted A slot that accepts a TQVariant & paramater, that is the result * of the transformation */ - void transformAsync( const QString &xmlString, QObject *target, const char *slotCompleted ); + void transformAsync( const TQString &xmlString, TQObject *target, const char *slotCompleted ); /** * Check whether the XSLT document is valid |