diff options
Diffstat (limited to 'libkmime/kmime_util.cpp')
-rw-r--r-- | libkmime/kmime_util.cpp | 128 |
1 files changed, 64 insertions, 64 deletions
diff --git a/libkmime/kmime_util.cpp b/libkmime/kmime_util.cpp index 8923a5b0a..313aabe72 100644 --- a/libkmime/kmime_util.cpp +++ b/libkmime/kmime_util.cpp @@ -29,9 +29,9 @@ #include <kcalendarsystem.h> #endif -#include <qtextcodec.h> -#include <qstrlist.h> // for QStrIList -#include <qregexp.h> +#include <tqtextcodec.h> +#include <tqstrlist.h> // for QStrIList +#include <tqregexp.h> #include <stdlib.h> #include <ctype.h> @@ -42,10 +42,10 @@ using namespace KMime; namespace KMime { -QStrIList c_harsetCache; -QStrIList l_anguageCache; +TQStrIList c_harsetCache; +TQStrIList l_anguageCache; -const char* cachedCharset(const QCString &name) +const char* cachedCharset(const TQCString &name) { int idx=c_harsetCache.find(name.data()); if(idx>-1) @@ -56,7 +56,7 @@ const char* cachedCharset(const QCString &name) return c_harsetCache.last(); } -const char* cachedLanguage(const QCString &name) +const char* cachedLanguage(const TQCString &name) { int idx=l_anguageCache.find(name.data()); if(idx>-1) @@ -67,7 +67,7 @@ const char* cachedLanguage(const QCString &name) return l_anguageCache.last(); } -bool isUsAscii(const QString &s) +bool isUsAscii(const TQString &s) { uint sLength = s.length(); for (uint i=0; i<sLength; i++) @@ -121,11 +121,11 @@ const uchar eTextMap[16] = { #undef truncate #endif -QString decodeRFC2047String(const QCString &src, const char **usedCS, - const QCString &defaultCS, bool forceCS) +TQString decodeRFC2047String(const TQCString &src, const char **usedCS, + const TQCString &defaultCS, bool forceCS) { - QCString result, str; - QCString declaredCS; + TQCString result, str; + TQCString declaredCS; char *pos, *dest, *beg, *end, *mid, *endOfLastEncWord=0; char encoding = '\0'; bool valid, onlySpacesSinceLastWord=false; @@ -183,7 +183,7 @@ QString decodeRFC2047String(const QCString &src, const char **usedCS, dest=endOfLastEncWord; if (mid < pos) { - str = QCString(mid, (int)(pos - mid + 1)); + str = TQCString(mid, (int)(pos - mid + 1)); if (encoding == 'Q') { // decode quoted printable text @@ -218,7 +218,7 @@ QString decodeRFC2047String(const QCString &src, const char **usedCS, } //find suitable QTextCodec - QTextCodec *codec=0; + TQTextCodec *codec=0; bool ok=true; if (forceCS || declaredCS.isEmpty()) { codec=KGlobal::charsets()->codecForName(defaultCS); @@ -237,19 +237,19 @@ QString decodeRFC2047String(const QCString &src, const char **usedCS, return codec->toUnicode(result.data(), result.length()); } -QString decodeRFC2047String(const QCString &src) +TQString decodeRFC2047String(const TQCString &src) { const char *usedCS; return decodeRFC2047String(src, &usedCS, "utf-8", false); } -QCString encodeRFC2047String(const QString &src, const char *charset, +TQCString encodeRFC2047String(const TQString &src, const char *charset, bool addressHeader, bool allow8BitHeaders) { - QCString encoded8Bit, result, usedCS; + TQCString encoded8Bit, result, usedCS; unsigned int start=0,end=0; bool nonAscii=false, ok=true, useQEncoding=false; - QTextCodec *codec=0; + TQTextCodec *codec=0; usedCS=charset; codec=KGlobal::charsets()->codecForName(usedCS, ok); @@ -333,11 +333,11 @@ QCString encodeRFC2047String(const QString &src, const char *charset, return result; } -QCString uniqueString() +TQCString uniqueString() { static char chars[] = "0123456789abcdefghijklmnopqrstuvxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"; time_t now; - QCString ret; + TQCString ret; char p[11]; int pos, ran; unsigned int timeval; @@ -358,16 +358,16 @@ QCString uniqueString() } -QCString multiPartBoundary() +TQCString multiPartBoundary() { - QCString ret; + TQCString ret; ret="nextPart"+uniqueString(); return ret; } -QCString extractHeader(const QCString &src, const char *name) +TQCString extractHeader(const TQCString &src, const char *name) { - QCString n=QCString(name)+":"; + TQCString n=TQCString(name)+":"; int pos1=-1, pos2=0, len=src.length()-1; bool folded(false); @@ -400,39 +400,39 @@ QCString extractHeader(const QCString &src, const char *name) if (!folded) return src.mid(pos1, pos2-pos1); else - return (src.mid(pos1, pos2-pos1).replace(QRegExp("\\s*\\n\\s*")," ")); + return (src.mid(pos1, pos2-pos1).replace(TQRegExp("\\s*\\n\\s*")," ")); } else { - return QCString(0); //header not found + return TQCString(0); //header not found } } -QCString CRLFtoLF(const QCString &s) +TQCString CRLFtoLF(const TQCString &s) { - QCString ret=s.copy(); - ret.replace(QRegExp("\\r\\n"), "\n"); + TQCString ret=s.copy(); + ret.replace(TQRegExp("\\r\\n"), "\n"); return ret; } -QCString CRLFtoLF(const char *s) +TQCString CRLFtoLF(const char *s) { - QCString ret=s; - ret.replace(QRegExp("\\r\\n"), "\n"); + TQCString ret=s; + ret.replace(TQRegExp("\\r\\n"), "\n"); return ret; } -QCString LFtoCRLF(const QCString &s) +TQCString LFtoCRLF(const TQCString &s) { - QCString ret=s.copy(); - ret.replace(QRegExp("\\n"), "\r\n"); + TQCString ret=s.copy(); + ret.replace(TQRegExp("\\n"), "\r\n"); return ret; } -void removeQuots(QCString &str) +void removeQuots(TQCString &str) { bool inQuote=false; @@ -449,7 +449,7 @@ void removeQuots(QCString &str) } -void removeQuots(QString &str) +void removeQuots(TQString &str) { bool inQuote=false; @@ -466,7 +466,7 @@ void removeQuots(QString &str) } -void addQuotes(QCString &str, bool forceQuotes) +void addQuotes(TQCString &str, bool forceQuotes) { bool needsQuotes=false; for (unsigned int i=0; i < str.length(); i++) { @@ -507,7 +507,7 @@ DateFormatter::setFormat( FormatType t ) } QString -DateFormatter::dateString( time_t otime , const QString& lang , +DateFormatter::dateString( time_t otime , const TQString& lang , bool shortFormat, bool includeSecs ) const { switch ( mFormat ) { @@ -527,11 +527,11 @@ DateFormatter::dateString( time_t otime , const QString& lang , return custom( otime ); break; } - return QString::null; + return TQString::null; } QString -DateFormatter::dateString(const QDateTime& dtime, const QString& lang, +DateFormatter::dateString(const TQDateTime& dtime, const TQString& lang, bool shortFormat, bool includeSecs ) const { return DateFormatter::dateString( qdateToTimeT(dtime), lang, shortFormat, includeSecs ); @@ -540,8 +540,8 @@ DateFormatter::dateString(const QDateTime& dtime, const QString& lang, QCString DateFormatter::rfc2822(time_t otime) const { - QDateTime tmp; - QCString ret; + TQDateTime tmp; + TQCString ret; tmp.setTime_t(otime); @@ -555,11 +555,11 @@ QString DateFormatter::custom(time_t t) const { if ( mCustomFormat.isEmpty() ) - return QString::null; + return TQString::null; int z = mCustomFormat.find("Z"); - QDateTime d; - QString ret = mCustomFormat; + TQDateTime d; + TQString ret = mCustomFormat; d.setTime_t(t); if ( z != -1 ) { @@ -572,7 +572,7 @@ DateFormatter::custom(time_t t) const } void -DateFormatter::setCustomFormat(const QString& format) +DateFormatter::setCustomFormat(const TQString& format) { mCustomFormat = format; mFormat = Custom; @@ -588,7 +588,7 @@ DateFormatter::getCustomFormat() const QCString DateFormatter::zone(time_t otime) const { - QCString ret; + TQCString ret; #if defined(HAVE_TIMEZONE) || defined(HAVE_TM_GMTOFF) struct tm *local = localtime( &otime ); #endif @@ -629,8 +629,8 @@ DateFormatter::zone(time_t otime) const #else - QDateTime d1 = QDateTime::fromString( asctime(gmtime(&otime)) ); - QDateTime d2 = QDateTime::fromString( asctime(localtime(&otime)) ); + TQDateTime d1 = TQDateTime::fromString( asctime(gmtime(&otime)) ); + TQDateTime d2 = TQDateTime::fromString( asctime(localtime(&otime)) ); int secs = d1.secsTo(d2); int neg = (secs<0)?1:0; secs = abs(secs); @@ -645,14 +645,14 @@ DateFormatter::zone(time_t otime) const } time_t -DateFormatter::qdateToTimeT(const QDateTime& dt) const +DateFormatter::qdateToTimeT(const TQDateTime& dt) const { - QDateTime epoch( QDate(1970, 1,1), QTime(00,00,00) ); + TQDateTime epoch( TQDate(1970, 1,1), TQTime(00,00,00) ); time_t otime; time( &otime ); - QDateTime d1 = QDateTime::fromString( asctime(gmtime(&otime)) ); - QDateTime d2 = QDateTime::fromString( asctime(localtime(&otime)) ); + TQDateTime d1 = TQDateTime::fromString( asctime(gmtime(&otime)) ); + TQDateTime d2 = TQDateTime::fromString( asctime(localtime(&otime)) ); time_t drf = epoch.secsTo( dt ) - d1.secsTo( d2 ); return drf; @@ -671,7 +671,7 @@ DateFormatter::fancy(time_t otime) const mDate.setTime_t( mCurrentTime ); } - QDateTime old; + TQDateTime old; old.setTime_t( otime ); // not more than an hour in the future @@ -685,7 +685,7 @@ DateFormatter::fancy(time_t otime) const formatTime( old.time(), true ) ); } if ( diff < 2 * 24 * 60 * 60 ) { - QDateTime yesterday( mDate.addDays( -1 ) ); + TQDateTime yesterday( mDate.addDays( -1 ) ); if ( old.date().year() == yesterday.date().year() && old.date().dayOfYear() == yesterday.date().dayOfYear() ) return i18n( "Yesterday %1" ).arg( locale-> @@ -693,7 +693,7 @@ DateFormatter::fancy(time_t otime) const } for ( int i = 3; i < 7; i++ ) if ( diff < i * 24 * 60 * 60 ) { - QDateTime weekday( mDate.addDays( -i + 1 ) ); + TQDateTime weekday( mDate.addDays( -i + 1 ) ); if ( old.date().year() == weekday.date().year() && old.date().dayOfYear() == weekday.date().dayOfYear() ) return i18n( "1. weekday, 2. time", "%1 %2" ). @@ -712,10 +712,10 @@ DateFormatter::fancy(time_t otime) const QString DateFormatter::localized(time_t otime, bool shortFormat, bool includeSecs, - const QString& localeLanguage ) const + const TQString& localeLanguage ) const { - QDateTime tmp; - QString ret; + TQDateTime tmp; + TQString ret; KLocale *locale = KGlobal::locale(); tmp.setTime_t( otime ); @@ -737,7 +737,7 @@ DateFormatter::localized(time_t otime, bool shortFormat, bool includeSecs, QString DateFormatter::cTime(time_t otime) const { - return QString::fromLatin1( ctime( &otime ) ).stripWhiteSpace() ; + return TQString::fromLatin1( ctime( &otime ) ).stripWhiteSpace() ; } QString @@ -745,7 +745,7 @@ DateFormatter::isoDate(time_t otime) const { char cstr[64]; strftime( cstr, 63, "%Y-%m-%d %H:%M:%S", localtime(&otime) ); - return QString( cstr ); + return TQString( cstr ); } @@ -757,7 +757,7 @@ DateFormatter::reset() QString DateFormatter::formatDate(DateFormatter::FormatType t, time_t otime, - const QString& data, bool shortFormat, bool includeSecs ) + const TQString& data, bool shortFormat, bool includeSecs ) { DateFormatter f( t ); if ( t == DateFormatter::Custom ) { @@ -767,7 +767,7 @@ DateFormatter::formatDate(DateFormatter::FormatType t, time_t otime, } QString -DateFormatter::formatCurrentDate( DateFormatter::FormatType t, const QString& data, +DateFormatter::formatCurrentDate( DateFormatter::FormatType t, const TQString& data, bool shortFormat, bool includeSecs ) { DateFormatter f( t ); |