From 47c8a359c5276062c4bc17f0e82410f29081b502 Mon Sep 17 00:00:00 2001 From: tpearson Date: Sat, 31 Jul 2010 19:48:06 +0000 Subject: Trinity Qt initial conversion git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdenetwork@1157648 283d02a7-25f6-0310-bc7c-ecb5cbfe19da --- kopete/protocols/gadu/gadurichtextformat.cpp | 74 ++++++++++++++-------------- 1 file changed, 37 insertions(+), 37 deletions(-) (limited to 'kopete/protocols/gadu/gadurichtextformat.cpp') diff --git a/kopete/protocols/gadu/gadurichtextformat.cpp b/kopete/protocols/gadu/gadurichtextformat.cpp index 049d665b..fd567bf6 100644 --- a/kopete/protocols/gadu/gadurichtextformat.cpp +++ b/kopete/protocols/gadu/gadurichtextformat.cpp @@ -26,8 +26,8 @@ #include "gadurichtextformat.h" #include "gadusession.h" -#include -#include +#include +#include GaduRichTextFormat::GaduRichTextFormat() { @@ -38,9 +38,9 @@ GaduRichTextFormat::~GaduRichTextFormat() } QString -GaduRichTextFormat::convertToHtml( const QString& msg, unsigned int formats, void* formatStructure) +GaduRichTextFormat::convertToHtml( const TQString& msg, unsigned int formats, void* formatStructure) { - QString tmp, nb; + TQString tmp, nb; gg_msg_richtext_format *format; char *pointer = (char*) formatStructure; @@ -59,7 +59,7 @@ GaduRichTextFormat::convertToHtml( const QString& msg, unsigned int formats, voi format = (gg_msg_richtext_format*) pointer; unsigned int position = format->position; char font = format->font; - QString style; + TQString style; if ( position < j || position > msg.length() ) { break; @@ -100,9 +100,9 @@ GaduRichTextFormat::convertToHtml( const QString& msg, unsigned int formats, voi g = (int)color->green; b = (int)color->blue; } - style += QString(" color: rgb( %1, %2, %3 ); ").arg( r ).arg( g ).arg( b ); + style += TQString(" color: rgb( %1, %2, %3 ); ").arg( r ).arg( g ).arg( b ); - tmp += formatOpeningTag( QString::fromLatin1("span"), QString::fromLatin1("style=\"%1\"").arg( style ) ); + tmp += formatOpeningTag( TQString::fromLatin1("span"), TQString::fromLatin1("style=\"%1\"").arg( style ) ); opened = true; } @@ -122,16 +122,16 @@ GaduRichTextFormat::convertToHtml( const QString& msg, unsigned int formats, voi } QString -GaduRichTextFormat::formatOpeningTag( const QString& tag, const QString& attributes ) +GaduRichTextFormat::formatOpeningTag( const TQString& tag, const TQString& attributes ) { - QString res = "<" + tag; + TQString res = "<" + tag; if(!attributes.isEmpty()) res.append(" " + attributes); return res + ">"; } QString -GaduRichTextFormat::formatClosingTag( const QString& tag ) +GaduRichTextFormat::formatClosingTag( const TQString& tag ) { return ""; } @@ -140,18 +140,18 @@ GaduRichTextFormat::formatClosingTag( const QString& tag ) KGaduMessage* GaduRichTextFormat::convertToGaduMessage( const Kopete::Message& message ) { - QString htmlString = message.escapedBody(); + TQString htmlString = message.escapedBody(); KGaduMessage* output = new KGaduMessage; rtcs.blue = rtcs.green = rtcs.red = 0; - color = QColor(); + color = TQColor(); int position = 0; rtf.resize( sizeof( gg_msg_richtext) ); output->rtf.resize(0); // test first if there is any HTML formating in it - if( htmlString.find( QString::fromLatin1(" -1 ) { - QRegExp findTags( QString::fromLatin1("(.*)") ); + if( htmlString.find( TQString::fromLatin1(" -1 ) { + TQRegExp findTags( TQString::fromLatin1("(.*)") ); findTags.setMinimal( true ); int pos = 0; int lastpos = 0; @@ -160,7 +160,7 @@ GaduRichTextFormat::convertToGaduMessage( const Kopete::Message& message ) pos = findTags.search( htmlString ); rtfs.font = 0; if ( pos != lastpos ) { - QString tmp; + TQString tmp; if ( pos < 0 ) { tmp = htmlString.mid( lastpos ); } @@ -180,16 +180,16 @@ GaduRichTextFormat::convertToGaduMessage( const Kopete::Message& message ) } if ( pos > -1 ) { - QString styleHTML = findTags.cap(1); - QString replacement = findTags.cap(2); - QStringList styleAttrs = QStringList::split( ';', styleHTML ); + TQString styleHTML = findTags.cap(1); + TQString replacement = findTags.cap(2); + TQStringList styleAttrs = TQStringList::split( ';', styleHTML ); rtfs.font = 0; lastpos = pos + replacement.length(); - for( QStringList::Iterator attrPair = styleAttrs.begin(); attrPair != styleAttrs.end(); ++attrPair ) { - QString attribute = (*attrPair).section(':',0,0); - QString value = (*attrPair).section(':',1); + for( TQStringList::Iterator attrPair = styleAttrs.begin(); attrPair != styleAttrs.end(); ++attrPair ) { + TQString attribute = (*attrPair).section(':',0,0); + TQString value = (*attrPair).section(':',1); parseAttributes( attribute, value ); } @@ -198,7 +198,7 @@ GaduRichTextFormat::convertToGaduMessage( const Kopete::Message& message ) return NULL; } - QString rep = QString("%2" ).arg( styleHTML ).arg( replacement ); + TQString rep = TQString("%2" ).arg( styleHTML ).arg( replacement ); htmlString.replace( findTags.pos( 0 ), rep.length(), replacement ); replacement = unescapeGaduMessage( replacement ); @@ -224,35 +224,35 @@ GaduRichTextFormat::convertToGaduMessage( const Kopete::Message& message ) } void -GaduRichTextFormat::parseAttributes( const QString attribute, const QString value ) +GaduRichTextFormat::parseAttributes( const TQString attribute, const TQString value ) { - if( attribute == QString::fromLatin1("color") ) { + if( attribute == TQString::fromLatin1("color") ) { color.setNamedColor( value ); } - if( attribute == QString::fromLatin1("font-weight") && value == QString::fromLatin1("600") ) { + if( attribute == TQString::fromLatin1("font-weight") && value == TQString::fromLatin1("600") ) { rtfs.font |= GG_FONT_BOLD; } - if( attribute == QString::fromLatin1("text-decoration") && value == QString::fromLatin1("underline") ) { + if( attribute == TQString::fromLatin1("text-decoration") && value == TQString::fromLatin1("underline") ) { rtfs.font |= GG_FONT_UNDERLINE ; } - if( attribute == QString::fromLatin1("font-style") && value == QString::fromLatin1("italic") ) { + if( attribute == TQString::fromLatin1("font-style") && value == TQString::fromLatin1("italic") ) { rtfs.font |= GG_FONT_ITALIC; } } QString -GaduRichTextFormat::unescapeGaduMessage( QString& ns ) +GaduRichTextFormat::unescapeGaduMessage( TQString& ns ) { - QString s; + TQString s; s = Kopete::Message::unescape( ns ); - s.replace( QString::fromAscii( "\n" ), QString::fromAscii( "\r\n" ) ); + s.replace( TQString::fromAscii( "\n" ), TQString::fromAscii( "\r\n" ) ); return s; } bool GaduRichTextFormat::insertRtf( uint position) { - if ( color != QColor( rtcs.red, rtcs.green, rtcs.blue ) ) { + if ( color != TQColor( rtcs.red, rtcs.green, rtcs.blue ) ) { rtcs.red = color.red(); rtcs.green = color.green(); rtcs.blue = color.blue(); @@ -280,12 +280,12 @@ GaduRichTextFormat::insertRtf( uint position) } QString -GaduRichTextFormat::escapeBody( QString& input ) +GaduRichTextFormat::escapeBody( TQString& input ) { - input.replace( '<', QString::fromLatin1("<") ); - input.replace( '>', QString::fromLatin1(">") ); - input.replace( '\n', QString::fromLatin1( "
" ) ); - input.replace( '\t', QString::fromLatin1( "    " ) ); - input.replace( QRegExp( QString::fromLatin1( "\\s\\s" ) ), QString::fromLatin1( "  " ) ); + input.replace( '<', TQString::fromLatin1("<") ); + input.replace( '>', TQString::fromLatin1(">") ); + input.replace( '\n', TQString::fromLatin1( "
" ) ); + input.replace( '\t', TQString::fromLatin1( "    " ) ); + input.replace( TQRegExp( TQString::fromLatin1( "\\s\\s" ) ), TQString::fromLatin1( "  " ) ); return input; } -- cgit v1.2.1