diff options
author | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2010-07-31 19:48:06 +0000 |
---|---|---|
committer | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2010-07-31 19:48:06 +0000 |
commit | 47c8a359c5276062c4bc17f0e82410f29081b502 (patch) | |
tree | 2d54a5f60a5b74067632f9ef6df58c2bc38155e6 /kopete/libkopete/kopetemessage.cpp | |
parent | 6f82532777a35e0e60bbd2b290b2e93e646f349b (diff) | |
download | tdenetwork-47c8a359c5276062c4bc17f0e82410f29081b502.tar.gz tdenetwork-47c8a359c5276062c4bc17f0e82410f29081b502.zip |
Trinity Qt initial conversion
git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdenetwork@1157648 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'kopete/libkopete/kopetemessage.cpp')
-rw-r--r-- | kopete/libkopete/kopetemessage.cpp | 262 |
1 files changed, 131 insertions, 131 deletions
diff --git a/kopete/libkopete/kopetemessage.cpp b/kopete/libkopete/kopetemessage.cpp index 54761799..6f223748 100644 --- a/kopete/libkopete/kopetemessage.cpp +++ b/kopete/libkopete/kopetemessage.cpp @@ -18,18 +18,18 @@ #include <stdlib.h> -#include <qcolor.h> -#include <qbuffer.h> -#include <qimage.h> -#include <qstylesheet.h> -#include <qregexp.h> -#include <qtextcodec.h> +#include <tqcolor.h> +#include <tqbuffer.h> +#include <tqimage.h> +#include <tqstylesheet.h> +#include <tqregexp.h> +#include <tqtextcodec.h> #include <kdebug.h> #include <klocale.h> #include <kiconloader.h> #include <kstringhandler.h> #include <kmdcodec.h> -#include <qguardedptr.h> +#include <tqguardedptr.h> #include "kopetemessage.h" #include "kopetemetacontact.h" @@ -46,81 +46,81 @@ class Message::Private : public KShared { public: - Private( const QDateTime &timeStamp, const Contact *from, const ContactPtrList &to, - const QString &subject, MessageDirection direction, - const QString &requestedPlugin, MessageType type ); + Private( const TQDateTime &timeStamp, const Contact *from, const ContactPtrList &to, + const TQString &subject, MessageDirection direction, + const TQString &requestedPlugin, MessageType type ); - QGuardedPtr<const Contact> from; + TQGuardedPtr<const Contact> from; ContactPtrList to; ChatSession *manager; MessageDirection direction; MessageFormat format; MessageType type; - QString requestedPlugin; + TQString requestedPlugin; MessageImportance importance; bool bgOverride; bool fgOverride; bool rtfOverride; bool isRightToLeft; - QDateTime timeStamp; - QFont font; + TQDateTime timeStamp; + TQFont font; - QColor fgColor; - QColor bgColor; - QString body; - QString subject; + TQColor fgColor; + TQColor bgColor; + TQString body; + TQString subject; }; -Message::Private::Private( const QDateTime &timeStamp, const Contact *from, - const ContactPtrList &to, const QString &subject, - MessageDirection direction, const QString &requestedPlugin, MessageType type ) +Message::Private::Private( const TQDateTime &timeStamp, const Contact *from, + const ContactPtrList &to, const TQString &subject, + MessageDirection direction, const TQString &requestedPlugin, MessageType type ) : from( from ), to( to ), manager( 0 ), direction( direction ), format( PlainText ), type( type ), requestedPlugin( requestedPlugin ), importance( (to.count() <= 1) ? Normal : Low ), bgOverride( false ), fgOverride( false ), rtfOverride( false ), isRightToLeft( false ), - timeStamp( timeStamp ), body( QString::null ), subject( subject ) + timeStamp( timeStamp ), body( TQString::null ), subject( subject ) { } Message::Message() -: d( new Private( QDateTime::currentDateTime(), 0L, QPtrList<Contact>(), QString::null, Internal, - QString::null, TypeNormal ) ) +: d( new Private( TQDateTime::currentDateTime(), 0L, TQPtrList<Contact>(), TQString::null, Internal, + TQString::null, TypeNormal ) ) { } -Message::Message( const Contact *fromKC, const QPtrList<Contact> &toKC, const QString &body, - MessageDirection direction, MessageFormat f, const QString &requestedPlugin, MessageType type ) -: d( new Private( QDateTime::currentDateTime(), fromKC, toKC, QString::null, direction, requestedPlugin, type ) ) +Message::Message( const Contact *fromKC, const TQPtrList<Contact> &toKC, const TQString &body, + MessageDirection direction, MessageFormat f, const TQString &requestedPlugin, MessageType type ) +: d( new Private( TQDateTime::currentDateTime(), fromKC, toKC, TQString::null, direction, requestedPlugin, type ) ) { doSetBody( body, f ); } -Message::Message( const Contact *fromKC, const Contact *toKC, const QString &body, - MessageDirection direction, MessageFormat f, const QString &requestedPlugin, MessageType type ) +Message::Message( const Contact *fromKC, const Contact *toKC, const TQString &body, + MessageDirection direction, MessageFormat f, const TQString &requestedPlugin, MessageType type ) { - QPtrList<Contact> to; + TQPtrList<Contact> to; to.append(toKC); - d = new Private( QDateTime::currentDateTime(), fromKC, to, QString::null, direction, requestedPlugin, type ); + d = new Private( TQDateTime::currentDateTime(), fromKC, to, TQString::null, direction, requestedPlugin, type ); doSetBody( body, f ); } -Message::Message( const Contact *fromKC, const QPtrList<Contact> &toKC, const QString &body, - const QString &subject, MessageDirection direction, MessageFormat f, const QString &requestedPlugin, MessageType type ) - : d( new Private( QDateTime::currentDateTime(), fromKC, toKC, subject, direction, requestedPlugin, type ) ) +Message::Message( const Contact *fromKC, const TQPtrList<Contact> &toKC, const TQString &body, + const TQString &subject, MessageDirection direction, MessageFormat f, const TQString &requestedPlugin, MessageType type ) + : d( new Private( TQDateTime::currentDateTime(), fromKC, toKC, subject, direction, requestedPlugin, type ) ) { doSetBody( body, f ); } -Message::Message( const QDateTime &timeStamp, const Contact *fromKC, const QPtrList<Contact> &toKC, - const QString &body, MessageDirection direction, MessageFormat f, const QString &requestedPlugin, MessageType type ) - : d( new Private( timeStamp, fromKC, toKC, QString::null, direction, requestedPlugin, type ) ) +Message::Message( const TQDateTime &timeStamp, const Contact *fromKC, const TQPtrList<Contact> &toKC, + const TQString &body, MessageDirection direction, MessageFormat f, const TQString &requestedPlugin, MessageType type ) + : d( new Private( timeStamp, fromKC, toKC, TQString::null, direction, requestedPlugin, type ) ) { doSetBody( body, f ); } -Message::Message( const QDateTime &timeStamp, const Contact *fromKC, const QPtrList<Contact> &toKC, - const QString &body, const QString &subject, MessageDirection direction, MessageFormat f, const QString &requestedPlugin, MessageType type ) +Message::Message( const TQDateTime &timeStamp, const Contact *fromKC, const TQPtrList<Contact> &toKC, + const TQString &body, const TQString &subject, MessageDirection direction, MessageFormat f, const TQString &requestedPlugin, MessageType type ) : d( new Private( timeStamp, fromKC, toKC, subject, direction, requestedPlugin, type ) ) { doSetBody( body, f ); @@ -172,47 +172,47 @@ void Message::setRtfOverride( bool enabled ) d->rtfOverride = enabled; } -void Message::setFg( const QColor &color ) +void Message::setFg( const TQColor &color ) { detach(); d->fgColor=color; } -void Message::setBg( const QColor &color ) +void Message::setBg( const TQColor &color ) { detach(); d->bgColor=color; } -void Message::setFont( const QFont &font ) +void Message::setFont( const TQFont &font ) { detach(); d->font = font; } -void Message::doSetBody( const QString &_body, Message::MessageFormat f ) +void Message::doSetBody( const TQString &_body, Message::MessageFormat f ) { - QString body = _body; + TQString body = _body; //TODO: move that in ChatTextEditPart::contents if( f == RichText ) { //This is coming from the RichTextEditor component. //Strip off the containing HTML document - body.replace( QRegExp( QString::fromLatin1(".*<body[^>]*>(.*)</body>.*") ), QString::fromLatin1("\\1") ); + body.replace( TQRegExp( TQString::fromLatin1(".*<body[^>]*>(.*)</body>.*") ), TQString::fromLatin1("\\1") ); //Strip <p> tags - body.replace( QString::fromLatin1("<p>"), QString::null ); + body.replace( TQString::fromLatin1("<p>"), TQString::null ); //Replace </p> with a <br/> - body.replace( QString::fromLatin1("</p>"), QString::fromLatin1("<br/>") ); + body.replace( TQString::fromLatin1("</p>"), TQString::fromLatin1("<br/>") ); //Remove trailing </br> - if ( body.endsWith( QString::fromLatin1("<br/>") ) ) + if ( body.endsWith( TQString::fromLatin1("<br/>") ) ) body.truncate( body.length() - 5 ); - body.remove( QString::fromLatin1("\n") ); - body.replace( QRegExp( QString::fromLatin1( "\\s\\s" ) ), QString::fromLatin1( " " ) ); + body.remove( TQString::fromLatin1("\n") ); + body.replace( TQRegExp( TQString::fromLatin1( "\\s\\s" ) ), TQString::fromLatin1( " " ) ); } /* else if( f == ParsedHTML ) @@ -229,7 +229,7 @@ void Message::doSetBody( const QString &_body, Message::MessageFormat f ) d->isRightToLeft = ( f & RichText ? unescape( d->body ).isRightToLeft() : d->body.isRightToLeft() ); } -void Message::setBody( const QString &body, MessageFormat f ) +void Message::setBody( const TQString &body, MessageFormat f ) { detach(); @@ -247,9 +247,9 @@ void Message::setImportance(Message::MessageImportance i) d->importance = i; } -QString Message::unescape( const QString &xml ) +TQString Message::unescape( const TQString &xml ) { - QString data = xml; + TQString data = xml; // Remove linebreak and multiple spaces. First return nbsp's to normal spaces :) data.simplifyWhiteSpace(); @@ -263,13 +263,13 @@ QString Message::unescape( const QString &xml ) // Take the part between < and >, and extract the element name from that int matchWidth = endPos - pos + 1; - QString match = data.mid( pos + 1, matchWidth - 2 ).simplifyWhiteSpace(); + TQString match = data.mid( pos + 1, matchWidth - 2 ).simplifyWhiteSpace(); int elemEndPos = match.find( ' ' ); - QString elem = ( elemEndPos == -1 ? match.lower() : match.left( elemEndPos ).lower() ); - if ( elem == QString::fromLatin1( "img" ) ) + TQString elem = ( elemEndPos == -1 ? match.lower() : match.left( elemEndPos ).lower() ); + if ( elem == TQString::fromLatin1( "img" ) ) { // Replace smileys with their original text' - const QString attrTitle = QString::fromLatin1( "title=\"" ); + const TQString attrTitle = TQString::fromLatin1( "title=\"" ); int titlePos = match.find( attrTitle, elemEndPos ); int titleEndPos = match.find( '"', titlePos + attrTitle.length() ); if( titlePos == -1 || titleEndPos == -1 ) @@ -280,14 +280,14 @@ QString Message::unescape( const QString &xml ) } else { - QString orig = match.mid( titlePos + attrTitle.length(), + TQString orig = match.mid( titlePos + attrTitle.length(), titleEndPos - titlePos - attrTitle.length() ); data.replace( pos, matchWidth, orig ); pos += orig.length(); } } - else if ( elem == QString::fromLatin1( "/p" ) || elem == QString::fromLatin1( "/div" ) || - elem == QString::fromLatin1( "br" ) ) + else if ( elem == TQString::fromLatin1( "/p" ) || elem == TQString::fromLatin1( "/div" ) || + elem == TQString::fromLatin1( "br" ) ) { // Replace paragraph, div and line breaks with a newline data.replace( pos, matchWidth, '\n' ); @@ -302,36 +302,36 @@ QString Message::unescape( const QString &xml ) } // Replace stuff starting with '&' - data.replace( QString::fromLatin1( ">" ), QString::fromLatin1( ">" ) ); - data.replace( QString::fromLatin1( "<" ), QString::fromLatin1( "<" ) ); - data.replace( QString::fromLatin1( """ ), QString::fromLatin1( "\"" ) ); - data.replace( QString::fromLatin1( " " ), QString::fromLatin1( " " ) ); - data.replace( QString::fromLatin1( "&" ), QString::fromLatin1( "&" ) ); - data.replace( QString::fromLatin1( " " ), QString::fromLatin1( " " ) ); //this one is used in jabber: note, we should escape all &#xx; + data.replace( TQString::fromLatin1( ">" ), TQString::fromLatin1( ">" ) ); + data.replace( TQString::fromLatin1( "<" ), TQString::fromLatin1( "<" ) ); + data.replace( TQString::fromLatin1( """ ), TQString::fromLatin1( "\"" ) ); + data.replace( TQString::fromLatin1( " " ), TQString::fromLatin1( " " ) ); + data.replace( TQString::fromLatin1( "&" ), TQString::fromLatin1( "&" ) ); + data.replace( TQString::fromLatin1( " " ), TQString::fromLatin1( " " ) ); //this one is used in jabber: note, we should escape all &#xx; return data; } -QString Message::escape( const QString &text ) +TQString Message::escape( const TQString &text ) { - QString html = QStyleSheet::escape( text ); + TQString html = TQStyleSheet::escape( text ); //Replace carriage returns inside the text - html.replace( QString::fromLatin1( "\n" ), QString::fromLatin1( "<br />" ) ); + html.replace( TQString::fromLatin1( "\n" ), TQString::fromLatin1( "<br />" ) ); //Replace a tab with 4 spaces - html.replace( QString::fromLatin1( "\t" ), QString::fromLatin1( " " ) ); + html.replace( TQString::fromLatin1( "\t" ), TQString::fromLatin1( " " ) ); //Replace multiple spaces with //do not replace every space so we break the linebreak - html.replace( QRegExp( QString::fromLatin1( "\\s\\s" ) ), QString::fromLatin1( " " ) ); + html.replace( TQRegExp( TQString::fromLatin1( "\\s\\s" ) ), TQString::fromLatin1( " " ) ); return html; } -QString Message::plainBody() const +TQString Message::plainBody() const { - QString body=d->body; + TQString body=d->body; if( d->format & RichText ) { body = unescape( body ); @@ -339,9 +339,9 @@ QString Message::plainBody() const return body; } -QString Message::escapedBody() const +TQString Message::escapedBody() const { - QString escapedBody=d->body; + TQString escapedBody=d->body; // kdDebug(14000) << k_funcinfo << escapedBody << " " << d->rtfOverride << endl; if( d->format & PlainText ) @@ -357,7 +357,7 @@ QString Message::escapedBody() const return escapedBody; } -QString Message::parsedBody() const +TQString Message::parsedBody() const { //kdDebug(14000) << k_funcinfo << "messageformat: " << d->format << endl; @@ -371,16 +371,16 @@ QString Message::parsedBody() const } } -static QString makeRegExp( const char *pattern ) +static TQString makeRegExp( const char *pattern ) { - const QString urlChar = QString::fromLatin1( "\\+\\-\\w\\./#@&;:=\\?~%_,\\!\\$\\*\\(\\)" ); - const QString boundaryStart = QString::fromLatin1( "(^|[^%1])(" ).arg( urlChar ); - const QString boundaryEnd = QString::fromLatin1( ")([^%1]|$)" ).arg( urlChar ); + const TQString urlChar = TQString::fromLatin1( "\\+\\-\\w\\./#@&;:=\\?~%_,\\!\\$\\*\\(\\)" ); + const TQString boundaryStart = TQString::fromLatin1( "(^|[^%1])(" ).arg( urlChar ); + const TQString boundaryEnd = TQString::fromLatin1( ")([^%1]|$)" ).arg( urlChar ); - return boundaryStart + QString::fromLatin1(pattern) + boundaryEnd; + return boundaryStart + TQString::fromLatin1(pattern) + boundaryEnd; } -QString Message::parseLinks( const QString &message, MessageFormat format ) +TQString Message::parseLinks( const TQString &message, MessageFormat format ) { if ( format == ParsedHTML ) return message; @@ -388,9 +388,9 @@ QString Message::parseLinks( const QString &message, MessageFormat format ) if ( format & RichText ) { // < in HTML *always* means start-of-tag - QStringList entries = QStringList::split( QChar('<'), message, true ); + TQStringList entries = TQStringList::split( TQChar('<'), message, true ); - QStringList::Iterator it = entries.begin(); + TQStringList::Iterator it = entries.begin(); // first one is different: it doesn't start with an HTML tag. if ( it != entries.end() ) @@ -401,55 +401,55 @@ QString Message::parseLinks( const QString &message, MessageFormat format ) for ( ; it != entries.end(); ++it ) { - QString curr = *it; + TQString curr = *it; // > in HTML means start-of-tag if and only if it's the first one after a < - int tagclose = curr.find( QChar('>') ); + int tagclose = curr.find( TQChar('>') ); // no >: the HTML is broken, but we can cope if ( tagclose == -1 ) continue; - QString tag = curr.left( tagclose + 1 ); - QString body = curr.mid( tagclose + 1 ); + TQString tag = curr.left( tagclose + 1 ); + TQString body = curr.mid( tagclose + 1 ); *it = tag + parseLinks( body, PlainText ); } - return entries.join(QString::fromLatin1("<")); + return entries.join(TQString::fromLatin1("<")); } - QString result = message; + TQString result = message; // common subpatterns - may not contain matching parens! - const QString name = QString::fromLatin1( "[\\w\\+\\-=_\\.]+" ); - const QString userAndPassword = QString::fromLatin1( "(?:%1(?::%1)?\\@)" ).arg( name ); - const QString urlChar = QString::fromLatin1( "\\+\\-\\w\\./#@&;:=\\?~%_,\\!\\$\\*\\(\\)" ); - const QString urlSection = QString::fromLatin1( "[%1]+" ).arg( urlChar ); - const QString domain = QString::fromLatin1( "[\\-\\w_]+(?:\\.[\\-\\w_]+)+" ); + const TQString name = TQString::fromLatin1( "[\\w\\+\\-=_\\.]+" ); + const TQString userAndPassword = TQString::fromLatin1( "(?:%1(?::%1)?\\@)" ).arg( name ); + const TQString urlChar = TQString::fromLatin1( "\\+\\-\\w\\./#@&;:=\\?~%_,\\!\\$\\*\\(\\)" ); + const TQString urlSection = TQString::fromLatin1( "[%1]+" ).arg( urlChar ); + const TQString domain = TQString::fromLatin1( "[\\-\\w_]+(?:\\.[\\-\\w_]+)+" ); //Replace http/https/ftp links: // Replace (stuff)://[user:password@](linkstuff) with a link result.replace( - QRegExp( makeRegExp("\\w+://%1?\\w%2").arg( userAndPassword, urlSection ) ), - QString::fromLatin1("\\1<a href=\"\\2\" title=\"\\2\">\\2</a>\\3" ) ); + TQRegExp( makeRegExp("\\w+://%1?\\w%2").arg( userAndPassword, urlSection ) ), + TQString::fromLatin1("\\1<a href=\"\\2\" title=\"\\2\">\\2</a>\\3" ) ); // Replace www.X.Y(linkstuff) with a http: link result.replace( - QRegExp( makeRegExp("%1?www\\.%2%3").arg( userAndPassword, domain, urlSection ) ), - QString::fromLatin1("\\1<a href=\"http://\\2\" title=\"http://\\2\">\\2</a>\\3" ) ); + TQRegExp( makeRegExp("%1?www\\.%2%3").arg( userAndPassword, domain, urlSection ) ), + TQString::fromLatin1("\\1<a href=\"http://\\2\" title=\"http://\\2\">\\2</a>\\3" ) ); //Replace Email Links // Replace user@domain with a mailto: link result.replace( - QRegExp( makeRegExp("%1@%2").arg( name, domain ) ), - QString::fromLatin1("\\1<a href=\"mailto:\\2\" title=\"mailto:\\2\">\\2</a>\\3") ); + TQRegExp( makeRegExp("%1@%2").arg( name, domain ) ), + TQString::fromLatin1("\\1<a href=\"mailto:\\2\" title=\"mailto:\\2\">\\2</a>\\3") ); //Workaround for Bug 85061: Highlighted URLs adds a ' ' after the URL itself // the trailing is included in the url. - result.replace( QRegExp( QString::fromLatin1("(<a href=\"[^\"]+)( )(\")") ) , QString::fromLatin1("\\1\\3") ); + result.replace( TQRegExp( TQString::fromLatin1("(<a href=\"[^\"]+)( )(\")") ) , TQString::fromLatin1("\\1\\3") ); return result; } -QDateTime Message::timestamp() const +TQDateTime Message::timestamp() const { return d->timeStamp; } @@ -459,7 +459,7 @@ const Contact *Message::from() const return d->from; } -QPtrList<Contact> Message::to() const +TQPtrList<Contact> Message::to() const { return d->to; } @@ -469,29 +469,29 @@ Message::MessageType Message::type() const return d->type; } -QString Message::requestedPlugin() const +TQString Message::requestedPlugin() const { return d->requestedPlugin; } -QColor Message::fg() const +TQColor Message::fg() const { return d->fgColor; } -QColor Message::bg() const +TQColor Message::bg() const { return d->bgColor; } -QFont Message::font() const +TQFont Message::font() const { - //QDomElement bodyNode = d->xmlDoc.elementsByTagName( QString::fromLatin1("body") ).item(0).toElement(); - //return QFont( bodyNode.attribute( QString::fromLatin1("font") ), bodyNode.attribute( QString::fromLatin1("fontsize") ).toInt() ); + //TQDomElement bodyNode = d->xmlDoc.elementsByTagName( TQString::fromLatin1("body") ).item(0).toElement(); + //return TQFont( bodyNode.attribute( TQString::fromLatin1("font") ), bodyNode.attribute( TQString::fromLatin1("fontsize") ).toInt() ); return d->font; } -QString Message::subject() const +TQString Message::subject() const { return d->subject; } @@ -522,47 +522,47 @@ void Message::setManager(ChatSession *kmm) d->manager=kmm; } -QString Message::getHtmlStyleAttribute() const +TQString Message::getHtmlStyleAttribute() const { - QString styleAttribute; + TQString styleAttribute; - styleAttribute = QString::fromUtf8("style=\""); + styleAttribute = TQString::fromUtf8("style=\""); // Affect foreground(color) and background color to message. if( !d->fgOverride && d->fgColor.isValid() ) { - styleAttribute += QString::fromUtf8("color: %1; ").arg(d->fgColor.name()); + styleAttribute += TQString::fromUtf8("color: %1; ").arg(d->fgColor.name()); } if( !d->bgOverride && d->bgColor.isValid() ) { - styleAttribute += QString::fromUtf8("background-color: %1; ").arg(d->bgColor.name()); + styleAttribute += TQString::fromUtf8("background-color: %1; ").arg(d->bgColor.name()); } // Affect font parameters. - if( !d->rtfOverride && d->font!=QFont() ) + if( !d->rtfOverride && d->font!=TQFont() ) { - QString fontstr; + TQString fontstr; if(!d->font.family().isNull()) - fontstr+=QString::fromLatin1("font-family: ")+d->font.family()+QString::fromLatin1("; "); + fontstr+=TQString::fromLatin1("font-family: ")+d->font.family()+TQString::fromLatin1("; "); if(d->font.italic()) - fontstr+=QString::fromLatin1("font-style: italic; "); + fontstr+=TQString::fromLatin1("font-style: italic; "); if(d->font.strikeOut()) - fontstr+=QString::fromLatin1("text-decoration: line-through; "); + fontstr+=TQString::fromLatin1("text-decoration: line-through; "); if(d->font.underline()) - fontstr+=QString::fromLatin1("text-decoration: underline; "); + fontstr+=TQString::fromLatin1("text-decoration: underline; "); if(d->font.bold()) - fontstr+=QString::fromLatin1("font-weight: bold;"); + fontstr+=TQString::fromLatin1("font-weight: bold;"); styleAttribute += fontstr; } - styleAttribute += QString::fromUtf8("\""); + styleAttribute += TQString::fromUtf8("\""); return styleAttribute; } // KDE4: Move that to a utils class/namespace -QString Message::decodeString( const QCString &message, const QTextCodec *providedCodec, bool *success ) +TQString Message::decodeString( const TQCString &message, const TQTextCodec *providedCodec, bool *success ) { /* Note to everyone. This function is not the most efficient, that is for sure. @@ -575,7 +575,7 @@ QString Message::decodeString( const QCString &message, const QTextCodec *provid // Avoid heavy codec tests on empty message. if( message.isEmpty() ) - return QString::fromAscii( message ); + return TQString::fromAscii( message ); //Check first 128 chars int charsToCheck = message.length(); @@ -592,11 +592,11 @@ QString Message::decodeString( const QCString &message, const QTextCodec *provid if( KStringHandler::isUtf8(message) ) { //We have a UTF string almost for sure. At least we know it will be decoded. - return QString::fromUtf8( message ); + return TQString::fromUtf8( message ); } //Try codecForContent - exact match - QTextCodec *testCodec = QTextCodec::codecForContent(message, charsToCheck); + TQTextCodec *testCodec = TQTextCodec::codecForContent(message, charsToCheck); if( testCodec && testCodec->heuristicContentMatch( message, charsToCheck ) >= 0 ) { //All chars decodable. @@ -610,7 +610,7 @@ QString Message::decodeString( const QCString &message, const QTextCodec *provid //We don't have any clues here. //Try local codec - testCodec = QTextCodec::codecForLocale(); + testCodec = TQTextCodec::codecForLocale(); if( testCodec && testCodec->heuristicContentMatch( message, charsToCheck ) >= 0 ) { //All chars decodable. @@ -619,7 +619,7 @@ QString Message::decodeString( const QCString &message, const QTextCodec *provid } //Try latin1 codec - testCodec = QTextCodec::codecForMib(4); + testCodec = TQTextCodec::codecForMib(4); if( testCodec && testCodec->heuristicContentMatch( message, charsToCheck ) >= 0 ) { //All chars decodable. @@ -629,7 +629,7 @@ QString Message::decodeString( const QCString &message, const QTextCodec *provid kdDebug(14000) << k_funcinfo << "Using latin1 and cleaning string" << endl; //No codec decoded. Just decode latin1, and clean out any junk. - QString result = QString::fromLatin1( message ); + TQString result = TQString::fromLatin1( message ); const uint length = message.length(); for( uint i = 0; i < length; ++i ) { |