diff options
author | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2010-07-31 19:53:50 +0000 |
---|---|---|
committer | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2010-07-31 19:53:50 +0000 |
commit | 7be55ffa061c026e35e2d6a0effe1161ddb0d41f (patch) | |
tree | 8474f9b444b2756228600050f07a7ff25de532b2 /kmail/kmmsgpart.cpp | |
parent | f587f20a6d09f1729dd0a8c1cd8ee0110aec7451 (diff) | |
download | tdepim-7be55ffa061c026e35e2d6a0effe1161ddb0d41f.tar.gz tdepim-7be55ffa061c026e35e2d6a0effe1161ddb0d41f.zip |
Trinity Qt initial conversion
git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdepim@1157655 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'kmail/kmmsgpart.cpp')
-rw-r--r-- | kmail/kmmsgpart.cpp | 132 |
1 files changed, 66 insertions, 66 deletions
diff --git a/kmail/kmmsgpart.cpp b/kmail/kmmsgpart.cpp index 48dc55ca8..085e36c0f 100644 --- a/kmail/kmmsgpart.cpp +++ b/kmail/kmmsgpart.cpp @@ -20,7 +20,7 @@ #include <mimelib/string.h> #include <kiconloader.h> -#include <qtextcodec.h> +#include <tqtextcodec.h> #include <assert.h> @@ -34,7 +34,7 @@ KMMessagePart::KMMessagePart() } //----------------------------------------------------------------------------- -KMMessagePart::KMMessagePart( QDataStream & stream ) +KMMessagePart::KMMessagePart( TQDataStream & stream ) : mParent(0), mLoadHeaders(false), mLoadPart(false) { unsigned long size; @@ -62,19 +62,19 @@ KMMessagePart::~KMMessagePart() //----------------------------------------------------------------------------- void KMMessagePart::clear() { - mOriginalContentTypeStr = QCString(); + mOriginalContentTypeStr = TQCString(); mType = "text"; mSubtype = "plain"; mCte = "7bit"; - mContentDescription = QCString(); - mContentDisposition = QCString(); + mContentDescription = TQCString(); + mContentDisposition = TQCString(); mBody.truncate( 0 ); - mAdditionalCTypeParamStr = QCString(); - mName = QString::null; - mParameterAttribute = QCString(); - mParameterValue = QString::null; - mCharset = QCString(); - mPartSpecifier = QString::null; + mAdditionalCTypeParamStr = TQCString(); + mName = TQString::null; + mParameterAttribute = TQCString(); + mParameterValue = TQString::null; + mCharset = TQCString(); + mPartSpecifier = TQString::null; mBodyDecodedSize = 0; mParent = 0; mLoadHeaders = false; @@ -101,7 +101,7 @@ int KMMessagePart::decodedSize(void) const //----------------------------------------------------------------------------- -void KMMessagePart::setBody(const QCString &aStr) +void KMMessagePart::setBody(const TQCString &aStr) { KMail::Util::setFromQCString( mBody, aStr ); @@ -123,7 +123,7 @@ void KMMessagePart::setBody(const DwString &aStr) mBodyDecodedSize = -1; // Can't know the decoded size } -void KMMessagePart::setBody(const QByteArray &aStr) +void KMMessagePart::setBody(const TQByteArray &aStr) { mBody = aStr; @@ -134,19 +134,19 @@ void KMMessagePart::setBody(const QByteArray &aStr) mBodyDecodedSize = -1; // Can't know the decoded size } -void KMMessagePart::setBodyFromUnicode( const QString & str ) { - QCString encoding = KMMsgBase::autoDetectCharset( charset(), KMMessage::preferredCharsets(), str ); +void KMMessagePart::setBodyFromUnicode( const TQString & str ) { + TQCString encoding = KMMsgBase::autoDetectCharset( charset(), KMMessage::preferredCharsets(), str ); if ( encoding.isEmpty() ) encoding = "utf-8"; - const QTextCodec * codec = KMMsgBase::codecForName( encoding ); + const TQTextCodec * codec = KMMsgBase::codecForName( encoding ); assert( codec ); - QValueList<int> dummy; + TQValueList<int> dummy; setCharset( encoding ); setBodyAndGuessCte( codec->fromUnicode( str ), dummy, false /* no 8bit */ ); } -const QTextCodec * KMMessagePart::codec() const { - const QTextCodec * c = KMMsgBase::codecForName( charset() ); +const TQTextCodec * KMMessagePart::codec() const { + const TQTextCodec * c = KMMsgBase::codecForName( charset() ); if ( !c ) { // Ok, no override and nothing in the message, let's use the fallback @@ -161,7 +161,7 @@ const QTextCodec * KMMessagePart::codec() const { return c; } -QString KMMessagePart::bodyToUnicode(const QTextCodec* codec) const { +TQString KMMessagePart::bodyToUnicode(const TQTextCodec* codec) const { if ( !codec ) // No codec was given, so try the charset in the mail codec = this->codec(); @@ -170,7 +170,7 @@ QString KMMessagePart::bodyToUnicode(const QTextCodec* codec) const { return codec->toUnicode( bodyDecoded() ); } -void KMMessagePart::setCharset( const QCString & c ) { +void KMMessagePart::setCharset( const TQCString & c ) { if ( type() != DwMime::kTypeText ) kdWarning() << "KMMessagePart::setCharset(): trying to set a charset for a non-textual mimetype." << endl @@ -182,7 +182,7 @@ void KMMessagePart::setCharset( const QCString & c ) { } //----------------------------------------------------------------------------- -void KMMessagePart::setBodyEncoded(const QCString& aStr) +void KMMessagePart::setBodyEncoded(const TQCString& aStr) { mBodyDecodedSize = aStr.size() - 1; // same as aStr.length() but faster - assuming no embedded nuls switch (cte()) @@ -193,12 +193,12 @@ void KMMessagePart::setBodyEncoded(const QCString& aStr) Codec * codec = Codec::codecForName( cteStr() ); assert( codec ); // we can't use the convenience function here, since aStr is not - // a QByteArray...: + // a TQByteArray...: mBody.resize( codec->maxEncodedSizeFor( mBodyDecodedSize ) ); - QCString::ConstIterator iit = aStr.data(); - QCString::ConstIterator iend = aStr.data() + mBodyDecodedSize; - QByteArray::Iterator oit = mBody.begin(); - QByteArray::ConstIterator oend = mBody.end(); + TQCString::ConstIterator iit = aStr.data(); + TQCString::ConstIterator iend = aStr.data() + mBodyDecodedSize; + TQByteArray::Iterator oit = mBody.begin(); + TQByteArray::ConstIterator oend = mBody.end(); if ( !codec->encode( iit, iend, oit, oend ) ) kdWarning(5006) << codec->name() << " codec lies about it's maxEncodedSizeFor( " @@ -219,8 +219,8 @@ void KMMessagePart::setBodyEncoded(const QCString& aStr) } } -void KMMessagePart::setBodyAndGuessCte(const QByteArray& aBuf, - QValueList<int> & allowedCte, +void KMMessagePart::setBodyAndGuessCte(const TQByteArray& aBuf, + TQValueList<int> & allowedCte, bool allow8Bit, bool willBeSigned ) { @@ -242,8 +242,8 @@ void KMMessagePart::setBodyAndGuessCte(const QByteArray& aBuf, setBodyEncodedBinary( aBuf ); } -void KMMessagePart::setBodyAndGuessCte(const QCString& aBuf, - QValueList<int> & allowedCte, +void KMMessagePart::setBodyAndGuessCte(const TQCString& aBuf, + TQValueList<int> & allowedCte, bool allow8Bit, bool willBeSigned ) { @@ -266,7 +266,7 @@ void KMMessagePart::setBodyAndGuessCte(const QCString& aBuf, } //----------------------------------------------------------------------------- -void KMMessagePart::setBodyEncodedBinary(const QByteArray& aStr) +void KMMessagePart::setBodyEncodedBinary(const TQByteArray& aStr) { mBodyDecodedSize = aStr.size(); if (aStr.isEmpty()) @@ -300,7 +300,7 @@ void KMMessagePart::setBodyEncodedBinary(const QByteArray& aStr) } } -void KMMessagePart::setMessageBody( const QByteArray& aBuf ) +void KMMessagePart::setMessageBody( const TQByteArray& aBuf ) { CharFreq cf( aBuf ); // it's safe to pass null arrays mBodyDecodedSize = aBuf.size(); @@ -325,10 +325,10 @@ void KMMessagePart::setMessageBody( const QByteArray& aBuf ) } //----------------------------------------------------------------------------- -QByteArray KMMessagePart::bodyDecodedBinary() const +TQByteArray KMMessagePart::bodyDecodedBinary() const { - if (mBody.isEmpty()) return QByteArray(); - QByteArray result; + if (mBody.isEmpty()) return TQByteArray(); + TQByteArray result; switch (cte()) { @@ -356,11 +356,11 @@ QByteArray KMMessagePart::bodyDecodedBinary() const return result; } -QCString KMMessagePart::bodyDecoded(void) const +TQCString KMMessagePart::bodyDecoded(void) const { - if (mBody.isEmpty()) return QCString(""); + if (mBody.isEmpty()) return TQCString(""); bool decodeBinary = false; - QCString result; + TQCString result; int len; switch (cte()) @@ -375,12 +375,12 @@ QCString KMMessagePart::bodyDecoded(void) const default: if ( const Codec * codec = Codec::codecForName( cteStr() ) ) { // We can't use the codec convenience functions, since we must - // return a QCString, not a QByteArray: + // return a TQCString, not a TQByteArray: int bufSize = codec->maxDecodedSizeFor( mBody.size() ) + 1; // trailing NUL result.resize( bufSize ); - QByteArray::ConstIterator iit = mBody.begin(); - QCString::Iterator oit = result.begin(); - QCString::ConstIterator oend = result.begin() + bufSize; + TQByteArray::ConstIterator iit = mBody.begin(); + TQCString::Iterator oit = result.begin(); + TQCString::ConstIterator oend = result.begin() + bufSize; if ( !codec->decode( iit, mBody.end(), oit, oend ) ) kdWarning(5006) << codec->name() << " lies about it's maxDecodedSizeFor( " @@ -418,10 +418,10 @@ void KMMessagePart::magicSetType(bool aAutoDecode) { KMimeMagic::self()->setFollowLinks( true ); // is it necessary ? - const QByteArray body = ( aAutoDecode ) ? bodyDecodedBinary() : mBody ; + const TQByteArray body = ( aAutoDecode ) ? bodyDecodedBinary() : mBody ; KMimeMagicResult * result = KMimeMagic::self()->findBufferType( body ); - QString mimetype = result->mimeType(); + TQString mimetype = result->mimeType(); const int sep = mimetype.find('/'); mType = mimetype.left(sep).latin1(); mSubtype = mimetype.mid(sep+1).latin1(); @@ -429,20 +429,20 @@ void KMMessagePart::magicSetType(bool aAutoDecode) //----------------------------------------------------------------------------- -QString KMMessagePart::iconName( int size ) const +TQString KMMessagePart::iconName( int size ) const { - QCString mimeType( mType + "/" + mSubtype ); + TQCString mimeType( mType + "/" + mSubtype ); KPIM::kAsciiToLower( mimeType.data() ); - QString fileName = - KMimeType::mimeType( mimeType )->icon( QString::null, false ); + TQString fileName = + KMimeType::mimeType( mimeType )->icon( TQString::null, false ); if ( fileName.isEmpty() ) { fileName = this->fileName(); if ( fileName.isEmpty() ) fileName = this->name(); if ( !fileName.isEmpty() ) { - fileName = KMimeType::findByPath( "/tmp/"+fileName, 0, true )->icon( QString::null, true ); + fileName = KMimeType::findByPath( "/tmp/"+fileName, 0, true )->icon( TQString::null, true ); } } @@ -481,27 +481,27 @@ void KMMessagePart::setSubtype(int aSubtype) } //----------------------------------------------------------------------------- -QCString KMMessagePart::parameterAttribute(void) const +TQCString KMMessagePart::parameterAttribute(void) const { return mParameterAttribute; } //----------------------------------------------------------------------------- -QString KMMessagePart::parameterValue(void) const +TQString KMMessagePart::parameterValue(void) const { return mParameterValue; } //----------------------------------------------------------------------------- -void KMMessagePart::setParameter(const QCString &attribute, - const QString &value) +void KMMessagePart::setParameter(const TQCString &attribute, + const TQString &value) { mParameterAttribute = attribute; mParameterValue = value; } //----------------------------------------------------------------------------- -QCString KMMessagePart::contentTransferEncodingStr(void) const +TQCString KMMessagePart::contentTransferEncodingStr(void) const { return mCte; } @@ -515,7 +515,7 @@ int KMMessagePart::contentTransferEncoding(void) const //----------------------------------------------------------------------------- -void KMMessagePart::setContentTransferEncodingStr(const QCString &aStr) +void KMMessagePart::setContentTransferEncodingStr(const TQCString &aStr) { mCte = aStr; } @@ -532,16 +532,16 @@ void KMMessagePart::setContentTransferEncoding(int aCte) //----------------------------------------------------------------------------- -QString KMMessagePart::contentDescription(void) const +TQString KMMessagePart::contentDescription(void) const { return KMMsgBase::decodeRFC2047String(mContentDescription, charset()); } //----------------------------------------------------------------------------- -void KMMessagePart::setContentDescription(const QString &aStr) +void KMMessagePart::setContentDescription(const TQString &aStr) { - QCString encoding = KMMsgBase::autoDetectCharset(charset(), + TQCString encoding = KMMsgBase::autoDetectCharset(charset(), KMMessage::preferredCharsets(), aStr); if (encoding.isEmpty()) encoding = "utf-8"; mContentDescription = KMMsgBase::encodeRFC2047String(aStr, encoding); @@ -549,9 +549,9 @@ void KMMessagePart::setContentDescription(const QString &aStr) //----------------------------------------------------------------------------- -QString KMMessagePart::fileName(void) const +TQString KMMessagePart::fileName(void) const { - QCString str; + TQCString str; // Allow for multiple filname*0, filename*1, ... params (defined by RFC 2231) // in the Content-Disposision @@ -567,7 +567,7 @@ QString KMMessagePart::fileName(void) const // search the start of the filename int startOfFilename = mContentDisposition.find("filename=", 0, false); if (startOfFilename < 0) - return QString::null; + return TQString::null; startOfFilename += 9; // search the end of the filename @@ -582,18 +582,18 @@ QString KMMessagePart::fileName(void) const if (endOfFilename < 0) endOfFilename = 32767; - const QCString str = mContentDisposition.mid(startOfFilename, + const TQCString str = mContentDisposition.mid(startOfFilename, endOfFilename-startOfFilename+1) .stripWhiteSpace(); return KMMsgBase::decodeRFC2047String(str, charset()); } - return QString::null; + return TQString::null; } -QCString KMMessagePart::body() const +TQCString KMMessagePart::body() const { - return QCString( mBody.data(), mBody.size() + 1 ); // space for trailing NUL + return TQCString( mBody.data(), mBody.size() + 1 ); // space for trailing NUL } DwString KMMessagePart::dwBody() const |