summaryrefslogtreecommitdiffstats
path: root/kopete/libkopete/kopetemessage.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'kopete/libkopete/kopetemessage.cpp')
-rw-r--r--kopete/libkopete/kopetemessage.cpp128
1 files changed, 64 insertions, 64 deletions
diff --git a/kopete/libkopete/kopetemessage.cpp b/kopete/libkopete/kopetemessage.cpp
index 6f223748..db3b24ef 100644
--- a/kopete/libkopete/kopetemessage.cpp
+++ b/kopete/libkopete/kopetemessage.cpp
@@ -78,19 +78,19 @@ Message::Private::Private( const TQDateTime &timeStamp, const Contact *from,
: 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( TQString::null ), subject( subject )
+ timeStamp( timeStamp ), body( TQString() ), subject( subject )
{
}
Message::Message()
-: d( new Private( TQDateTime::currentDateTime(), 0L, TQPtrList<Contact>(), TQString::null, Internal,
- TQString::null, TypeNormal ) )
+: d( new Private( TQDateTime::tqcurrentDateTime(), 0L, TQPtrList<Contact>(), TQString(), Internal,
+ TQString(), TypeNormal ) )
{
}
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 ) )
+: d( new Private( TQDateTime::tqcurrentDateTime(), fromKC, toKC, TQString(), direction, requestedPlugin, type ) )
{
doSetBody( body, f );
}
@@ -100,20 +100,20 @@ Message::Message( const Contact *fromKC, const Contact *toKC, const TQString &bo
{
TQPtrList<Contact> to;
to.append(toKC);
- d = new Private( TQDateTime::currentDateTime(), fromKC, to, TQString::null, direction, requestedPlugin, type );
+ d = new Private( TQDateTime::tqcurrentDateTime(), fromKC, to, TQString(), direction, requestedPlugin, type );
doSetBody( body, f );
}
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 ) )
+ : d( new Private( TQDateTime::tqcurrentDateTime(), fromKC, toKC, subject, direction, requestedPlugin, type ) )
{
doSetBody( body, f );
}
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 ) )
+ : d( new Private( timeStamp, fromKC, toKC, TQString(), direction, requestedPlugin, type ) )
{
doSetBody( body, f );
}
@@ -199,20 +199,20 @@ void Message::doSetBody( const TQString &_body, Message::MessageFormat f )
{
//This is coming from the RichTextEditor component.
//Strip off the containing HTML document
- body.replace( TQRegExp( TQString::fromLatin1(".*<body[^>]*>(.*)</body>.*") ), TQString::fromLatin1("\\1") );
+ body.tqreplace( TQRegExp( TQString::tqfromLatin1(".*<body[^>]*>(.*)</body>.*") ), TQString::tqfromLatin1("\\1") );
//Strip <p> tags
- body.replace( TQString::fromLatin1("<p>"), TQString::null );
+ body.tqreplace( TQString::tqfromLatin1("<p>"), TQString() );
//Replace </p> with a <br/>
- body.replace( TQString::fromLatin1("</p>"), TQString::fromLatin1("<br/>") );
+ body.tqreplace( TQString::tqfromLatin1("</p>"), TQString::tqfromLatin1("<br/>") );
//Remove trailing </br>
- if ( body.endsWith( TQString::fromLatin1("<br/>") ) )
+ if ( body.endsWith( TQString::tqfromLatin1("<br/>") ) )
body.truncate( body.length() - 5 );
- body.remove( TQString::fromLatin1("\n") );
- body.replace( TQRegExp( TQString::fromLatin1( "\\s\\s" ) ), TQString::fromLatin1( " &nbsp;" ) );
+ body.remove( TQString::tqfromLatin1("\n") );
+ body.tqreplace( TQRegExp( TQString::tqfromLatin1( "\\s\\s" ) ), TQString::tqfromLatin1( " &nbsp;" ) );
}
/*
else if( f == ParsedHTML )
@@ -255,23 +255,23 @@ TQString Message::unescape( const TQString &xml )
data.simplifyWhiteSpace();
int pos;
- while ( ( pos = data.find( '<' ) ) != -1 )
+ while ( ( pos = data.tqfind( '<' ) ) != -1 )
{
- int endPos = data.find( '>', pos + 1 );
+ int endPos = data.tqfind( '>', pos + 1 );
if( endPos == -1 )
break; // No more complete elements left
// Take the part between < and >, and extract the element name from that
int matchWidth = endPos - pos + 1;
TQString match = data.mid( pos + 1, matchWidth - 2 ).simplifyWhiteSpace();
- int elemEndPos = match.find( ' ' );
+ int elemEndPos = match.tqfind( ' ' );
TQString elem = ( elemEndPos == -1 ? match.lower() : match.left( elemEndPos ).lower() );
- if ( elem == TQString::fromLatin1( "img" ) )
+ if ( elem == TQString::tqfromLatin1( "img" ) )
{
// Replace smileys with their original text'
- const TQString attrTitle = TQString::fromLatin1( "title=\"" );
- int titlePos = match.find( attrTitle, elemEndPos );
- int titleEndPos = match.find( '"', titlePos + attrTitle.length() );
+ const TQString attrTitle = TQString::tqfromLatin1( "title=\"" );
+ int titlePos = match.tqfind( attrTitle, elemEndPos );
+ int titleEndPos = match.tqfind( '"', titlePos + attrTitle.length() );
if( titlePos == -1 || titleEndPos == -1 )
{
// Not a smiley but a normal <img>
@@ -282,15 +282,15 @@ TQString Message::unescape( const TQString &xml )
{
TQString orig = match.mid( titlePos + attrTitle.length(),
titleEndPos - titlePos - attrTitle.length() );
- data.replace( pos, matchWidth, orig );
+ data.tqreplace( pos, matchWidth, orig );
pos += orig.length();
}
}
- else if ( elem == TQString::fromLatin1( "/p" ) || elem == TQString::fromLatin1( "/div" ) ||
- elem == TQString::fromLatin1( "br" ) )
+ else if ( elem == TQString::tqfromLatin1( "/p" ) || elem == TQString::tqfromLatin1( "/div" ) ||
+ elem == TQString::tqfromLatin1( "br" ) )
{
// Replace paragraph, div and line breaks with a newline
- data.replace( pos, matchWidth, '\n' );
+ data.tqreplace( pos, matchWidth, '\n' );
pos++;
}
else
@@ -302,12 +302,12 @@ TQString Message::unescape( const TQString &xml )
}
// Replace stuff starting with '&'
- data.replace( TQString::fromLatin1( "&gt;" ), TQString::fromLatin1( ">" ) );
- data.replace( TQString::fromLatin1( "&lt;" ), TQString::fromLatin1( "<" ) );
- data.replace( TQString::fromLatin1( "&quot;" ), TQString::fromLatin1( "\"" ) );
- data.replace( TQString::fromLatin1( "&nbsp;" ), TQString::fromLatin1( " " ) );
- data.replace( TQString::fromLatin1( "&amp;" ), TQString::fromLatin1( "&" ) );
- data.replace( TQString::fromLatin1( "&#160;" ), TQString::fromLatin1( " " ) ); //this one is used in jabber: note, we should escape all &#xx;
+ data.tqreplace( TQString::tqfromLatin1( "&gt;" ), TQString::tqfromLatin1( ">" ) );
+ data.tqreplace( TQString::tqfromLatin1( "&lt;" ), TQString::tqfromLatin1( "<" ) );
+ data.tqreplace( TQString::tqfromLatin1( "&quot;" ), TQString::tqfromLatin1( "\"" ) );
+ data.tqreplace( TQString::tqfromLatin1( "&nbsp;" ), TQString::tqfromLatin1( " " ) );
+ data.tqreplace( TQString::tqfromLatin1( "&amp;" ), TQString::tqfromLatin1( "&" ) );
+ data.tqreplace( TQString::tqfromLatin1( "&#160;" ), TQString::tqfromLatin1( " " ) ); //this one is used in jabber: note, we should escape all &#xx;
return data;
}
@@ -316,13 +316,13 @@ TQString Message::escape( const TQString &text )
{
TQString html = TQStyleSheet::escape( text );
//Replace carriage returns inside the text
- html.replace( TQString::fromLatin1( "\n" ), TQString::fromLatin1( "<br />" ) );
+ html.tqreplace( TQString::tqfromLatin1( "\n" ), TQString::tqfromLatin1( "<br />" ) );
//Replace a tab with 4 spaces
- html.replace( TQString::fromLatin1( "\t" ), TQString::fromLatin1( "&nbsp;&nbsp;&nbsp;&nbsp;" ) );
+ html.tqreplace( TQString::tqfromLatin1( "\t" ), TQString::tqfromLatin1( "&nbsp;&nbsp;&nbsp;&nbsp;" ) );
//Replace multiple spaces with &nbsp;
//do not replace every space so we break the linebreak
- html.replace( TQRegExp( TQString::fromLatin1( "\\s\\s" ) ), TQString::fromLatin1( "&nbsp; " ) );
+ html.tqreplace( TQRegExp( TQString::tqfromLatin1( "\\s\\s" ) ), TQString::tqfromLatin1( "&nbsp; " ) );
return html;
}
@@ -373,11 +373,11 @@ TQString Message::parsedBody() const
static TQString makeRegExp( const char *pattern )
{
- const TQString urlChar = TQString::fromLatin1( "\\+\\-\\w\\./#@&;:=\\?~%_,\\!\\$\\*\\(\\)" );
- const TQString boundaryStart = TQString::fromLatin1( "(^|[^%1])(" ).arg( urlChar );
- const TQString boundaryEnd = TQString::fromLatin1( ")([^%1]|$)" ).arg( urlChar );
+ const TQString urlChar = TQString::tqfromLatin1( "\\+\\-\\w\\./#@&;:=\\?~%_,\\!\\$\\*\\(\\)" );
+ const TQString boundaryStart = TQString::tqfromLatin1( "(^|[^%1])(" ).tqarg( urlChar );
+ const TQString boundaryEnd = TQString::tqfromLatin1( ")([^%1]|$)" ).tqarg( urlChar );
- return boundaryStart + TQString::fromLatin1(pattern) + boundaryEnd;
+ return boundaryStart + TQString::tqfromLatin1(pattern) + boundaryEnd;
}
TQString Message::parseLinks( const TQString &message, MessageFormat format )
@@ -403,7 +403,7 @@ TQString Message::parseLinks( const TQString &message, MessageFormat format )
{
TQString curr = *it;
// > in HTML means start-of-tag if and only if it's the first one after a <
- int tagclose = curr.find( TQChar('>') );
+ int tagclose = curr.tqfind( TQChar('>') );
// no >: the HTML is broken, but we can cope
if ( tagclose == -1 )
continue;
@@ -411,38 +411,38 @@ TQString Message::parseLinks( const TQString &message, MessageFormat format )
TQString body = curr.mid( tagclose + 1 );
*it = tag + parseLinks( body, PlainText );
}
- return entries.join(TQString::fromLatin1("<"));
+ return entries.join(TQString::tqfromLatin1("<"));
}
TQString result = message;
// common subpatterns - may not contain matching parens!
- 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_]+)+" );
+ const TQString name = TQString::tqfromLatin1( "[\\w\\+\\-=_\\.]+" );
+ const TQString userAndPassword = TQString::tqfromLatin1( "(?:%1(?::%1)?\\@)" ).tqarg( name );
+ const TQString urlChar = TQString::tqfromLatin1( "\\+\\-\\w\\./#@&;:=\\?~%_,\\!\\$\\*\\(\\)" );
+ const TQString urlSection = TQString::tqfromLatin1( "[%1]+" ).tqarg( urlChar );
+ const TQString domain = TQString::tqfromLatin1( "[\\-\\w_]+(?:\\.[\\-\\w_]+)+" );
//Replace http/https/ftp links:
// Replace (stuff)://[user:password@](linkstuff) with a link
- result.replace(
- TQRegExp( makeRegExp("\\w+://%1?\\w%2").arg( userAndPassword, urlSection ) ),
- TQString::fromLatin1("\\1<a href=\"\\2\" title=\"\\2\">\\2</a>\\3" ) );
+ result.tqreplace(
+ TQRegExp( makeRegExp("\\w+://%1?\\w%2").tqarg( userAndPassword, urlSection ) ),
+ TQString::tqfromLatin1("\\1<a href=\"\\2\" title=\"\\2\">\\2</a>\\3" ) );
// Replace www.X.Y(linkstuff) with a http: link
- result.replace(
- TQRegExp( makeRegExp("%1?www\\.%2%3").arg( userAndPassword, domain, urlSection ) ),
- TQString::fromLatin1("\\1<a href=\"http://\\2\" title=\"http://\\2\">\\2</a>\\3" ) );
+ result.tqreplace(
+ TQRegExp( makeRegExp("%1?www\\.%2%3").tqarg( userAndPassword, domain, urlSection ) ),
+ TQString::tqfromLatin1("\\1<a href=\"http://\\2\" title=\"http://\\2\">\\2</a>\\3" ) );
//Replace Email Links
// Replace user@domain with a mailto: link
- result.replace(
- TQRegExp( makeRegExp("%1@%2").arg( name, domain ) ),
- TQString::fromLatin1("\\1<a href=\"mailto:\\2\" title=\"mailto:\\2\">\\2</a>\\3") );
+ result.tqreplace(
+ TQRegExp( makeRegExp("%1@%2").tqarg( name, domain ) ),
+ TQString::tqfromLatin1("\\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 &nbsp; is included in the url.
- result.replace( TQRegExp( TQString::fromLatin1("(<a href=\"[^\"]+)(&nbsp;)(\")") ) , TQString::fromLatin1("\\1\\3") );
+ result.tqreplace( TQRegExp( TQString::tqfromLatin1("(<a href=\"[^\"]+)(&nbsp;)(\")") ) , TQString::tqfromLatin1("\\1\\3") );
return result;
}
@@ -486,8 +486,8 @@ TQColor Message::bg() const
TQFont Message::font() const
{
- //TQDomElement bodyNode = d->xmlDoc.elementsByTagName( TQString::fromLatin1("body") ).item(0).toElement();
- //return TQFont( bodyNode.attribute( TQString::fromLatin1("font") ), bodyNode.attribute( TQString::fromLatin1("fontsize") ).toInt() );
+ //TQDomElement bodyNode = d->xmlDoc.elementsByTagName( TQString::tqfromLatin1("body") ).item(0).toElement();
+ //return TQFont( bodyNode.attribute( TQString::tqfromLatin1("font") ), bodyNode.attribute( TQString::tqfromLatin1("fontsize") ).toInt() );
return d->font;
}
@@ -531,11 +531,11 @@ TQString Message::getHtmlStyleAttribute() const
// Affect foreground(color) and background color to message.
if( !d->fgOverride && d->fgColor.isValid() )
{
- styleAttribute += TQString::fromUtf8("color: %1; ").arg(d->fgColor.name());
+ styleAttribute += TQString::fromUtf8("color: %1; ").tqarg(d->fgColor.name());
}
if( !d->bgOverride && d->bgColor.isValid() )
{
- styleAttribute += TQString::fromUtf8("background-color: %1; ").arg(d->bgColor.name());
+ styleAttribute += TQString::fromUtf8("background-color: %1; ").tqarg(d->bgColor.name());
}
// Affect font parameters.
@@ -543,15 +543,15 @@ TQString Message::getHtmlStyleAttribute() const
{
TQString fontstr;
if(!d->font.family().isNull())
- fontstr+=TQString::fromLatin1("font-family: ")+d->font.family()+TQString::fromLatin1("; ");
+ fontstr+=TQString::tqfromLatin1("font-family: ")+d->font.family()+TQString::tqfromLatin1("; ");
if(d->font.italic())
- fontstr+=TQString::fromLatin1("font-style: italic; ");
+ fontstr+=TQString::tqfromLatin1("font-style: italic; ");
if(d->font.strikeOut())
- fontstr+=TQString::fromLatin1("text-decoration: line-through; ");
+ fontstr+=TQString::tqfromLatin1("text-decoration: line-through; ");
if(d->font.underline())
- fontstr+=TQString::fromLatin1("text-decoration: underline; ");
+ fontstr+=TQString::tqfromLatin1("text-decoration: underline; ");
if(d->font.bold())
- fontstr+=TQString::fromLatin1("font-weight: bold;");
+ fontstr+=TQString::tqfromLatin1("font-weight: bold;");
styleAttribute += fontstr;
}
@@ -629,7 +629,7 @@ TQString Message::decodeString( const TQCString &message, const TQTextCodec *pro
kdDebug(14000) << k_funcinfo << "Using latin1 and cleaning string" << endl;
//No codec decoded. Just decode latin1, and clean out any junk.
- TQString result = TQString::fromLatin1( message );
+ TQString result = TQString::tqfromLatin1( message );
const uint length = message.length();
for( uint i = 0; i < length; ++i )
{