From cc29364f06178f8f6b457384f2ec37a042bd9d43 Mon Sep 17 00:00:00 2001 From: tpearson Date: Wed, 1 Sep 2010 00:37:02 +0000 Subject: * Massive set of changes to bring in all fixes and enhancements from the Enterprise PIM branch * Ensured that the Trinity changes were applied on top of those enhancements, and any redundancy removed * Added journal read support to the CalDAV resource * Fixed CalDAV resource to use events URL for tasks and journals when separate URL checkbox unchecked git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdepim@1170461 283d02a7-25f6-0310-bc7c-ecb5cbfe19da --- kmail/kmsearchpattern.cpp | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) (limited to 'kmail/kmsearchpattern.cpp') diff --git a/kmail/kmsearchpattern.cpp b/kmail/kmsearchpattern.cpp index bec476ef..3d97a2b3 100644 --- a/kmail/kmsearchpattern.cpp +++ b/kmail/kmsearchpattern.cpp @@ -27,6 +27,8 @@ using KMail::FilterLog; #include #include +#include +#include #include @@ -58,7 +60,8 @@ static struct _statusNames statusNames[] = { { "To Do", KMMsgStatusTodo }, { "Spam", KMMsgStatusSpam }, { "Ham", KMMsgStatusHam }, - { "Has Attachment", KMMsgStatusHasAttach } + { "Has Attachment", KMMsgStatusHasAttach }, + { "Invitation", KMMsgStatusHasInvitation } }; static const int numStatusNames = sizeof statusNames / sizeof ( struct _statusNames ); @@ -280,7 +283,7 @@ bool KMSearchRuleString::matches( const DwString & aStr, KMMessage & msg, start += headerLen; size_t stop = aStr.find( '\n', start ); char ch = '\0'; - while ( stop != DwString::npos && ( ch = aStr.at( stop + 1 ) ) == ' ' || ch == '\t' ) + while ( stop != DwString::npos && ( ( ch = aStr.at( stop + 1 ) ) == ' ' || ch == '\t' ) ) stop = aStr.find( '\n', stop + 1 ); const int len = stop == DwString::npos ? aStr.length() - start : stop - start ; const TQCString codedValue( aStr.data() + start, len + 1 ); @@ -333,7 +336,19 @@ bool KMSearchRuleString::matches( const KMMessage * msg ) const bool logContents = true; if( field() == "" ) { - msgContents = msg->asString(); + + // When searching in the complete message, we can't simply use msg->asString() here, + // as that wouldn't decode the body. Therefore we use the decoded body and all decoded + // header fields and add all to the one big search string. + msgContents += msg->bodyToUnicode(); + const DwHeaders& headers = msg->headers(); + const DwField * dwField = headers.FirstField(); + while( dwField != 0 ) { + const char * const fieldName = dwField->FieldNameStr().c_str(); + const TQString fieldValue = msg->headerFields( fieldName ).join( " " ); + msgContents += " " + fieldValue; + dwField = dwField->Next(); + } logContents = false; } else if ( field() == "" ) { msgContents = msg->bodyToUnicode(); -- cgit v1.2.3