diff options
Diffstat (limited to 'kmail/encodingdetector.cpp')
-rw-r--r-- | kmail/encodingdetector.cpp | 78 |
1 files changed, 39 insertions, 39 deletions
diff --git a/kmail/encodingdetector.cpp b/kmail/encodingdetector.cpp index e5881d6f7..60913c9fc 100644 --- a/kmail/encodingdetector.cpp +++ b/kmail/encodingdetector.cpp @@ -37,8 +37,8 @@ #include "encodingdetector_ja_p.h" -#include <qregexp.h> -#include <qtextcodec.h> +#include <tqregexp.h> +#include <tqtextcodec.h> #include <kglobal.h> #include <kcharsets.h> @@ -320,7 +320,7 @@ enum MIB MibUtf16LE = 1014 }; -static bool is16Bit(QTextCodec* codec) +static bool is16Bit(TQTextCodec* codec) { switch (codec->mibEnum()) { @@ -337,10 +337,10 @@ static bool is16Bit(QTextCodec* codec) class EncodingDetectorPrivate { public: - QTextCodec *m_codec; - QTextDecoder *m_decoder; // utf16 - QTextCodec *m_defaultCodec; - QCString m_storeDecoderName; + TQTextCodec *m_codec; + TQTextDecoder *m_decoder; // utf16 + TQTextCodec *m_defaultCodec; + TQCString m_storeDecoderName; EncodingDetector::EncodingChoiceSource m_source; EncodingDetector::AutoDetectScript m_autoDetectLanguage; @@ -351,10 +351,10 @@ public: bool m_analyzeCalled : 1; //for decode() int m_multiByte; - QCString m_bufferForDefferedEncDetection; + TQCString m_bufferForDefferedEncDetection; EncodingDetectorPrivate() - : m_codec(QTextCodec::codecForMib(MibLatin1)) + : m_codec(TQTextCodec::codecForMib(MibLatin1)) , m_decoder(m_codec->makeDecoder()) , m_defaultCodec(m_codec) , m_source(EncodingDetector::DefaultEncoding) @@ -367,7 +367,7 @@ public: { } - EncodingDetectorPrivate(QTextCodec* codec,EncodingDetector::EncodingChoiceSource source, EncodingDetector::AutoDetectScript script) + EncodingDetectorPrivate(TQTextCodec* codec,EncodingDetector::EncodingChoiceSource source, EncodingDetector::AutoDetectScript script) : m_codec(codec) , m_decoder(m_codec->makeDecoder()) , m_defaultCodec(m_codec) @@ -388,7 +388,7 @@ public: }; -static QCString automaticDetectionForArabic( const unsigned char* ptr, int size ) +static TQCString automaticDetectionForArabic( const unsigned char* ptr, int size ) { for ( int i = 0; i < size; ++i ) { if ( ( ptr[ i ] >= 0x80 && ptr[ i ] <= 0x9F ) || ptr[ i ] == 0xA1 || ptr[ i ] == 0xA2 || ptr[ i ] == 0xA3 @@ -402,7 +402,7 @@ static QCString automaticDetectionForArabic( const unsigned char* ptr, int size return "iso-8859-6"; } -static QCString automaticDetectionForBaltic( const unsigned char* ptr, int size ) +static TQCString automaticDetectionForBaltic( const unsigned char* ptr, int size ) { for ( int i = 0; i < size; ++i ) { if ( ( ptr[ i ] >= 0x80 && ptr[ i ] <= 0x9E ) ) @@ -415,9 +415,9 @@ static QCString automaticDetectionForBaltic( const unsigned char* ptr, int size return "iso-8859-13"; } -static QCString automaticDetectionForCentralEuropean(const unsigned char* ptr, int size ) +static TQCString automaticDetectionForCentralEuropean(const unsigned char* ptr, int size ) { - QCString charset; + TQCString charset; for ( int i = 0; i < size; ++i ) { if ( ptr[ i ] >= 0x80 && ptr[ i ] <= 0x9F ) { if ( ptr[ i ] == 0x81 || ptr[ i ] == 0x83 || ptr[ i ] == 0x90 || ptr[ i ] == 0x98 ) @@ -447,7 +447,7 @@ static QCString automaticDetectionForCentralEuropean(const unsigned char* ptr, i return charset.data(); } -static QCString automaticDetectionForCyrillic( const unsigned char* ptr, int size) +static TQCString automaticDetectionForCyrillic( const unsigned char* ptr, int size) { #ifdef DECODE_DEBUG kWarning() << "EncodingDetector: Cyr heuristics"; @@ -565,8 +565,8 @@ static QCString automaticDetectionForCyrillic( const unsigned char* ptr, int siz if (ibm866_small_range>cp1251_small_range+koi_small_range) return "ibm866"; -// QCString koi_string = "koi8-u"; -// QCString cp1251_string = "cp1251"; +// TQCString koi_string = "koi8-u"; +// TQCString cp1251_string = "cp1251"; if (cp1251_st==0 && koi_st>1) koi_score+=10; @@ -643,7 +643,7 @@ static QCString automaticDetectionForCyrillic( const unsigned char* ptr, int siz } -static QCString automaticDetectionForGreek( const unsigned char* ptr, int size ) +static TQCString automaticDetectionForGreek( const unsigned char* ptr, int size ) { for ( int i = 0; i < size; ++i ) { if ( ptr[ i ] == 0x80 || ( ptr[ i ] >= 0x82 && ptr[ i ] <= 0x87 ) || ptr[ i ] == 0x89 || ptr[ i ] == 0x8B @@ -656,7 +656,7 @@ static QCString automaticDetectionForGreek( const unsigned char* ptr, int size ) return "iso-8859-7"; } -static QCString automaticDetectionForHebrew( const unsigned char* ptr, int size ) +static TQCString automaticDetectionForHebrew( const unsigned char* ptr, int size ) { for ( int i = 0; i < size; ++i ) { if ( ptr[ i ] == 0x80 || ( ptr[ i ] >= 0x82 && ptr[ i ] <= 0x89 ) || ptr[ i ] == 0x8B @@ -672,7 +672,7 @@ static QCString automaticDetectionForHebrew( const unsigned char* ptr, int size return "iso-8859-8-i"; } -static QCString automaticDetectionForJapanese( const unsigned char* ptr, int size ) +static TQCString automaticDetectionForJapanese( const unsigned char* ptr, int size ) { JapaneseCode kc; @@ -692,7 +692,7 @@ static QCString automaticDetectionForJapanese( const unsigned char* ptr, int siz return ""; } -static QCString automaticDetectionForTurkish( const unsigned char* ptr, int size ) +static TQCString automaticDetectionForTurkish( const unsigned char* ptr, int size ) { for ( int i = 0; i < size; ++i ) { if ( ptr[ i ] == 0x80 || ( ptr[ i ] >= 0x82 && ptr[ i ] <= 0x8C ) || ( ptr[ i ] >= 0x91 && ptr[ i ] <= 0x9C ) || ptr[ i ] == 0x9F ) { @@ -703,7 +703,7 @@ static QCString automaticDetectionForTurkish( const unsigned char* ptr, int size return "iso-8859-9"; } -static QCString automaticDetectionForWesternEuropean( const unsigned char* ptr, int size ) +static TQCString automaticDetectionForWesternEuropean( const unsigned char* ptr, int size ) { uint nonansi_count=0; for (int i=0; i<size; ++i) @@ -765,7 +765,7 @@ static void skipComment(const char *&ptr, const char *pEnd) } // Returns the position of the encoding string. -static int findXMLEncoding(const QCString &str, int &encodingLength) +static int findXMLEncoding(const TQCString &str, int &encodingLength) { int len = str.length(); int pos = str.find("encoding"); @@ -878,7 +878,7 @@ EncodingDetector::EncodingDetector() : d(new EncodingDetectorPrivate) { } -EncodingDetector::EncodingDetector(QTextCodec* codec, EncodingChoiceSource source, AutoDetectScript script) : +EncodingDetector::EncodingDetector(TQTextCodec* codec, EncodingChoiceSource source, AutoDetectScript script) : d(new EncodingDetectorPrivate(codec,source,script)) { } @@ -913,20 +913,20 @@ bool EncodingDetector::visuallyOrdered() const return d->m_visualRTL; } -// const QTextCodec* EncodingDetector::codec() const +// const TQTextCodec* EncodingDetector::codec() const // { // return d->m_codec; // } -QTextDecoder* EncodingDetector::decoder() +TQTextDecoder* EncodingDetector::decoder() { return d->m_decoder; } bool EncodingDetector::setEncoding(const char *_encoding, EncodingChoiceSource type) { - QTextCodec *codec; - QCString enc(_encoding); + TQTextCodec *codec; + TQCString enc(_encoding); if(/*enc.isNull() || */enc.isEmpty()) { if (type==DefaultEncoding) @@ -960,8 +960,8 @@ bool EncodingDetector::setEncoding(const char *_encoding, EncodingChoiceSource t if (codec->mibEnum() == Mib8859_8) { - //We do NOT want to use Qt's QHebrewCodec, since it tries to reorder itself. - codec = QTextCodec::codecForName("iso8859-8-i"); + //We do NOT want to use Qt's TQHebrewCodec, since it tries to reorder itself. + codec = TQTextCodec::codecForName("iso8859-8-i"); // visually ordered unless one of the following if(!(enc=="iso-8859-8-i"||enc=="iso_8859-8-i"||enc=="csiso88598i"||enc=="logical")) @@ -978,7 +978,7 @@ bool EncodingDetector::setEncoding(const char *_encoding, EncodingChoiceSource t return true; } -bool EncodingDetector::analyze(const QByteArray &data) +bool EncodingDetector::analyze(const TQByteArray &data) { return analyze( data.data(), data.size() ); } @@ -1032,7 +1032,7 @@ bool EncodingDetector::analyze(const char *data, int len) if (autoDetectedEncoding != 0) { d->m_source = BOM; - d->m_codec = QTextCodec::codecForName(autoDetectedEncoding); + d->m_codec = TQTextCodec::codecForName(autoDetectedEncoding); assert(d->m_codec); //enc = d->m_codec->name(); delete d->m_decoder; @@ -1094,7 +1094,7 @@ bool EncodingDetector::analyze(const char *data, int len) end++; if (*end == '\0' || end == pEnd) break; - QCString str(ptr, end - ptr + 1); + TQCString str(ptr, end - ptr + 1); int length; int pos = findXMLEncoding(str, length); // also handles the case when specified encoding aint correct @@ -1136,7 +1136,7 @@ bool EncodingDetector::analyze(const char *data, int len) while(*end != '>' && *end != '\0' && end<pEnd) end++; //if ( *end == '\0' ) break; - QCString str( ptr, (end-ptr)+1); + TQCString str( ptr, (end-ptr)+1); str = str.lower(); int pos=0; //if( (pos = str.find("http-equiv", pos)) == -1) break; @@ -1243,7 +1243,7 @@ bool EncodingDetector::analyze(const char *data, int len) } -EncodingDetector::AutoDetectScript EncodingDetector::scriptForName(const QString& lang) +EncodingDetector::AutoDetectScript EncodingDetector::scriptForName(const TQString& lang) { if (lang.isEmpty()) return EncodingDetector::None; @@ -1305,7 +1305,7 @@ bool EncodingDetector::hasAutoDetectionForScript(EncodingDetector::AutoDetectScr } } -QString EncodingDetector::nameForScript(EncodingDetector::AutoDetectScript script) +TQString EncodingDetector::nameForScript(EncodingDetector::AutoDetectScript script) { switch (script) { @@ -1353,12 +1353,12 @@ QString EncodingDetector::nameForScript(EncodingDetector::AutoDetectScript scrip break; //case EncodingDetector::SemiautomaticDetection: default: - return QString(); + return TQString(); } } -EncodingDetector::AutoDetectScript EncodingDetector::scriptForLanguageCode(const QString &lc) +EncodingDetector::AutoDetectScript EncodingDetector::scriptForLanguageCode(const TQString &lc) { // It might make sense to do something special if the locale ends with // ".UTF-8" or "@utf8" @@ -1367,7 +1367,7 @@ EncodingDetector::AutoDetectScript EncodingDetector::scriptForLanguageCode(const for ( int i = 0; langStr; i++ ) { langStr = pango_script_for_lang[i].lang; // startsWith() works for empty strings: every string "starts with" an empty string. - if ( lc.startsWith( QString::fromAscii( langStr ) ) ) + if ( lc.startsWith( TQString::fromAscii( langStr ) ) ) return pango_script_for_lang[i].scripts[0]; } return None; |