diff options
Diffstat (limited to 'kopete/libkopete/kopetemessage.cpp')
-rw-r--r-- | kopete/libkopete/kopetemessage.cpp | 50 |
1 files changed, 25 insertions, 25 deletions
diff --git a/kopete/libkopete/kopetemessage.cpp b/kopete/libkopete/kopetemessage.cpp index db3b24ef..0dfedd69 100644 --- a/kopete/libkopete/kopetemessage.cpp +++ b/kopete/libkopete/kopetemessage.cpp @@ -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.tqreplace( TQRegExp( TQString::tqfromLatin1(".*<body[^>]*>(.*)</body>.*") ), TQString::tqfromLatin1("\\1") ); + body.replace( TQRegExp( TQString::tqfromLatin1(".*<body[^>]*>(.*)</body>.*") ), TQString::tqfromLatin1("\\1") ); //Strip <p> tags - body.tqreplace( TQString::tqfromLatin1("<p>"), TQString() ); + body.replace( TQString::tqfromLatin1("<p>"), TQString() ); //Replace </p> with a <br/> - body.tqreplace( TQString::tqfromLatin1("</p>"), TQString::tqfromLatin1("<br/>") ); + body.replace( TQString::tqfromLatin1("</p>"), TQString::tqfromLatin1("<br/>") ); //Remove trailing </br> if ( body.endsWith( TQString::tqfromLatin1("<br/>") ) ) body.truncate( body.length() - 5 ); body.remove( TQString::tqfromLatin1("\n") ); - body.tqreplace( TQRegExp( TQString::tqfromLatin1( "\\s\\s" ) ), TQString::tqfromLatin1( " " ) ); + body.replace( TQRegExp( TQString::tqfromLatin1( "\\s\\s" ) ), TQString::tqfromLatin1( " " ) ); } /* else if( f == ParsedHTML ) @@ -255,23 +255,23 @@ TQString Message::unescape( const TQString &xml ) data.simplifyWhiteSpace(); int pos; - while ( ( pos = data.tqfind( '<' ) ) != -1 ) + while ( ( pos = data.find( '<' ) ) != -1 ) { - int endPos = data.tqfind( '>', pos + 1 ); + int endPos = data.find( '>', 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.tqfind( ' ' ); + int elemEndPos = match.find( ' ' ); TQString elem = ( elemEndPos == -1 ? match.lower() : match.left( elemEndPos ).lower() ); if ( elem == TQString::tqfromLatin1( "img" ) ) { // Replace smileys with their original text' const TQString attrTitle = TQString::tqfromLatin1( "title=\"" ); - int titlePos = match.tqfind( attrTitle, elemEndPos ); - int titleEndPos = match.tqfind( '"', titlePos + attrTitle.length() ); + int titlePos = match.find( attrTitle, elemEndPos ); + int titleEndPos = match.find( '"', titlePos + attrTitle.length() ); if( titlePos == -1 || titleEndPos == -1 ) { // Not a smiley but a normal <img> @@ -282,7 +282,7 @@ TQString Message::unescape( const TQString &xml ) { TQString orig = match.mid( titlePos + attrTitle.length(), titleEndPos - titlePos - attrTitle.length() ); - data.tqreplace( pos, matchWidth, orig ); + data.replace( pos, matchWidth, orig ); pos += orig.length(); } } @@ -290,7 +290,7 @@ TQString Message::unescape( const TQString &xml ) elem == TQString::tqfromLatin1( "br" ) ) { // Replace paragraph, div and line breaks with a newline - data.tqreplace( pos, matchWidth, '\n' ); + data.replace( pos, matchWidth, '\n' ); pos++; } else @@ -302,12 +302,12 @@ TQString Message::unescape( const TQString &xml ) } // Replace stuff starting with '&' - data.tqreplace( TQString::tqfromLatin1( ">" ), TQString::tqfromLatin1( ">" ) ); - data.tqreplace( TQString::tqfromLatin1( "<" ), TQString::tqfromLatin1( "<" ) ); - data.tqreplace( TQString::tqfromLatin1( """ ), TQString::tqfromLatin1( "\"" ) ); - data.tqreplace( TQString::tqfromLatin1( " " ), TQString::tqfromLatin1( " " ) ); - data.tqreplace( TQString::tqfromLatin1( "&" ), TQString::tqfromLatin1( "&" ) ); - data.tqreplace( TQString::tqfromLatin1( " " ), TQString::tqfromLatin1( " " ) ); //this one is used in jabber: note, we should escape all &#xx; + data.replace( TQString::tqfromLatin1( ">" ), TQString::tqfromLatin1( ">" ) ); + data.replace( TQString::tqfromLatin1( "<" ), TQString::tqfromLatin1( "<" ) ); + data.replace( TQString::tqfromLatin1( """ ), TQString::tqfromLatin1( "\"" ) ); + data.replace( TQString::tqfromLatin1( " " ), TQString::tqfromLatin1( " " ) ); + data.replace( TQString::tqfromLatin1( "&" ), TQString::tqfromLatin1( "&" ) ); + data.replace( TQString::tqfromLatin1( " " ), 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.tqreplace( TQString::tqfromLatin1( "\n" ), TQString::tqfromLatin1( "<br />" ) ); + html.replace( TQString::tqfromLatin1( "\n" ), TQString::tqfromLatin1( "<br />" ) ); //Replace a tab with 4 spaces - html.tqreplace( TQString::tqfromLatin1( "\t" ), TQString::tqfromLatin1( " " ) ); + html.replace( TQString::tqfromLatin1( "\t" ), TQString::tqfromLatin1( " " ) ); //Replace multiple spaces with //do not replace every space so we break the linebreak - html.tqreplace( TQRegExp( TQString::tqfromLatin1( "\\s\\s" ) ), TQString::tqfromLatin1( " " ) ); + html.replace( TQRegExp( TQString::tqfromLatin1( "\\s\\s" ) ), TQString::tqfromLatin1( " " ) ); return html; } @@ -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.tqfind( TQChar('>') ); + int tagclose = curr.find( TQChar('>') ); // no >: the HTML is broken, but we can cope if ( tagclose == -1 ) continue; @@ -425,24 +425,24 @@ TQString Message::parseLinks( const TQString &message, MessageFormat format ) //Replace http/https/ftp links: // Replace (stuff)://[user:password@](linkstuff) with a link - result.tqreplace( + result.replace( 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.tqreplace( + result.replace( 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.tqreplace( + result.replace( 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 is included in the url. - result.tqreplace( TQRegExp( TQString::tqfromLatin1("(<a href=\"[^\"]+)( )(\")") ) , TQString::tqfromLatin1("\\1\\3") ); + result.replace( TQRegExp( TQString::tqfromLatin1("(<a href=\"[^\"]+)( )(\")") ) , TQString::tqfromLatin1("\\1\\3") ); return result; } |