summaryrefslogtreecommitdiffstats
path: root/kmail/kmmsgbase.cpp
diff options
context:
space:
mode:
authortpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2010-09-01 00:37:02 +0000
committertpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2010-09-01 00:37:02 +0000
commitcc29364f06178f8f6b457384f2ec37a042bd9d43 (patch)
tree7c77a3184c698bbf9d98cef09fb1ba8124daceba /kmail/kmmsgbase.cpp
parent4f6c584bacc8c3c694228f36ada3de77a76614a6 (diff)
downloadtdepim-cc29364f06178f8f6b457384f2ec37a042bd9d43.tar.gz
tdepim-cc29364f06178f8f6b457384f2ec37a042bd9d43.zip
* 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
Diffstat (limited to 'kmail/kmmsgbase.cpp')
-rw-r--r--kmail/kmmsgbase.cpp51
1 files changed, 47 insertions, 4 deletions
diff --git a/kmail/kmmsgbase.cpp b/kmail/kmmsgbase.cpp
index df53e6e57..e3d3fec15 100644
--- a/kmail/kmmsgbase.cpp
+++ b/kmail/kmmsgbase.cpp
@@ -243,6 +243,14 @@ void KMMsgBase::setStatus(const KMMsgStatus aStatus, int idx)
mStatus &= ~KMMsgStatusHasAttach;
mStatus |= KMMsgStatusHasNoAttach;
break;
+ case KMMsgStatusHasInvitation:
+ mStatus &= ~KMMsgStatusHasNoInvitation;
+ mStatus |= KMMsgStatusHasInvitation;
+ break;
+ case KMMsgStatusHasNoInvitation:
+ mStatus &= ~KMMsgStatusHasInvitation;
+ mStatus |= KMMsgStatusHasNoInvitation;
+ break;
default:
mStatus = aStatus;
break;
@@ -658,7 +666,8 @@ TQString KMMsgBase::decodeRFC2047String(const TQCString& aStr, TQCString prefCha
return TQString::null;
if ( str.find( "=?" ) < 0 ) {
- if ( !prefCharset.isEmpty() ) {
+ if ( !prefCharset.isEmpty() &&
+ kmkernel->isCodecAsciiCompatible( KMMsgBase::codecForName( prefCharset ) ) ) {
if ( prefCharset == "us-ascii" ) {
// isn`t this foolproof?
return KMMsgBase::codecForName( "utf-8" )->toUnicode( str );
@@ -666,9 +675,15 @@ TQString KMMsgBase::decodeRFC2047String(const TQCString& aStr, TQCString prefCha
return KMMsgBase::codecForName( prefCharset )->toUnicode( str );
}
} else {
- return KMMsgBase::codecForName( GlobalSettings::self()->
+ if ( kmkernel->isCodecAsciiCompatible( KMMsgBase::codecForName(
+ GlobalSettings::self()->fallbackCharacterEncoding().latin1() ) ) ) {
+ return KMMsgBase::codecForName( GlobalSettings::self()->
fallbackCharacterEncoding().latin1() )->toUnicode( str );
+ }
}
+
+ // Not RFC2047 encoded, and codec not ascii-compatible -> interpret as ascii
+ return TQString::fromAscii( str );
}
TQString result;
@@ -917,6 +932,16 @@ TQCString KMMsgBase::encodeRFC2231String( const TQString& _str,
return result;
}
+//-----------------------------------------------------------------------------
+TQCString KMMsgBase::encodeRFC2231StringAutoDetectCharset( const TQString &str,
+ const TQCString &defaultCharset )
+{
+ TQCString encoding = KMMsgBase::autoDetectCharset( defaultCharset,
+ KMMessage::preferredCharsets(), str );
+ if ( encoding.isEmpty() )
+ encoding = "utf-8";
+ return KMMsgBase::encodeRFC2231String( str, encoding );
+}
//-----------------------------------------------------------------------------
TQString KMMsgBase::decodeRFC2231String(const TQCString& _str)
@@ -1077,6 +1102,18 @@ KMMsgAttachmentState KMMsgBase::attachmentState() const
return KMMsgAttachmentUnknown;
}
+
+KMMsgInvitationState KMMsgBase::invitationState() const
+{
+ KMMsgStatus st = status();
+ if (st & KMMsgStatusHasInvitation)
+ return KMMsgHasInvitation;
+ else if (st & KMMsgStatusHasNoInvitation)
+ return KMMsgHasNoInvitation;
+ else
+ return KMMsgInvitationUnknown;
+}
+
//-----------------------------------------------------------------------------
static void swapEndian(TQString &str)
{
@@ -1340,11 +1377,11 @@ const uchar *KMMsgBase::asIndexString(int &length) const
//these are completely arbitrary order
tmp_str = fromStrip().stripWhiteSpace();
- STORE_DATA_LEN(MsgFromPart, tmp_str.unicode(), tmp_str.length() * 2, true);
+ STORE_DATA_LEN(MsgFromStripPart, tmp_str.unicode(), tmp_str.length() * 2, true);
tmp_str = subject().stripWhiteSpace();
STORE_DATA_LEN(MsgSubjectPart, tmp_str.unicode(), tmp_str.length() * 2, true);
tmp_str = toStrip().stripWhiteSpace();
- STORE_DATA_LEN(MsgToPart, tmp_str.unicode(), tmp_str.length() * 2, true);
+ STORE_DATA_LEN(MsgToStripPart, tmp_str.unicode(), tmp_str.length() * 2, true);
tmp_str = replyToIdMD5().stripWhiteSpace();
STORE_DATA_LEN(MsgReplyToIdMD5Part, tmp_str.unicode(), tmp_str.length() * 2, true);
tmp_str = xmark().stripWhiteSpace();
@@ -1376,6 +1413,12 @@ const uchar *KMMsgBase::asIndexString(int &length) const
tmp = UID();
STORE_DATA(MsgUIDPart, tmp);
+ tmp_str = from();
+ STORE_DATA_LEN( MsgFromPart, tmp_str.unicode(), tmp_str.length() * 2, true );
+
+ tmp_str = to();
+ STORE_DATA_LEN( MsgToPart, tmp_str.unicode(), tmp_str.length() * 2, true );
+
return ret;
}
#undef STORE_DATA_LEN