From 7be55ffa061c026e35e2d6a0effe1161ddb0d41f Mon Sep 17 00:00:00 2001 From: tpearson Date: Sat, 31 Jul 2010 19:53:50 +0000 Subject: Trinity Qt initial conversion git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdepim@1157655 283d02a7-25f6-0310-bc7c-ecb5cbfe19da --- kmail/util.cpp | 50 +++++++++++++++++++++++++------------------------- 1 file changed, 25 insertions(+), 25 deletions(-) (limited to 'kmail/util.cpp') diff --git a/kmail/util.cpp b/kmail/util.cpp index 1c45d4456..5d7173d2c 100644 --- a/kmail/util.cpp +++ b/kmail/util.cpp @@ -38,7 +38,7 @@ #include "util.h" #include -#include +#include #include size_t KMail::Util::crlf2lf( char* str, const size_t strLen ) @@ -71,12 +71,12 @@ size_t KMail::Util::crlf2lf( char* str, const size_t strLen ) return target - str; } -QCString KMail::Util::lf2crlf( const QCString & src ) +TQCString KMail::Util::lf2crlf( const TQCString & src ) { - QCString result( 1 + 2*src.size() ); // maximal possible length + TQCString result( 1 + 2*src.size() ); // maximal possible length - QCString::ConstIterator s = src.begin(); - QCString::Iterator d = result.begin(); + TQCString::ConstIterator s = src.begin(); + TQCString::Iterator d = result.begin(); // we use cPrev to make sure we insert '\r' only there where it is missing char cPrev = '?'; while ( *s ) { @@ -89,14 +89,14 @@ QCString KMail::Util::lf2crlf( const QCString & src ) return result; } -QByteArray KMail::Util::lf2crlf( const QByteArray & src ) +TQByteArray KMail::Util::lf2crlf( const TQByteArray & src ) { const char* s = src.data(); if ( !s ) - return QByteArray(); + return TQByteArray(); - QByteArray result( 2 * src.size() ); // maximal possible length - QByteArray::Iterator d = result.begin(); + TQByteArray result( 2 * src.size() ); // maximal possible length + TQByteArray::Iterator d = result.begin(); // we use cPrev to make sure we insert '\r' only there where it is missing char cPrev = '?'; const char* end = src.end(); @@ -110,68 +110,68 @@ QByteArray KMail::Util::lf2crlf( const QByteArray & src ) return result; } -QCString KMail::Util::CString( const DwString& str ) +TQCString KMail::Util::CString( const DwString& str ) { const int strLen = str.size(); - QCString cstr( strLen + 1 ); + TQCString cstr( strLen + 1 ); memcpy( cstr.data(), str.data(), strLen ); cstr[ strLen ] = 0; return cstr; } -QByteArray KMail::Util::ByteArray( const DwString& str ) +TQByteArray KMail::Util::ByteArray( const DwString& str ) { const int strLen = str.size(); - QByteArray arr( strLen ); + TQByteArray arr( strLen ); memcpy( arr.data(), str.data(), strLen ); return arr; } -DwString KMail::Util::dwString( const QCString& str ) +DwString KMail::Util::dwString( const TQCString& str ) { if ( !str.data() ) // DwString doesn't like char*=0 return DwString(); return DwString( str.data(), str.size() - 1 ); } -DwString KMail::Util::dwString( const QByteArray& str ) +DwString KMail::Util::dwString( const TQByteArray& str ) { if ( !str.data() ) // DwString doesn't like char*=0 return DwString(); return DwString( str.data(), str.size() ); } -void KMail::Util::append( QByteArray& that, const QByteArray& str ) +void KMail::Util::append( TQByteArray& that, const TQByteArray& str ) { that.detach(); uint len1 = that.size(); uint len2 = str.size(); - if ( that.resize( len1 + len2, QByteArray::SpeedOptim ) ) + if ( that.resize( len1 + len2, TQByteArray::SpeedOptim ) ) memcpy( that.data() + len1, str.data(), len2 ); } -void KMail::Util::append( QByteArray& that, const char* str ) +void KMail::Util::append( TQByteArray& that, const char* str ) { if ( !str ) return; // nothing to append that.detach(); uint len1 = that.size(); uint len2 = qstrlen(str); - if ( that.resize( len1 + len2, QByteArray::SpeedOptim ) ) + if ( that.resize( len1 + len2, TQByteArray::SpeedOptim ) ) memcpy( that.data() + len1, str, len2 ); } -void KMail::Util::append( QByteArray& that, const QCString& str ) +void KMail::Util::append( TQByteArray& that, const TQCString& str ) { that.detach(); uint len1 = that.size(); uint len2 = str.size() - 1; - if ( that.resize( len1 + len2, QByteArray::SpeedOptim ) ) + if ( that.resize( len1 + len2, TQByteArray::SpeedOptim ) ) memcpy( that.data() + len1, str.data(), len2 ); } -// Code taken from QCString::insert, but trailing nul removed -void KMail::Util::insert( QByteArray& that, uint index, const char* s ) +// Code taken from TQCString::insert, but trailing nul removed +void KMail::Util::insert( TQByteArray& that, uint index, const char* s ) { int len = qstrlen(s); if ( len == 0 ) @@ -180,13 +180,13 @@ void KMail::Util::insert( QByteArray& that, uint index, const char* s ) int nlen = olen + len; if ( index >= olen ) { // insert after end of string that.detach(); - if ( that.resize(nlen+index-olen, QByteArray::SpeedOptim ) ) { + if ( that.resize(nlen+index-olen, TQByteArray::SpeedOptim ) ) { memset( that.data()+olen, ' ', index-olen ); memcpy( that.data()+index, s, len ); } } else { that.detach(); - if ( that.resize(nlen, QByteArray::SpeedOptim ) ) { // normal insert + if ( that.resize(nlen, TQByteArray::SpeedOptim ) ) { // normal insert memmove( that.data()+index+len, that.data()+index, olen-index ); memcpy( that.data()+index, s, len ); } -- cgit v1.2.1