summaryrefslogtreecommitdiffstats
path: root/kmail/kmmsgbase.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'kmail/kmmsgbase.cpp')
-rw-r--r--kmail/kmmsgbase.cpp198
1 files changed, 99 insertions, 99 deletions
diff --git a/kmail/kmmsgbase.cpp b/kmail/kmmsgbase.cpp
index 00c7e5761..df53e6e57 100644
--- a/kmail/kmmsgbase.cpp
+++ b/kmail/kmmsgbase.cpp
@@ -22,9 +22,9 @@ using KMail::MessageProperty;
#include <mimelib/mimepp.h>
#include <kmime_codecs.h>
-#include <qtextcodec.h>
-#include <qdeepcopy.h>
-#include <qregexp.h>
+#include <tqtextcodec.h>
+#include <tqdeepcopy.h>
+#include <tqregexp.h>
#include <ctype.h>
#include <stdlib.h>
@@ -305,7 +305,7 @@ void KMMsgBase::setEncryptionState( const KMMsgEncryptionState /*status*/, int i
storage()->headerOfMsgChanged(this, idx);
}
-void KMMsgBase::setEncryptionStateChar( QChar status, int idx )
+void KMMsgBase::setEncryptionStateChar( TQChar status, int idx )
{
//kdDebug(5006) << "***setEncryptionState2( " << (status.isNull() ? '?' : status.latin1()) << " )" << endl;
@@ -336,7 +336,7 @@ void KMMsgBase::setMDNSentState( KMMsgMDNSentState, int idx ) {
storage()->headerOfMsgChanged(this, idx);
}
-void KMMsgBase::setSignatureStateChar( QChar status, int idx )
+void KMMsgBase::setSignatureStateChar( TQChar status, int idx )
{
//kdDebug(5006) << "***setSignatureState2( " << (status.isNull() ? '?' : status.latin1()) << " )" << endl;
@@ -465,9 +465,9 @@ bool KMMsgBase::isHam(void) const
}
//-----------------------------------------------------------------------------
-QCString KMMsgBase::statusToStr(const KMMsgStatus status)
+TQCString KMMsgBase::statusToStr(const KMMsgStatus status)
{
- QCString sstr;
+ TQCString sstr;
if (status & KMMsgStatusNew) sstr += 'N';
if (status & KMMsgStatusUnread) sstr += 'U';
if (status & KMMsgStatusOld) sstr += 'O';
@@ -490,9 +490,9 @@ QCString KMMsgBase::statusToStr(const KMMsgStatus status)
}
//-----------------------------------------------------------------------------
-QString KMMsgBase::statusToSortRank()
+TQString KMMsgBase::statusToSortRank()
{
- QString sstr = "bcbbbbbbbb";
+ TQString sstr = "bcbbbbbbbb";
// put watched ones first, then normal ones, ignored ones last
if (status() & KMMsgStatusWatched) sstr[0] = 'a';
@@ -520,14 +520,14 @@ QString KMMsgBase::statusToSortRank()
//-----------------------------------------------------------------------------
-void KMMsgBase::setDate(const QCString& aDateStr)
+void KMMsgBase::setDate(const TQCString& aDateStr)
{
setDate( KRFCDate::parseDate( aDateStr ) );
}
//-----------------------------------------------------------------------------
-QString KMMsgBase::dateStr(void) const
+TQString KMMsgBase::dateStr(void) const
{
time_t d = date();
return KMime::DateFormatter::formatDate(KMime::DateFormatter::Fancy, d);
@@ -535,11 +535,11 @@ QString KMMsgBase::dateStr(void) const
//-----------------------------------------------------------------------------
-QString KMMsgBase::skipKeyword(const QString& aStr, QChar sepChar,
+TQString KMMsgBase::skipKeyword(const TQString& aStr, TQChar sepChar,
bool* hasKeyword)
{
unsigned int i = 0, maxChars = 3;
- QString str = aStr;
+ TQString str = aStr;
while (str[0] == ' ') str.remove(0,1);
if (hasKeyword) *hasKeyword=false;
@@ -563,20 +563,20 @@ QString KMMsgBase::skipKeyword(const QString& aStr, QChar sepChar,
//-----------------------------------------------------------------------------
-const QTextCodec* KMMsgBase::codecForName(const QCString& _str)
+const TQTextCodec* KMMsgBase::codecForName(const TQCString& _str)
{
if (_str.isEmpty()) return 0;
- QCString codec = _str;
+ TQCString codec = _str;
KPIM::kAsciiToLower(codec.data());
return KGlobal::charsets()->codecForName(codec);
}
//-----------------------------------------------------------------------------
-QCString KMMsgBase::toUsAscii(const QString& _str, bool *ok)
+TQCString KMMsgBase::toUsAscii(const TQString& _str, bool *ok)
{
bool all_ok =true;
- QString result = _str;
+ TQString result = _str;
int len = result.length();
for (int i = 0; i < len; i++)
if (result.at(i).unicode() >= 128) {
@@ -590,16 +590,16 @@ QCString KMMsgBase::toUsAscii(const QString& _str, bool *ok)
//-----------------------------------------------------------------------------
-QStringList KMMsgBase::supportedEncodings(bool usAscii)
+TQStringList KMMsgBase::supportedEncodings(bool usAscii)
{
- QStringList encodingNames = KGlobal::charsets()->availableEncodingNames();
- QStringList encodings;
- QMap<QString,bool> mimeNames;
- for (QStringList::Iterator it = encodingNames.begin();
+ TQStringList encodingNames = KGlobal::charsets()->availableEncodingNames();
+ TQStringList encodings;
+ TQMap<TQString,bool> mimeNames;
+ for (TQStringList::Iterator it = encodingNames.begin();
it != encodingNames.end(); it++)
{
- QTextCodec *codec = KGlobal::charsets()->codecForName(*it);
- QString mimeName = (codec) ? QString(codec->mimeName()).lower() : (*it);
+ TQTextCodec *codec = KGlobal::charsets()->codecForName(*it);
+ TQString mimeName = (codec) ? TQString(codec->mimeName()).lower() : (*it);
if (mimeNames.find(mimeName) == mimeNames.end())
{
encodings.append(KGlobal::charsets()->languageForEncoding(*it)
@@ -620,11 +620,11 @@ namespace {
// it's definition...
inline bool isBlank( char ch ) { return ch == ' ' || ch == '\t' ; }
- QCString unfold( const QCString & header ) {
+ TQCString unfold( const TQCString & header ) {
if ( header.isEmpty() )
- return QCString();
+ return TQCString();
- QCString result( header.size() ); // size() >= length()+1 and size() is O(1)
+ TQCString result( header.size() ); // size() >= length()+1 and size() is O(1)
char * d = result.data();
for ( const char * s = header.data() ; *s ; )
@@ -647,15 +647,15 @@ namespace {
//-----------------------------------------------------------------------------
-QString KMMsgBase::decodeRFC2047String(const QCString& aStr, QCString prefCharset)
+TQString KMMsgBase::decodeRFC2047String(const TQCString& aStr, TQCString prefCharset)
{
if ( aStr.isEmpty() )
- return QString::null;
+ return TQString::null;
- const QCString str = unfold( aStr );
+ const TQCString str = unfold( aStr );
if ( str.isEmpty() )
- return QString::null;
+ return TQString::null;
if ( str.find( "=?" ) < 0 ) {
if ( !prefCharset.isEmpty() ) {
@@ -671,8 +671,8 @@ QString KMMsgBase::decodeRFC2047String(const QCString& aStr, QCString prefCharse
}
}
- QString result;
- QCString LWSP_buffer;
+ TQString result;
+ TQCString LWSP_buffer;
bool lastWasEncodedWord = false;
for ( const char * pos = str.data() ; *pos ; ++pos ) {
@@ -694,7 +694,7 @@ QString KMMsgBase::decodeRFC2047String(const QCString& aStr, QCString prefCharse
const char * const beg = pos;
{
// parse charset name
- QCString charset;
+ TQCString charset;
int i = 2;
pos += 2;
for ( ; *pos != '?' && ( *pos==' ' || ispunct(*pos) || isalnum(*pos) );
@@ -723,11 +723,11 @@ QString KMMsgBase::decodeRFC2047String(const QCString& aStr, QCString prefCharse
const KMime::Codec * c = KMime::Codec::codecForName( encoding );
kdFatal( !c, 5006 ) << "No \"" << encoding << "\" codec!?" << endl;
- QByteArray in; in.setRawData( enc_start, pos - enc_start );
- const QByteArray enc = c->decode( in );
+ TQByteArray in; in.setRawData( enc_start, pos - enc_start );
+ const TQByteArray enc = c->decode( in );
in.resetRawData( enc_start, pos - enc_start );
- const QTextCodec * codec = codecForName(charset);
+ const TQTextCodec * codec = codecForName(charset);
if (!codec) codec = kmkernel->networkCodec();
result += codec->toUnicode(enc);
lastWasEncodedWord = true;
@@ -751,27 +751,27 @@ QString KMMsgBase::decodeRFC2047String(const QCString& aStr, QCString prefCharse
//-----------------------------------------------------------------------------
-static const QCString especials = "()<>@,;:\"/[]?.= \033";
+static const TQCString especials = "()<>@,;:\"/[]?.= \033";
-QCString KMMsgBase::encodeRFC2047Quoted( const QCString & s, bool base64 ) {
+TQCString KMMsgBase::encodeRFC2047Quoted( const TQCString & s, bool base64 ) {
const char * codecName = base64 ? "b" : "q" ;
const KMime::Codec * codec = KMime::Codec::codecForName( codecName );
kdFatal( !codec, 5006 ) << "No \"" << codecName << "\" found!?" << endl;
- QByteArray in; in.setRawData( s.data(), s.length() );
- const QByteArray result = codec->encode( in );
+ TQByteArray in; in.setRawData( s.data(), s.length() );
+ const TQByteArray result = codec->encode( in );
in.resetRawData( s.data(), s.length() );
- return QCString( result.data(), result.size() + 1 );
+ return TQCString( result.data(), result.size() + 1 );
}
-QCString KMMsgBase::encodeRFC2047String(const QString& _str,
- const QCString& charset)
+TQCString KMMsgBase::encodeRFC2047String(const TQString& _str,
+ const TQCString& charset)
{
- static const QString dontQuote = "\"()<>,@";
+ static const TQString dontQuote = "\"()<>,@";
- if (_str.isEmpty()) return QCString();
+ if (_str.isEmpty()) return TQCString();
if (charset == "us-ascii") return toUsAscii(_str);
- QCString cset;
+ TQCString cset;
if (charset.isEmpty())
{
cset = kmkernel->networkCodec()->mimeName();
@@ -779,7 +779,7 @@ QCString KMMsgBase::encodeRFC2047String(const QString& _str,
}
else cset = charset;
- const QTextCodec *codec = codecForName(cset);
+ const TQTextCodec *codec = codecForName(cset);
if (!codec) codec = kmkernel->networkCodec();
unsigned int nonAscii = 0;
@@ -789,7 +789,7 @@ QCString KMMsgBase::encodeRFC2047String(const QString& _str,
bool useBase64 = (nonAscii * 6 > strLength);
unsigned int start, stop, p, pos = 0, encLength;
- QCString result;
+ TQCString result;
bool breakLine = false;
const unsigned int maxLen = 75 - 7 - cset.length();
@@ -856,13 +856,13 @@ QCString KMMsgBase::encodeRFC2047String(const QString& _str,
//-----------------------------------------------------------------------------
-QCString KMMsgBase::encodeRFC2231String( const QString& _str,
- const QCString& charset )
+TQCString KMMsgBase::encodeRFC2231String( const TQString& _str,
+ const TQCString& charset )
{
if ( _str.isEmpty() )
- return QCString();
+ return TQCString();
- QCString cset;
+ TQCString cset;
if ( charset.isEmpty() )
{
cset = kmkernel->networkCodec()->mimeName();
@@ -870,8 +870,8 @@ QCString KMMsgBase::encodeRFC2231String( const QString& _str,
}
else
cset = charset;
- const QTextCodec *codec = codecForName( cset );
- QCString latin;
+ const TQTextCodec *codec = codecForName( cset );
+ TQCString latin;
if ( charset == "us-ascii" )
latin = toUsAscii( _str );
else if ( codec )
@@ -888,7 +888,7 @@ QCString KMMsgBase::encodeRFC2231String( const QString& _str,
if ( !*l )
return latin;
- QCString result = cset + "''";
+ TQCString result = cset + "''";
for ( l = latin.data(); *l; ++l ) {
bool needsQuoting = ( *l & 0x80 );
if( !needsQuoting ) {
@@ -919,14 +919,14 @@ QCString KMMsgBase::encodeRFC2231String( const QString& _str,
//-----------------------------------------------------------------------------
-QString KMMsgBase::decodeRFC2231String(const QCString& _str)
+TQString KMMsgBase::decodeRFC2231String(const TQCString& _str)
{
int p = _str.find('\'');
if (p < 0) return kmkernel->networkCodec()->toUnicode(_str);
- QCString charset = _str.left(p);
+ TQCString charset = _str.left(p);
- QCString st = _str.mid(_str.findRev('\'') + 1);
+ TQCString st = _str.mid(_str.findRev('\'') + 1);
char ch, ch2;
p = 0;
while (p < (int)st.length())
@@ -942,27 +942,27 @@ QString KMMsgBase::decodeRFC2231String(const QCString& _str)
}
p++;
}
- QString result;
- const QTextCodec * codec = codecForName( charset );
+ TQString result;
+ const TQTextCodec * codec = codecForName( charset );
if ( !codec )
codec = kmkernel->networkCodec();
return codec->toUnicode( st );
}
-QCString KMMsgBase::extractRFC2231HeaderField( const QCString &aStr, const QCString &field )
+TQCString KMMsgBase::extractRFC2231HeaderField( const TQCString &aStr, const TQCString &field )
{
int n=-1;
- QCString str;
+ TQCString str;
bool found = false;
while ( n<=0 || found ) {
- QString pattern( field );
+ TQString pattern( field );
pattern += "[*]"; // match a literal * after the fieldname, as defined by RFC 2231
if ( n>=0 ) { // If n<0, check for fieldname*=..., otherwise for fieldname*n=
- pattern += QString::number(n) + "[*]?";
+ pattern += TQString::number(n) + "[*]?";
}
pattern += "=";
- QRegExp fnamePart( pattern, false );
+ TQRegExp fnamePart( pattern, false );
int startPart = fnamePart.search( aStr );
int endPart;
found = ( startPart >= 0 );
@@ -985,20 +985,20 @@ QCString KMMsgBase::extractRFC2231HeaderField( const QCString &aStr, const QCStr
return str;
}
-QString KMMsgBase::base64EncodedMD5( const QString & s, bool utf8 ) {
+TQString KMMsgBase::base64EncodedMD5( const TQString & s, bool utf8 ) {
if (s.stripWhiteSpace().isEmpty()) return "";
if ( utf8 )
- return base64EncodedMD5( s.stripWhiteSpace().utf8() ); // QCString overload
+ return base64EncodedMD5( s.stripWhiteSpace().utf8() ); // TQCString overload
else
return base64EncodedMD5( s.stripWhiteSpace().latin1() ); // const char * overload
}
-QString KMMsgBase::base64EncodedMD5( const QCString & s ) {
+TQString KMMsgBase::base64EncodedMD5( const TQCString & s ) {
if (s.stripWhiteSpace().isEmpty()) return "";
return base64EncodedMD5( s.stripWhiteSpace().data() );
}
-QString KMMsgBase::base64EncodedMD5( const char * s, int len ) {
+TQString KMMsgBase::base64EncodedMD5( const char * s, int len ) {
if (!s || !len) return "";
static const int Base64EncodedMD5Len = 22;
KMD5 md5( s, len );
@@ -1007,20 +1007,20 @@ QString KMMsgBase::base64EncodedMD5( const char * s, int len ) {
//-----------------------------------------------------------------------------
-QCString KMMsgBase::autoDetectCharset(const QCString &_encoding, const QStringList &encodingList, const QString &text)
+TQCString KMMsgBase::autoDetectCharset(const TQCString &_encoding, const TQStringList &encodingList, const TQString &text)
{
- QStringList charsets = encodingList;
+ TQStringList charsets = encodingList;
if (!_encoding.isEmpty())
{
- QString currentCharset = QString::fromLatin1(_encoding);
+ TQString currentCharset = TQString::fromLatin1(_encoding);
charsets.remove(currentCharset);
charsets.prepend(currentCharset);
}
- QStringList::ConstIterator it = charsets.begin();
+ TQStringList::ConstIterator it = charsets.begin();
for (; it != charsets.end(); ++it)
{
- QCString encoding = (*it).latin1();
+ TQCString encoding = (*it).latin1();
if (encoding == "locale")
{
encoding = kmkernel->networkCodec()->mimeName();
@@ -1036,7 +1036,7 @@ QCString KMMsgBase::autoDetectCharset(const QCString &_encoding, const QStringLi
}
else
{
- const QTextCodec *codec = KMMsgBase::codecForName(encoding);
+ const TQTextCodec *codec = KMMsgBase::codecForName(encoding);
if (!codec) {
kdDebug(5006) << "Auto-Charset: Something is wrong and I can not get a codec. [" << encoding << "]" << endl;
} else {
@@ -1078,11 +1078,11 @@ KMMsgAttachmentState KMMsgBase::attachmentState() const
}
//-----------------------------------------------------------------------------
-static void swapEndian(QString &str)
+static void swapEndian(TQString &str)
{
uint len = str.length();
- str = QDeepCopy<QString>(str);
- QChar *unicode = const_cast<QChar*>( str.unicode() );
+ str = TQDeepCopy<TQString>(str);
+ TQChar *unicode = const_cast<TQChar*>( str.unicode() );
for (uint i = 0; i < len; i++)
unicode[i] = kmail_swap_16(unicode[i].unicode());
}
@@ -1108,10 +1108,10 @@ namespace {
}
//-----------------------------------------------------------------------------
-QString KMMsgBase::getStringPart(MsgPartType t) const
+TQString KMMsgBase::getStringPart(MsgPartType t) const
{
retry:
- QString ret;
+ TQString ret;
g_chunk_offset = 0;
bool using_mmap = false;
@@ -1155,10 +1155,10 @@ retry:
goto retry;
}
if(type == t) {
- // This works because the QString constructor does a memcpy.
+ // This works because the TQString constructor does a memcpy.
// Otherwise we would need to be concerned about the alignment.
if(l)
- ret = QString((QChar *)(g_chunk + g_chunk_offset), l/2);
+ ret = TQString((TQChar *)(g_chunk + g_chunk_offset), l/2);
break;
}
g_chunk_offset += l;
@@ -1330,7 +1330,7 @@ const uchar *KMMsgBase::asIndexString(int &length) const
length = 0;
unsigned long tmp;
- QString tmp_str;
+ TQString tmp_str;
//these is at the beginning because it is queried quite often
tmp_str = msgIdMD5().stripWhiteSpace();
@@ -1397,7 +1397,7 @@ bool KMMsgBase::syncIndexString() const
return false;
}
-static QStringList sReplySubjPrefixes, sForwardSubjPrefixes;
+static TQStringList sReplySubjPrefixes, sForwardSubjPrefixes;
static bool sReplaceSubjPrefix, sReplaceForwSubjPrefix;
//-----------------------------------------------------------------------------
@@ -1416,26 +1416,26 @@ void KMMsgBase::readConfig()
//-----------------------------------------------------------------------------
// static
-QString KMMsgBase::stripOffPrefixes( const QString& str )
+TQString KMMsgBase::stripOffPrefixes( const TQString& str )
{
return replacePrefixes( str, sReplySubjPrefixes + sForwardSubjPrefixes,
- true, QString::null ).stripWhiteSpace();
+ true, TQString::null ).stripWhiteSpace();
}
//-----------------------------------------------------------------------------
// static
-QString KMMsgBase::replacePrefixes( const QString& str,
- const QStringList& prefixRegExps,
+TQString KMMsgBase::replacePrefixes( const TQString& str,
+ const TQStringList& prefixRegExps,
bool replace,
- const QString& newPrefix )
+ const TQString& newPrefix )
{
bool recognized = false;
// construct a big regexp that
// 1. is anchored to the beginning of str (sans whitespace)
// 2. matches at least one of the part regexps in prefixRegExps
- QString bigRegExp = QString::fromLatin1("^(?:\\s+|(?:%1))+\\s*")
+ TQString bigRegExp = TQString::fromLatin1("^(?:\\s+|(?:%1))+\\s*")
.arg( prefixRegExps.join(")|(?:") );
- QRegExp rx( bigRegExp, false /*case insens.*/ );
+ TQRegExp rx( bigRegExp, false /*case insens.*/ );
if ( !rx.isValid() ) {
kdWarning(5006) << "KMMessage::replacePrefixes(): bigRegExp = \""
<< bigRegExp << "\"\n"
@@ -1443,7 +1443,7 @@ QString KMMsgBase::replacePrefixes( const QString& str,
// try good ole Re/Fwd:
recognized = str.startsWith( newPrefix );
} else { // valid rx
- QString tmp = str;
+ TQString tmp = str;
if ( rx.search( tmp ) == 0 ) {
recognized = true;
if ( replace )
@@ -1457,27 +1457,27 @@ QString KMMsgBase::replacePrefixes( const QString& str,
}
//-----------------------------------------------------------------------------
-QString KMMsgBase::cleanSubject() const
+TQString KMMsgBase::cleanSubject() const
{
return cleanSubject( sReplySubjPrefixes + sForwardSubjPrefixes,
- true, QString::null ).stripWhiteSpace();
+ true, TQString::null ).stripWhiteSpace();
}
//-----------------------------------------------------------------------------
-QString KMMsgBase::cleanSubject( const QStringList & prefixRegExps,
+TQString KMMsgBase::cleanSubject( const TQStringList & prefixRegExps,
bool replace,
- const QString & newPrefix ) const
+ const TQString & newPrefix ) const
{
return KMMsgBase::replacePrefixes( subject(), prefixRegExps, replace,
newPrefix );
}
//-----------------------------------------------------------------------------
-QString KMMsgBase::forwardSubject() const {
+TQString KMMsgBase::forwardSubject() const {
return cleanSubject( sForwardSubjPrefixes, sReplaceForwSubjPrefix, "Fwd:" );
}
//-----------------------------------------------------------------------------
-QString KMMsgBase::replySubject() const {
+TQString KMMsgBase::replySubject() const {
return cleanSubject( sReplySubjPrefixes, sReplaceSubjPrefix, "Re:" );
}