diff options
author | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2011-02-16 20:17:18 +0000 |
---|---|---|
committer | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2011-02-16 20:17:18 +0000 |
commit | f4fae92b6768541e2952173c3d4b09040f95bf7e (patch) | |
tree | d8c5d93232235cd635f3310b4d95490df181ba2d /kmail/kmmsgbase.cpp | |
parent | 125c0a08265b75a133644d3b55f47e37c919f45d (diff) | |
download | tdepim-f4fae92b6768541e2952173c3d4b09040f95bf7e.tar.gz tdepim-f4fae92b6768541e2952173c3d4b09040f95bf7e.zip |
Moved kpilot from kdepim to applications, as the core Trinity libraries should not contain hardware-dependent software
git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdepim@1221127 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'kmail/kmmsgbase.cpp')
-rw-r--r-- | kmail/kmmsgbase.cpp | 120 |
1 files changed, 60 insertions, 60 deletions
diff --git a/kmail/kmmsgbase.cpp b/kmail/kmmsgbase.cpp index e3d3fec15..71a1731ca 100644 --- a/kmail/kmmsgbase.cpp +++ b/kmail/kmmsgbase.cpp @@ -150,7 +150,7 @@ void KMMsgBase::toggleStatus(const KMMsgStatus aStatus, int idx) } //----------------------------------------------------------------------------- -void KMMsgBase::setStatus(const KMMsgStatus aStatus, int idx) +void KMMsgBase::seStatus(const KMMsgStatus aStatus, int idx) { mDirty = true; KMMsgStatus oldStatus = status(); @@ -267,40 +267,40 @@ void KMMsgBase::setStatus(const KMMsgStatus aStatus, int idx) //----------------------------------------------------------------------------- -void KMMsgBase::setStatus(const char* aStatusStr, const char* aXStatusStr) +void KMMsgBase::seStatus(const char* aStatusStr, const char* aXStatusStr) { // first try to find status from "X-Status" field if given if (aXStatusStr) { - if (strchr(aXStatusStr, 'N')) setStatus(KMMsgStatusNew); - if (strchr(aXStatusStr, 'U')) setStatus(KMMsgStatusUnread); - if (strchr(aXStatusStr, 'O')) setStatus(KMMsgStatusOld); - if (strchr(aXStatusStr, 'R')) setStatus(KMMsgStatusRead); - if (strchr(aXStatusStr, 'D')) setStatus(KMMsgStatusDeleted); - if (strchr(aXStatusStr, 'A')) setStatus(KMMsgStatusReplied); - if (strchr(aXStatusStr, 'F')) setStatus(KMMsgStatusForwarded); - if (strchr(aXStatusStr, 'Q')) setStatus(KMMsgStatusQueued); - if (strchr(aXStatusStr, 'K')) setStatus(KMMsgStatusTodo); - if (strchr(aXStatusStr, 'S')) setStatus(KMMsgStatusSent); - if (strchr(aXStatusStr, 'G')) setStatus(KMMsgStatusFlag); - if (strchr(aXStatusStr, 'P')) setStatus(KMMsgStatusSpam); - if (strchr(aXStatusStr, 'H')) setStatus(KMMsgStatusHam); - if (strchr(aXStatusStr, 'T')) setStatus(KMMsgStatusHasAttach); - if (strchr(aXStatusStr, 'C')) setStatus(KMMsgStatusHasNoAttach); + if (strchr(aXStatusStr, 'N')) seStatus(KMMsgStatusNew); + if (strchr(aXStatusStr, 'U')) seStatus(KMMsgStatusUnread); + if (strchr(aXStatusStr, 'O')) seStatus(KMMsgStatusOld); + if (strchr(aXStatusStr, 'R')) seStatus(KMMsgStatusRead); + if (strchr(aXStatusStr, 'D')) seStatus(KMMsgStatusDeleted); + if (strchr(aXStatusStr, 'A')) seStatus(KMMsgStatusReplied); + if (strchr(aXStatusStr, 'F')) seStatus(KMMsgStatusForwarded); + if (strchr(aXStatusStr, 'Q')) seStatus(KMMsgStatusQueued); + if (strchr(aXStatusStr, 'K')) seStatus(KMMsgStatusTodo); + if (strchr(aXStatusStr, 'S')) seStatus(KMMsgStatusSent); + if (strchr(aXStatusStr, 'G')) seStatus(KMMsgStatusFlag); + if (strchr(aXStatusStr, 'P')) seStatus(KMMsgStatusSpam); + if (strchr(aXStatusStr, 'H')) seStatus(KMMsgStatusHam); + if (strchr(aXStatusStr, 'T')) seStatus(KMMsgStatusHasAttach); + if (strchr(aXStatusStr, 'C')) seStatus(KMMsgStatusHasNoAttach); } // Merge the contents of the "Status" field if (aStatusStr) { if ((aStatusStr[0]== 'R' && aStatusStr[1]== 'O') || (aStatusStr[0]== 'O' && aStatusStr[1]== 'R')) { - setStatus( KMMsgStatusOld ); - setStatus( KMMsgStatusRead ); + seStatus( KMMsgStatusOld ); + seStatus( KMMsgStatusRead ); } else if (aStatusStr[0] == 'R') - setStatus(KMMsgStatusRead); + seStatus(KMMsgStatusRead); else if (aStatusStr[0] == 'D') - setStatus(KMMsgStatusDeleted); + seStatus(KMMsgStatusDeleted); else - setStatus(KMMsgStatusNew); + seStatus(KMMsgStatusNew); } } @@ -587,7 +587,7 @@ TQCString KMMsgBase::toUsAscii(const TQString& _str, bool *ok) TQString result = _str; int len = result.length(); for (int i = 0; i < len; i++) - if (result.at(i).unicode() >= 128) { + if (result.at(i).tqunicode() >= 128) { result.at(i) = '?'; all_ok = false; } @@ -800,7 +800,7 @@ TQCString KMMsgBase::encodeRFC2047String(const TQString& _str, unsigned int nonAscii = 0; unsigned int strLength(_str.length()); for (unsigned int i = 0; i < strLength; i++) - if (_str.at(i).unicode() >= 128) nonAscii++; + if (_str.at(i).tqunicode() >= 128) nonAscii++; bool useBase64 = (nonAscii * 6 > strLength); unsigned int start, stop, p, pos = 0, encLength; @@ -815,7 +815,7 @@ TQCString KMMsgBase::encodeRFC2047String(const TQString& _str, { if (!breakLine && (_str.at(p) == ' ' || dontQuote.find(_str.at(p)) != -1)) start = p + 1; - if (_str.at(p).unicode() >= 128 || _str.at(p).unicode() < 32) + if (_str.at(p).tqunicode() >= 128 || _str.at(p).tqunicode() < 32) break; p++; } @@ -1037,7 +1037,7 @@ TQCString KMMsgBase::autoDetectCharset(const TQCString &_encoding, const TQStrin TQStringList charsets = encodingList; if (!_encoding.isEmpty()) { - TQString currentCharset = TQString::fromLatin1(_encoding); + TQString currentCharset = TQString::tqfromLatin1(_encoding); charsets.remove(currentCharset); charsets.prepend(currentCharset); } @@ -1119,9 +1119,9 @@ static void swapEndian(TQString &str) { uint len = str.length(); str = TQDeepCopy<TQString>(str); - TQChar *unicode = const_cast<TQChar*>( str.unicode() ); + TQChar *tqunicode = const_cast<TQChar*>( str.tqunicode() ); for (uint i = 0; i < len; i++) - unicode[i] = kmail_swap_16(unicode[i].unicode()); + tqunicode[i] = kmail_swap_16(tqunicode[i].tqunicode()); } //----------------------------------------------------------------------------- @@ -1171,9 +1171,9 @@ retry: } MsgPartType type; - Q_UINT16 l; + TQ_UINT16 l; while(g_chunk_offset < mIndexLength) { - Q_UINT32 tmp; + TQ_UINT32 tmp; copy_from_stream(tmp); copy_from_stream(l); if (swapByteOrder) @@ -1193,7 +1193,7 @@ retry: } if(type == t) { // This works because the TQString constructor does a memcpy. - // Otherwise we would need to be concerned about the alignment. + // Otherwise we would need to be concerned about the tqalignment. if(l) ret = TQString((TQChar *)(g_chunk + g_chunk_offset), l/2); break; @@ -1248,9 +1248,9 @@ retry: } MsgPartType type; - Q_UINT16 l; + TQ_UINT16 l; while (g_chunk_offset < mIndexLength) { - Q_UINT32 tmp; + TQ_UINT32 tmp; copy_from_stream(tmp); copy_from_stream(l); if (swapByteOrder) @@ -1285,7 +1285,7 @@ retry: else if (sizeOfLong == 4) { // Long is stored as 4 bytes in index file, sizeof(long) = 8 - Q_UINT32 ret_32; + TQ_UINT32 ret_32; copy_from_stream(ret_32); if (swapByteOrder) ret_32 = kmail_swap_32(ret_32); @@ -1294,8 +1294,8 @@ retry: else if (sizeOfLong == 8) { // Long is stored as 8 bytes in index file, sizeof(long) = 4 - Q_UINT32 ret_1; - Q_UINT32 ret_2; + TQ_UINT32 ret_1; + TQ_UINT32 ret_2; copy_from_stream(ret_1); copy_from_stream(ret_2); if (!swapByteOrder) @@ -1347,8 +1347,8 @@ retry: int len2 = (len > 256) ? 256 : len; \ if(csize < (length + (len2 + sizeof(short) + sizeof(MsgPartType)))) \ ret = (uchar *)realloc(ret, csize += len2+sizeof(short)+sizeof(MsgPartType)); \ - Q_UINT32 t = (Q_UINT32) type; memcpy(ret+length, &t, sizeof(t)); \ - Q_UINT16 l = len2; memcpy(ret+length+sizeof(t), &l, sizeof(l)); \ + TQ_UINT32 t = (TQ_UINT32) type; memcpy(ret+length, &t, sizeof(t)); \ + TQ_UINT16 l = len2; memcpy(ret+length+sizeof(t), &l, sizeof(l)); \ if (network_order) \ memcpy_networkorder(ret+length+sizeof(t)+sizeof(l), x, len2); \ else \ @@ -1371,23 +1371,23 @@ const uchar *KMMsgBase::asIndexString(int &length) const //these is at the beginning because it is queried quite often tmp_str = msgIdMD5().stripWhiteSpace(); - STORE_DATA_LEN(MsgIdMD5Part, tmp_str.unicode(), tmp_str.length() * 2, true); + STORE_DATA_LEN(MsgIdMD5Part, tmp_str.tqunicode(), tmp_str.length() * 2, true); tmp = mLegacyStatus; STORE_DATA(MsgLegacyStatusPart, tmp); //these are completely arbitrary order tmp_str = fromStrip().stripWhiteSpace(); - STORE_DATA_LEN(MsgFromStripPart, tmp_str.unicode(), tmp_str.length() * 2, true); + STORE_DATA_LEN(MsgFromStripPart, tmp_str.tqunicode(), tmp_str.length() * 2, true); tmp_str = subject().stripWhiteSpace(); - STORE_DATA_LEN(MsgSubjectPart, tmp_str.unicode(), tmp_str.length() * 2, true); + STORE_DATA_LEN(MsgSubjectPart, tmp_str.tqunicode(), tmp_str.length() * 2, true); tmp_str = toStrip().stripWhiteSpace(); - STORE_DATA_LEN(MsgToStripPart, tmp_str.unicode(), tmp_str.length() * 2, true); + STORE_DATA_LEN(MsgToStripPart, tmp_str.tqunicode(), tmp_str.length() * 2, true); tmp_str = replyToIdMD5().stripWhiteSpace(); - STORE_DATA_LEN(MsgReplyToIdMD5Part, tmp_str.unicode(), tmp_str.length() * 2, true); + STORE_DATA_LEN(MsgReplyToIdMD5Part, tmp_str.tqunicode(), tmp_str.length() * 2, true); tmp_str = xmark().stripWhiteSpace(); - STORE_DATA_LEN(MsgXMarkPart, tmp_str.unicode(), tmp_str.length() * 2, true); + STORE_DATA_LEN(MsgXMarkPart, tmp_str.tqunicode(), tmp_str.length() * 2, true); tmp_str = fileName().stripWhiteSpace(); - STORE_DATA_LEN(MsgFilePart, tmp_str.unicode(), tmp_str.length() * 2, true); + STORE_DATA_LEN(MsgFilePart, tmp_str.tqunicode(), tmp_str.length() * 2, true); tmp = msgSize(); STORE_DATA(MsgSizePart, tmp); tmp = folderOffset(); @@ -1400,10 +1400,10 @@ const uchar *KMMsgBase::asIndexString(int &length) const STORE_DATA(MsgMDNSentPart, tmp); tmp_str = replyToAuxIdMD5().stripWhiteSpace(); - STORE_DATA_LEN(MsgReplyToAuxIdMD5Part, tmp_str.unicode(), tmp_str.length() * 2, true); + STORE_DATA_LEN(MsgReplyToAuxIdMD5Part, tmp_str.tqunicode(), tmp_str.length() * 2, true); tmp_str = strippedSubjectMD5().stripWhiteSpace(); - STORE_DATA_LEN(MsgStrippedSubjectMD5Part, tmp_str.unicode(), tmp_str.length() * 2, true); + STORE_DATA_LEN(MsgStrippedSubjectMD5Part, tmp_str.tqunicode(), tmp_str.length() * 2, true); tmp = status(); STORE_DATA(MsgStatusPart, tmp); @@ -1414,10 +1414,10 @@ const uchar *KMMsgBase::asIndexString(int &length) const STORE_DATA(MsgUIDPart, tmp); tmp_str = from(); - STORE_DATA_LEN( MsgFromPart, tmp_str.unicode(), tmp_str.length() * 2, true ); + STORE_DATA_LEN( MsgFromPart, tmp_str.tqunicode(), tmp_str.length() * 2, true ); tmp_str = to(); - STORE_DATA_LEN( MsgToPart, tmp_str.unicode(), tmp_str.length() * 2, true ); + STORE_DATA_LEN( MsgToPart, tmp_str.tqunicode(), tmp_str.length() * 2, true ); return ret; } @@ -1450,37 +1450,37 @@ void KMMsgBase::readConfig() sReplySubjPrefixes = composerGroup.readListEntry("reply-prefixes", ','); if (sReplySubjPrefixes.isEmpty()) sReplySubjPrefixes << "Re\\s*:" << "Re\\[\\d+\\]:" << "Re\\d+:"; - sReplaceSubjPrefix = composerGroup.readBoolEntry("replace-reply-prefix", true); + sReplaceSubjPrefix = composerGroup.readBoolEntry("tqreplace-reply-prefix", true); sForwardSubjPrefixes = composerGroup.readListEntry("forward-prefixes", ','); if (sForwardSubjPrefixes.isEmpty()) sForwardSubjPrefixes << "Fwd:" << "FW:"; - sReplaceForwSubjPrefix = composerGroup.readBoolEntry("replace-forward-prefix", true); + sReplaceForwSubjPrefix = composerGroup.readBoolEntry("tqreplace-forward-prefix", true); } //----------------------------------------------------------------------------- // static TQString KMMsgBase::stripOffPrefixes( const TQString& str ) { - return replacePrefixes( str, sReplySubjPrefixes + sForwardSubjPrefixes, + return tqreplacePrefixes( str, sReplySubjPrefixes + sForwardSubjPrefixes, true, TQString::null ).stripWhiteSpace(); } //----------------------------------------------------------------------------- // static -TQString KMMsgBase::replacePrefixes( const TQString& str, +TQString KMMsgBase::tqreplacePrefixes( const TQString& str, const TQStringList& prefixRegExps, - bool replace, + bool tqreplace, 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 - TQString bigRegExp = TQString::fromLatin1("^(?:\\s+|(?:%1))+\\s*") + TQString bigRegExp = TQString::tqfromLatin1("^(?:\\s+|(?:%1))+\\s*") .arg( prefixRegExps.join(")|(?:") ); TQRegExp rx( bigRegExp, false /*case insens.*/ ); if ( !rx.isValid() ) { - kdWarning(5006) << "KMMessage::replacePrefixes(): bigRegExp = \"" + kdWarning(5006) << "KMMessage::tqreplacePrefixes(): bigRegExp = \"" << bigRegExp << "\"\n" << "prefix regexp is invalid!" << endl; // try good ole Re/Fwd: @@ -1489,8 +1489,8 @@ TQString KMMsgBase::replacePrefixes( const TQString& str, TQString tmp = str; if ( rx.search( tmp ) == 0 ) { recognized = true; - if ( replace ) - return tmp.replace( 0, rx.matchedLength(), newPrefix + ' ' ); + if ( tqreplace ) + return tmp.tqreplace( 0, rx.matchedLength(), newPrefix + ' ' ); } } if ( !recognized ) @@ -1508,10 +1508,10 @@ TQString KMMsgBase::cleanSubject() const //----------------------------------------------------------------------------- TQString KMMsgBase::cleanSubject( const TQStringList & prefixRegExps, - bool replace, + bool tqreplace, const TQString & newPrefix ) const { - return KMMsgBase::replacePrefixes( subject(), prefixRegExps, replace, + return KMMsgBase::tqreplacePrefixes( subject(), prefixRegExps, tqreplace, newPrefix ); } |