summaryrefslogtreecommitdiffstats
path: root/kopete/protocols/gadu/gadurichtextformat.cpp
diff options
context:
space:
mode:
authortpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2010-07-31 19:48:06 +0000
committertpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2010-07-31 19:48:06 +0000
commit47c8a359c5276062c4bc17f0e82410f29081b502 (patch)
tree2d54a5f60a5b74067632f9ef6df58c2bc38155e6 /kopete/protocols/gadu/gadurichtextformat.cpp
parent6f82532777a35e0e60bbd2b290b2e93e646f349b (diff)
downloadtdenetwork-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/protocols/gadu/gadurichtextformat.cpp')
-rw-r--r--kopete/protocols/gadu/gadurichtextformat.cpp74
1 files changed, 37 insertions, 37 deletions
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 <qstring.h>
-#include <qregexp.h>
+#include <tqstring.h>
+#include <tqregexp.h>
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 "</" + tag + ">";
}
@@ -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("</span") ) > -1 ) {
- QRegExp findTags( QString::fromLatin1("<span style=\"(.*)\">(.*)</span>") );
+ if( htmlString.find( TQString::fromLatin1("</span") ) > -1 ) {
+ TQRegExp findTags( TQString::fromLatin1("<span style=\"(.*)\">(.*)</span>") );
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("<span style=\"%1\">%2</span>" ).arg( styleHTML ).arg( replacement );
+ TQString rep = TQString("<span style=\"%1\">%2</span>" ).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("&lt;") );
- input.replace( '>', QString::fromLatin1("&gt;") );
- input.replace( '\n', QString::fromLatin1( "<br />" ) );
- input.replace( '\t', QString::fromLatin1( "&nbsp;&nbsp;&nbsp;&nbsp;" ) );
- input.replace( QRegExp( QString::fromLatin1( "\\s\\s" ) ), QString::fromLatin1( " &nbsp;" ) );
+ input.replace( '<', TQString::fromLatin1("&lt;") );
+ input.replace( '>', TQString::fromLatin1("&gt;") );
+ input.replace( '\n', TQString::fromLatin1( "<br />" ) );
+ input.replace( '\t', TQString::fromLatin1( "&nbsp;&nbsp;&nbsp;&nbsp;" ) );
+ input.replace( TQRegExp( TQString::fromLatin1( "\\s\\s" ) ), TQString::fromLatin1( " &nbsp;" ) );
return input;
}