diff options
Diffstat (limited to 'kmail/kmmsgbase.cpp')
-rw-r--r-- | kmail/kmmsgbase.cpp | 254 |
1 files changed, 127 insertions, 127 deletions
diff --git a/kmail/kmmsgbase.cpp b/kmail/kmmsgbase.cpp index 71a1731ca..aed324580 100644 --- a/kmail/kmmsgbase.cpp +++ b/kmail/kmmsgbase.cpp @@ -72,7 +72,7 @@ using KMail::MessageProperty; //----------------------------------------------------------------------------- KMMsgBase::KMMsgBase(KMFolder* aParentFolder) : mParent( aParentFolder ), mIndexOffset( 0 ), - mIndexLength( 0 ), mDirty( false ), mEnableUndo( false ), mStatus( KMMsgStatusUnknown ) + mIndexLength( 0 ), mDirty( false ), mEnableUndo( false ), mtqStatus( KMMsgStatusUnknown ) { } @@ -121,145 +121,145 @@ bool KMMsgBase::isMessage(void) const return false; } //----------------------------------------------------------------------------- -void KMMsgBase::toggleStatus(const KMMsgStatus aStatus, int idx) +void KMMsgBase::toggletqStatus(const KMMsgtqStatus atqStatus, int idx) { mDirty = true; - KMMsgStatus oldStatus = status(); - if ( status() & aStatus ) { - mStatus &= ~aStatus; + KMMsgtqStatus oldtqStatus = status(); + if ( status() & atqStatus ) { + mtqStatus &= ~atqStatus; } else { - mStatus |= aStatus; + mtqStatus |= atqStatus; // Ignored and Watched are toggleable, yet mutually exclusive. // That is an arbitrary restriction on my part. HAR HAR HAR :) -till - if (aStatus == KMMsgStatusWatched) - mStatus &= ~KMMsgStatusIgnored; - if (aStatus == KMMsgStatusIgnored) - mStatus &= ~KMMsgStatusWatched; - if (aStatus == KMMsgStatusSpam) - mStatus &= ~KMMsgStatusHam; - if (aStatus == KMMsgStatusHam) - mStatus &= ~KMMsgStatusSpam; + if (atqStatus == KMMsgStatusWatched) + mtqStatus &= ~KMMsgStatusIgnored; + if (atqStatus == KMMsgStatusIgnored) + mtqStatus &= ~KMMsgStatusWatched; + if (atqStatus == KMMsgStatusSpam) + mtqStatus &= ~KMMsgStatusHam; + if (atqStatus == KMMsgStatusHam) + mtqStatus &= ~KMMsgStatusSpam; } if (storage()) { if (idx < 0) - idx = storage()->find( this ); - storage()->msgStatusChanged( oldStatus, status(), idx ); + idx = storage()->tqfind( this ); + storage()->msgStatusChanged( oldtqStatus, status(), idx ); storage()->headerOfMsgChanged(this, idx); } } //----------------------------------------------------------------------------- -void KMMsgBase::seStatus(const KMMsgStatus aStatus, int idx) +void KMMsgBase::setqStatus(const KMMsgtqStatus atqStatus, int idx) { mDirty = true; - KMMsgStatus oldStatus = status(); - switch (aStatus) { + KMMsgtqStatus oldtqStatus = status(); + switch (atqStatus) { case KMMsgStatusRead: // Unset unread and new, set read - mStatus &= ~KMMsgStatusUnread; - mStatus &= ~KMMsgStatusNew; - mStatus |= KMMsgStatusRead; + mtqStatus &= ~KMMsgStatusUnread; + mtqStatus &= ~KMMsgStatusNew; + mtqStatus |= KMMsgStatusRead; break; case KMMsgStatusUnread: // unread overrides read - mStatus &= ~KMMsgStatusOld; - mStatus &= ~KMMsgStatusRead; - mStatus &= ~KMMsgStatusNew; - mStatus |= KMMsgStatusUnread; + mtqStatus &= ~KMMsgStatusOld; + mtqStatus &= ~KMMsgStatusRead; + mtqStatus &= ~KMMsgStatusNew; + mtqStatus |= KMMsgStatusUnread; break; case KMMsgStatusOld: // old can't be new or unread - mStatus &= ~KMMsgStatusNew; - mStatus &= ~KMMsgStatusUnread; - mStatus |= KMMsgStatusOld; + mtqStatus &= ~KMMsgStatusNew; + mtqStatus &= ~KMMsgStatusUnread; + mtqStatus |= KMMsgStatusOld; break; case KMMsgStatusNew: // new overrides old and read - mStatus &= ~KMMsgStatusOld; - mStatus &= ~KMMsgStatusRead; - mStatus &= ~KMMsgStatusUnread; - mStatus |= KMMsgStatusNew; + mtqStatus &= ~KMMsgStatusOld; + mtqStatus &= ~KMMsgStatusRead; + mtqStatus &= ~KMMsgStatusUnread; + mtqStatus |= KMMsgStatusNew; break; case KMMsgStatusDeleted: - mStatus |= KMMsgStatusDeleted; + mtqStatus |= KMMsgStatusDeleted; break; case KMMsgStatusReplied: - mStatus |= KMMsgStatusReplied; + mtqStatus |= KMMsgStatusReplied; break; case KMMsgStatusForwarded: - mStatus |= KMMsgStatusForwarded; + mtqStatus |= KMMsgStatusForwarded; break; case KMMsgStatusQueued: - mStatus |= KMMsgStatusQueued; + mtqStatus |= KMMsgStatusQueued; break; case KMMsgStatusTodo: - mStatus |= KMMsgStatusTodo; + mtqStatus |= KMMsgStatusTodo; break; case KMMsgStatusSent: - mStatus &= ~KMMsgStatusQueued; - mStatus &= ~KMMsgStatusUnread; - mStatus &= ~KMMsgStatusNew; - mStatus |= KMMsgStatusSent; + mtqStatus &= ~KMMsgStatusQueued; + mtqStatus &= ~KMMsgStatusUnread; + mtqStatus &= ~KMMsgStatusNew; + mtqStatus |= KMMsgStatusSent; break; case KMMsgStatusFlag: - mStatus |= KMMsgStatusFlag; + mtqStatus |= KMMsgStatusFlag; break; // Watched and ignored are mutually exclusive case KMMsgStatusWatched: - mStatus &= ~KMMsgStatusIgnored; - mStatus |= KMMsgStatusWatched; + mtqStatus &= ~KMMsgStatusIgnored; + mtqStatus |= KMMsgStatusWatched; break; case KMMsgStatusIgnored: - mStatus &= ~KMMsgStatusWatched; - mStatus |= KMMsgStatusIgnored; + mtqStatus &= ~KMMsgStatusWatched; + mtqStatus |= KMMsgStatusIgnored; break; // as are ham and spam case KMMsgStatusSpam: - mStatus &= ~KMMsgStatusHam; - mStatus |= KMMsgStatusSpam; + mtqStatus &= ~KMMsgStatusHam; + mtqStatus |= KMMsgStatusSpam; break; case KMMsgStatusHam: - mStatus &= ~KMMsgStatusSpam; - mStatus |= KMMsgStatusHam; + mtqStatus &= ~KMMsgStatusSpam; + mtqStatus |= KMMsgStatusHam; break; case KMMsgStatusHasAttach: - mStatus &= ~KMMsgStatusHasNoAttach; - mStatus |= KMMsgStatusHasAttach; + mtqStatus &= ~KMMsgStatusHasNoAttach; + mtqStatus |= KMMsgStatusHasAttach; break; case KMMsgStatusHasNoAttach: - mStatus &= ~KMMsgStatusHasAttach; - mStatus |= KMMsgStatusHasNoAttach; + mtqStatus &= ~KMMsgStatusHasAttach; + mtqStatus |= KMMsgStatusHasNoAttach; break; case KMMsgStatusHasInvitation: - mStatus &= ~KMMsgStatusHasNoInvitation; - mStatus |= KMMsgStatusHasInvitation; + mtqStatus &= ~KMMsgStatusHasNoInvitation; + mtqStatus |= KMMsgStatusHasInvitation; break; case KMMsgStatusHasNoInvitation: - mStatus &= ~KMMsgStatusHasInvitation; - mStatus |= KMMsgStatusHasNoInvitation; + mtqStatus &= ~KMMsgStatusHasInvitation; + mtqStatus |= KMMsgStatusHasNoInvitation; break; default: - mStatus = aStatus; + mtqStatus = atqStatus; break; } - if ( oldStatus != mStatus && storage() ) { + if ( oldtqStatus != mtqStatus && storage() ) { if (idx < 0) - idx = storage()->find( this ); - storage()->msgStatusChanged( oldStatus, status(), idx ); + idx = storage()->tqfind( this ); + storage()->msgStatusChanged( oldtqStatus, status(), idx ); storage()->headerOfMsgChanged( this, idx ); } } @@ -267,40 +267,40 @@ void KMMsgBase::seStatus(const KMMsgStatus aStatus, int idx) //----------------------------------------------------------------------------- -void KMMsgBase::seStatus(const char* aStatusStr, const char* aXStatusStr) +void KMMsgBase::setqStatus(const char* aStatusStr, const char* aXStatusStr) { - // first try to find status from "X-Status" field if given + // first try to find status from "X-tqStatus" field if given if (aXStatusStr) { - 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); + if (strchr(aXStatusStr, 'N')) setqStatus(KMMsgStatusNew); + if (strchr(aXStatusStr, 'U')) setqStatus(KMMsgStatusUnread); + if (strchr(aXStatusStr, 'O')) setqStatus(KMMsgStatusOld); + if (strchr(aXStatusStr, 'R')) setqStatus(KMMsgStatusRead); + if (strchr(aXStatusStr, 'D')) setqStatus(KMMsgStatusDeleted); + if (strchr(aXStatusStr, 'A')) setqStatus(KMMsgStatusReplied); + if (strchr(aXStatusStr, 'F')) setqStatus(KMMsgStatusForwarded); + if (strchr(aXStatusStr, 'Q')) setqStatus(KMMsgStatusQueued); + if (strchr(aXStatusStr, 'K')) setqStatus(KMMsgStatusTodo); + if (strchr(aXStatusStr, 'S')) setqStatus(KMMsgStatusSent); + if (strchr(aXStatusStr, 'G')) setqStatus(KMMsgStatusFlag); + if (strchr(aXStatusStr, 'P')) setqStatus(KMMsgStatusSpam); + if (strchr(aXStatusStr, 'H')) setqStatus(KMMsgStatusHam); + if (strchr(aXStatusStr, 'T')) setqStatus(KMMsgStatusHasAttach); + if (strchr(aXStatusStr, 'C')) setqStatus(KMMsgStatusHasNoAttach); } - // Merge the contents of the "Status" field + // Merge the contents of the "tqStatus" field if (aStatusStr) { if ((aStatusStr[0]== 'R' && aStatusStr[1]== 'O') || (aStatusStr[0]== 'O' && aStatusStr[1]== 'R')) { - seStatus( KMMsgStatusOld ); - seStatus( KMMsgStatusRead ); + setqStatus( KMMsgStatusOld ); + setqStatus( KMMsgStatusRead ); } else if (aStatusStr[0] == 'R') - seStatus(KMMsgStatusRead); + setqStatus(KMMsgStatusRead); else if (aStatusStr[0] == 'D') - seStatus(KMMsgStatusDeleted); + setqStatus(KMMsgStatusDeleted); else - seStatus(KMMsgStatusNew); + setqStatus(KMMsgStatusNew); } } @@ -363,117 +363,117 @@ void KMMsgBase::setSignatureStateChar( TQChar status, int idx ) //----------------------------------------------------------------------------- bool KMMsgBase::isUnread(void) const { - KMMsgStatus st = status(); + KMMsgtqStatus st = status(); return (st & KMMsgStatusUnread && !(st & KMMsgStatusIgnored)); } //----------------------------------------------------------------------------- bool KMMsgBase::isNew(void) const { - KMMsgStatus st = status(); + KMMsgtqStatus st = status(); return (st & KMMsgStatusNew && !(st & KMMsgStatusIgnored)); } //----------------------------------------------------------------------------- -bool KMMsgBase::isOfUnknownStatus(void) const +bool KMMsgBase::isOfUnknowntqStatus(void) const { - KMMsgStatus st = status(); + KMMsgtqStatus st = status(); return (st == KMMsgStatusUnknown); } //----------------------------------------------------------------------------- bool KMMsgBase::isOld(void) const { - KMMsgStatus st = status(); + KMMsgtqStatus st = status(); return (st & KMMsgStatusOld); } //----------------------------------------------------------------------------- bool KMMsgBase::isRead(void) const { - KMMsgStatus st = status(); + KMMsgtqStatus st = status(); return (st & KMMsgStatusRead || st & KMMsgStatusIgnored); } //----------------------------------------------------------------------------- bool KMMsgBase::isDeleted(void) const { - KMMsgStatus st = status(); + KMMsgtqStatus st = status(); return (st & KMMsgStatusDeleted); } //----------------------------------------------------------------------------- bool KMMsgBase::isReplied(void) const { - KMMsgStatus st = status(); + KMMsgtqStatus st = status(); return (st & KMMsgStatusReplied); } //----------------------------------------------------------------------------- bool KMMsgBase::isForwarded(void) const { - KMMsgStatus st = status(); + KMMsgtqStatus st = status(); return (st & KMMsgStatusForwarded); } //----------------------------------------------------------------------------- bool KMMsgBase::isQueued(void) const { - KMMsgStatus st = status(); + KMMsgtqStatus st = status(); return (st & KMMsgStatusQueued); } //----------------------------------------------------------------------------- bool KMMsgBase::isTodo(void) const { - KMMsgStatus st = status(); + KMMsgtqStatus st = status(); return (st & KMMsgStatusTodo); } //----------------------------------------------------------------------------- bool KMMsgBase::isSent(void) const { - KMMsgStatus st = status(); + KMMsgtqStatus st = status(); return (st & KMMsgStatusSent); } //----------------------------------------------------------------------------- bool KMMsgBase::isImportant(void) const { - KMMsgStatus st = status(); + KMMsgtqStatus st = status(); return (st & KMMsgStatusFlag); } //----------------------------------------------------------------------------- bool KMMsgBase::isWatched(void) const { - KMMsgStatus st = status(); + KMMsgtqStatus st = status(); return (st & KMMsgStatusWatched); } //----------------------------------------------------------------------------- bool KMMsgBase::isIgnored(void) const { - KMMsgStatus st = status(); + KMMsgtqStatus st = status(); return (st & KMMsgStatusIgnored); } //----------------------------------------------------------------------------- bool KMMsgBase::isSpam(void) const { - KMMsgStatus st = status(); + KMMsgtqStatus st = status(); return (st & KMMsgStatusSpam); } //----------------------------------------------------------------------------- bool KMMsgBase::isHam(void) const { - KMMsgStatus st = status(); + KMMsgtqStatus st = status(); return (st & KMMsgStatusHam); } //----------------------------------------------------------------------------- -TQCString KMMsgBase::statusToStr(const KMMsgStatus status) +TQCString KMMsgBase::statusToStr(const KMMsgtqStatus status) { TQCString sstr; if (status & KMMsgStatusNew) sstr += 'N'; @@ -608,7 +608,7 @@ TQStringList KMMsgBase::supportedEncodings(bool usAscii) { TQTextCodec *codec = KGlobal::charsets()->codecForName(*it); TQString mimeName = (codec) ? TQString(codec->mimeName()).lower() : (*it); - if (mimeNames.find(mimeName) == mimeNames.end()) + if (mimeNames.tqfind(mimeName) == mimeNames.end()) { encodings.append(KGlobal::charsets()->languageForEncoding(*it) + " ( " + mimeName + " )"); @@ -658,14 +658,14 @@ namespace { TQString KMMsgBase::decodeRFC2047String(const TQCString& aStr, TQCString prefCharset) { if ( aStr.isEmpty() ) - return TQString::null; + return TQString(); const TQCString str = unfold( aStr ); if ( str.isEmpty() ) - return TQString::null; + return TQString(); - if ( str.find( "=?" ) < 0 ) { + if ( str.tqfind( "=?" ) < 0 ) { if ( !prefCharset.isEmpty() && kmkernel->isCodecAsciiCompatible( KMMsgBase::codecForName( prefCharset ) ) ) { if ( prefCharset == "us-ascii" ) { @@ -813,7 +813,7 @@ TQCString KMMsgBase::encodeRFC2047String(const TQString& _str, start = pos; p = pos; while (p < strLength) { - if (!breakLine && (_str.at(p) == ' ' || dontQuote.find(_str.at(p)) != -1)) + if (!breakLine && (_str.at(p) == ' ' || dontQuote.tqfind(_str.at(p)) != -1)) start = p + 1; if (_str.at(p).tqunicode() >= 128 || _str.at(p).tqunicode() < 32) break; @@ -821,9 +821,9 @@ TQCString KMMsgBase::encodeRFC2047String(const TQString& _str, } if (breakLine || p < strLength) { - while (dontQuote.find(_str.at(start)) != -1) start++; + while (dontQuote.tqfind(_str.at(start)) != -1) start++; stop = start; - while (stop < strLength && dontQuote.find(_str.at(stop)) == -1) + while (stop < strLength && dontQuote.tqfind(_str.at(stop)) == -1) stop++; result += _str.mid(pos, start - pos).latin1(); encLength = encodeRFC2047Quoted(codec->fromUnicode(_str. @@ -946,7 +946,7 @@ TQCString KMMsgBase::encodeRFC2231StringAutoDetectCharset( const TQString &str, //----------------------------------------------------------------------------- TQString KMMsgBase::decodeRFC2231String(const TQCString& _str) { - int p = _str.find('\''); + int p = _str.tqfind('\''); if (p < 0) return kmkernel->networkCodec()->toUnicode(_str); TQCString charset = _str.left(p); @@ -996,10 +996,10 @@ TQCString KMMsgBase::extractRFC2231HeaderField( const TQCString &aStr, const TQC // Quoted values end at the ending quote if ( aStr[startPart] == '"' ) { startPart++; // the double quote isn't part of the filename - endPart = aStr.find('"', startPart) - 1; + endPart = aStr.tqfind('"', startPart) - 1; } else { - endPart = aStr.find(';', startPart) - 1; + endPart = aStr.tqfind(';', startPart) - 1; } if (endPart < 0) endPart = 32767; @@ -1081,7 +1081,7 @@ unsigned long KMMsgBase::getMsgSerNum() const if (msn) return msn; if (mParent) { - int index = mParent->find((KMMsgBase*)this); + int index = mParent->tqfind((KMMsgBase*)this); msn = KMMsgDict::instance()->getMsgSerNum(mParent, index); if (msn) MessageProperty::setSerialCache( this, msn ); @@ -1093,7 +1093,7 @@ unsigned long KMMsgBase::getMsgSerNum() const //----------------------------------------------------------------------------- KMMsgAttachmentState KMMsgBase::attachmentState() const { - KMMsgStatus st = status(); + KMMsgtqStatus st = status(); if (st & KMMsgStatusHasAttach) return KMMsgHasAttachment; else if (st & KMMsgStatusHasNoAttach) @@ -1105,7 +1105,7 @@ KMMsgAttachmentState KMMsgBase::attachmentState() const KMMsgInvitationState KMMsgBase::invitationState() const { - KMMsgStatus st = status(); + KMMsgtqStatus st = status(); if (st & KMMsgStatusHasInvitation) return KMMsgHasInvitation; else if (st & KMMsgStatusHasNoInvitation) @@ -1204,9 +1204,9 @@ retry: g_chunk_length = 0; g_chunk = 0; } - // Normally we need to swap the byte order because the QStrings are written - // in the style of Qt2 (MSB -> network ordered). - // QStrings in Qt3 expect host ordering. + // Normally we need to swap the byte order because the TQStrings are written + // in the style of TQt2 (MSB -> network ordered). + // TQStrings in TQt3 expect host ordering. // On e.g. Intel host ordering is LSB, on e.g. Sparc it is MSB. #ifndef WORDS_BIGENDIAN @@ -1372,7 +1372,7 @@ 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.tqunicode(), tmp_str.length() * 2, true); - tmp = mLegacyStatus; + tmp = mLegacytqStatus; STORE_DATA(MsgLegacyStatusPart, tmp); //these are completely arbitrary order @@ -1461,13 +1461,13 @@ void KMMsgBase::readConfig() // static TQString KMMsgBase::stripOffPrefixes( const TQString& str ) { - return tqreplacePrefixes( str, sReplySubjPrefixes + sForwardSubjPrefixes, - true, TQString::null ).stripWhiteSpace(); + return replacePrefixes( str, sReplySubjPrefixes + sForwardSubjPrefixes, + true, TQString() ).stripWhiteSpace(); } //----------------------------------------------------------------------------- // static -TQString KMMsgBase::tqreplacePrefixes( const TQString& str, +TQString KMMsgBase::replacePrefixes( const TQString& str, const TQStringList& prefixRegExps, bool tqreplace, const TQString& newPrefix ) @@ -1480,7 +1480,7 @@ TQString KMMsgBase::tqreplacePrefixes( const TQString& str, .arg( prefixRegExps.join(")|(?:") ); TQRegExp rx( bigRegExp, false /*case insens.*/ ); if ( !rx.isValid() ) { - kdWarning(5006) << "KMMessage::tqreplacePrefixes(): bigRegExp = \"" + kdWarning(5006) << "KMMessage::replacePrefixes(): bigRegExp = \"" << bigRegExp << "\"\n" << "prefix regexp is invalid!" << endl; // try good ole Re/Fwd: @@ -1503,7 +1503,7 @@ TQString KMMsgBase::tqreplacePrefixes( const TQString& str, TQString KMMsgBase::cleanSubject() const { return cleanSubject( sReplySubjPrefixes + sForwardSubjPrefixes, - true, TQString::null ).stripWhiteSpace(); + true, TQString() ).stripWhiteSpace(); } //----------------------------------------------------------------------------- @@ -1511,7 +1511,7 @@ TQString KMMsgBase::cleanSubject( const TQStringList & prefixRegExps, bool tqreplace, const TQString & newPrefix ) const { - return KMMsgBase::tqreplacePrefixes( subject(), prefixRegExps, tqreplace, + return KMMsgBase::replacePrefixes( subject(), prefixRegExps, tqreplace, newPrefix ); } |