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 /libkmime/kmime_content.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 'libkmime/kmime_content.cpp')
-rw-r--r-- | libkmime/kmime_content.cpp | 80 |
1 files changed, 40 insertions, 40 deletions
diff --git a/libkmime/kmime_content.cpp b/libkmime/kmime_content.cpp index e450d8022..6eca383fa 100644 --- a/libkmime/kmime_content.cpp +++ b/libkmime/kmime_content.cpp @@ -22,7 +22,7 @@ #include <klocale.h> #include <kdebug.h> -#include <qtextcodec.h> +#include <tqtextcodec.h> using namespace KMime; @@ -35,7 +35,7 @@ Content::Content() } -Content::Content(const QCString &h, const QCString &b) +Content::Content(const TQCString &h, const TQCString &b) : c_ontents(0), h_eaders(0), f_orceDefaultCS(false) { d_efaultCS = cachedCharset("ISO-8859-1"); @@ -51,17 +51,17 @@ Content::~Content() } -void Content::setContent(QStrList *l) +void Content::setContent(TQStrList *l) { - //qDebug("Content::setContent(QStrList *l) : start"); + //qDebug("Content::setContent(TQStrList *l) : start"); h_ead.resize(0); b_ody.resize(0); //usage of textstreams is much faster than simply appending the strings - QTextStream hts(h_ead, IO_WriteOnly), + TQTextStream hts(h_ead, IO_WriteOnly), bts(b_ody, IO_WriteOnly); - hts.setEncoding(QTextStream::Latin1); - bts.setEncoding(QTextStream::Latin1); + hts.setEncoding(TQTextStream::Latin1); + bts.setEncoding(TQTextStream::Latin1); bool isHead=true; for(char *line=l->first(); line; line=l->next()) { @@ -79,11 +79,11 @@ void Content::setContent(QStrList *l) hts << '\0'; bts << '\0'; - //qDebug("Content::setContent(QStrList *l) : finished"); + //qDebug("Content::setContent(TQStrList *l) : finished"); } -void Content::setContent(const QCString &s) +void Content::setContent(const TQCString &s) { int pos=s.find("\n\n", 0); if(pos>-1) { @@ -116,7 +116,7 @@ void Content::parse() c_ontents=0; Headers::ContentType *ct=contentType(); - QCString tmp; + TQCString tmp; Content *c; Headers::contentCategory cat; @@ -229,8 +229,8 @@ void Content::parse() c->setContent(tmp); // the bodies of yenc message parts are binary data, not null-terminated strings: - QByteArray body = yenc.binaryParts()[i]; - QCString body_string(body.size()); + TQByteArray body = yenc.binaryParts()[i]; + TQCString body_string(body.size()); memcpy(body_string.data(), body.data(), body.size()); c->setBody(body_string); @@ -255,7 +255,7 @@ void Content::parse() void Content::assemble() { - QCString newHead=""; + TQCString newHead=""; //Content-Type newHead+=contentType()->as7BitString()+"\n"; @@ -288,9 +288,9 @@ void Content::clear() } -QCString Content::encodedContent(bool useCrLf) +TQCString Content::encodedContent(bool useCrLf) { - QCString e; + TQCString e; // hack to convert articles with uuencoded or yencoded binaries into // proper mime-compliant articles @@ -313,9 +313,9 @@ QCString Content::encodedContent(bool useCrLf) // add proper mime headers... if (convertNonMimeBinaries) { - h_ead.replace(QRegExp("MIME-Version: .*\\n"),""); - h_ead.replace(QRegExp("Content-Type: .*\\n"),""); - h_ead.replace(QRegExp("Content-Transfer-Encoding: .*\\n"),""); + h_ead.replace(TQRegExp("MIME-Version: .*\\n"),""); + h_ead.replace(TQRegExp("Content-Type: .*\\n"),""); + h_ead.replace(TQRegExp("Content-Transfer-Encoding: .*\\n"),""); h_ead+="MIME-Version: 1.0\n"; h_ead+=contentType(true)->as7BitString()+"\n"; h_ead+=contentTransferEncoding(true)->as7BitString()+"\n"; @@ -332,7 +332,7 @@ QCString Content::encodedContent(bool useCrLf) if(enc->needToEncode()) { if(enc->cte()==Headers::CEquPr) { - QByteArray temp(b_ody.length()); + TQByteArray temp(b_ody.length()); memcpy(temp.data(), b_ody.data(), b_ody.length()); e+=KCodecs::quotedPrintableEncode(temp, false); } else { @@ -345,7 +345,7 @@ QCString Content::encodedContent(bool useCrLf) } else if(c_ontents && !c_ontents->isEmpty()) { //this is a multipart message Headers::ContentType *ct=contentType(); - QCString boundary="\n--"+ct->boundary(); + TQCString boundary="\n--"+ct->boundary(); //add all (encoded) contents separated by boundaries for(Content *c=c_ontents->first(); c; c=c_ontents->next()) { @@ -363,9 +363,9 @@ QCString Content::encodedContent(bool useCrLf) } -QByteArray Content::decodedContent() +TQByteArray Content::decodedContent() { - QByteArray temp, ret; + TQByteArray temp, ret; Headers::CTEncoding *ec=contentTransferEncoding(); bool removeTrailingNewline=false; int size=ec->cte()==Headers::CEbinary ? b_ody.size() : b_ody.length(); @@ -409,14 +409,14 @@ QByteArray Content::decodedContent() } -void Content::decodedText(QString &s, bool trimText, +void Content::decodedText(TQString &s, bool trimText, bool removeTrailingNewlines) { if(!decodeText()) //this is not a text content !! return; bool ok=true; - QTextCodec *codec=KGlobal::charsets()->codecForName(contentType()->charset(),ok); + TQTextCodec *codec=KGlobal::charsets()->codecForName(contentType()->charset(),ok); s=codec->toUnicode(b_ody.data(), b_ody.length()); @@ -433,16 +433,16 @@ void Content::decodedText(QString &s, bool trimText, } -void Content::decodedText(QStringList &l, bool trimText, +void Content::decodedText(TQStringList &l, bool trimText, bool removeTrailingNewlines) { if(!decodeText()) //this is not a text content !! return; - QString unicode; + TQString unicode; bool ok=true; - QTextCodec *codec=KGlobal::charsets()->codecForName(contentType()->charset(),ok); + TQTextCodec *codec=KGlobal::charsets()->codecForName(contentType()->charset(),ok); unicode=codec->toUnicode(b_ody.data(), b_ody.length()); @@ -457,18 +457,18 @@ void Content::decodedText(QStringList &l, bool trimText, unicode.truncate(unicode.length()-1); // remove trailing new-line } - l=QStringList::split('\n', unicode, true); //split the string at linebreaks + l=TQStringList::split('\n', unicode, true); //split the string at linebreaks } -void Content::fromUnicodeString(const QString &s) +void Content::fromUnicodeString(const TQString &s) { bool ok=true; - QTextCodec *codec=KGlobal::charsets()->codecForName(contentType()->charset(),ok); + TQTextCodec *codec=KGlobal::charsets()->codecForName(contentType()->charset(),ok); if(!ok) { // no suitable codec found => try local settings and hope the best ;-) codec=KGlobal::locale()->codecForEncoding(); - QCString chset=KGlobal::locale()->encoding(); + TQCString chset=KGlobal::locale()->encoding(); contentType()->setCharset(chset); } @@ -647,18 +647,18 @@ void Content::changeEncoding(Headers::contentEncoding e) } -void Content::toStream(QTextStream &ts, bool scrambleFromLines) +void Content::toStream(TQTextStream &ts, bool scrambleFromLines) { - QCString ret=encodedContent(false); + TQCString ret=encodedContent(false); if (scrambleFromLines) - ret.replace(QRegExp("\\n\\nFrom "), "\n\n>From "); + ret.replace(TQRegExp("\\n\\nFrom "), "\n\n>From "); ts << ret; } -Headers::Generic* Content::getNextHeader(QCString &head) +Headers::Generic* Content::getNextHeader(TQCString &head) { int pos1=-1, pos2=0, len=head.length()-1; bool folded(false); @@ -684,7 +684,7 @@ Headers::Generic* Content::getNextHeader(QCString &head) if (!folded) header = new Headers::Generic(head.left(pos1-2), this, head.mid(pos1, pos2-pos1)); else - header = new Headers::Generic(head.left(pos1-2), this, head.mid(pos1, pos2-pos1).replace(QRegExp("\\s*\\n\\s*")," ")); + header = new Headers::Generic(head.left(pos1-2), this, head.mid(pos1, pos2-pos1).replace(TQRegExp("\\s*\\n\\s*")," ")); head.remove(0,pos2+1); } @@ -708,7 +708,7 @@ Headers::Base* Content::getHeaderByType(const char *type) if(h->is(type)) return h; //found //now we look for it in the article head - QCString raw=rawHeader(type); + TQCString raw=rawHeader(type); if(!raw.isEmpty()) { //ok, we found it //choose a suitable header class if(strcasecmp("Message-Id", type)==0) @@ -827,7 +827,7 @@ int Content::lineCount() } -QCString Content::rawHeader(const char *name) +TQCString Content::rawHeader(const char *name) { return extractHeader(h_ead, name); } @@ -855,7 +855,7 @@ bool Content::decodeText() b_ody.append("\n"); break; case Headers::CEbinary : - b_ody=QCString(b_ody.data(), b_ody.size()+1); + b_ody=TQCString(b_ody.data(), b_ody.size()+1); b_ody.append("\n"); default : break; @@ -866,7 +866,7 @@ bool Content::decodeText() } -void Content::setDefaultCharset(const QCString &cs) +void Content::setDefaultCharset(const TQCString &cs) { d_efaultCS = KMime::cachedCharset(cs); |