summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSlávek Banko <slavek.banko@axis.cz>2018-03-25 20:20:07 +0200
committerSlávek Banko <slavek.banko@axis.cz>2018-03-25 20:20:07 +0200
commit3479159c7ff5c918af12e29a32367843f336b57f (patch)
tree51f02c82108522fccf6ece95e926dfa29a1a8dc3
parent8996740084e6d31d323cfeb1a269f8427ff3f6bf (diff)
downloadtdepim-3479159c7ff5c918af12e29a32367843f336b57f.tar.gz
tdepim-3479159c7ff5c918af12e29a32367843f336b57f.zip
kmail: Avoid setting charset on non-textual parts of emails
Signed-off-by: Slávek Banko <slavek.banko@axis.cz>
-rw-r--r--kmail/kmcommands.cpp7
-rw-r--r--kmail/kmcomposewin.cpp1
-rw-r--r--kmail/kmkernel.cpp3
-rw-r--r--kmail/kmmessage.cpp7
-rw-r--r--kmail/messagecomposer.cpp4
5 files changed, 13 insertions, 9 deletions
diff --git a/kmail/kmcommands.cpp b/kmail/kmcommands.cpp
index 8b477924f..a61850132 100644
--- a/kmail/kmcommands.cpp
+++ b/kmail/kmcommands.cpp
@@ -1350,13 +1350,10 @@ KMCommand::Result KMForwardAttachedCommand::execute()
KMMessagePart *msgPart = new KMMessagePart;
msgPart->setTypeStr("message");
msgPart->setSubtypeStr("rfc822");
- msgPart->setCharset(msg->charset());
msgPart->setName("forwarded message");
msgPart->setContentDescription(msg->from()+": "+msg->subject());
msgPart->setContentDisposition( "inline" );
- // THIS HAS TO BE AFTER setCte()!!!!
msgPart->setMessageBody( KMail::Util::ByteArray( msg->asDwString() ) );
- msgPart->setCharset("");
fwdMsg->link(msg, KMMsgStatusForwarded);
mWin->addAttach(msgPart);
@@ -2893,7 +2890,9 @@ KMCommand::Result KMResendMessageCommand::execute()
whiteList << "To" << "Cc" << "Bcc" << "Subject";
newMsg->sanitizeHeaders( whiteList );
- newMsg->setCharset(msg->codec()->mimeName());
+ if( newMsg->type() == DwMime::kTypeText) {
+ newMsg->setCharset(msg->codec()->mimeName());
+ }
newMsg->setParent( 0 );
// make sure we have an identity set, default, if necessary
diff --git a/kmail/kmcomposewin.cpp b/kmail/kmcomposewin.cpp
index c0b66ab5d..2add2b3a8 100644
--- a/kmail/kmcomposewin.cpp
+++ b/kmail/kmcomposewin.cpp
@@ -3286,7 +3286,6 @@ void KMComposeWin::slotAttachProperties()
}
}
}
- if (msgPart->typeStr().lower() != "text") msgPart->setCharset(TQCString());
}
//-----------------------------------------------------------------------------
diff --git a/kmail/kmkernel.cpp b/kmail/kmkernel.cpp
index fb22fca2e..f998a74c3 100644
--- a/kmail/kmkernel.cpp
+++ b/kmail/kmkernel.cpp
@@ -45,6 +45,7 @@ using TDERecentAddress::RecentAddresses;
#include "kmsystemtray.h"
#include "transportmanager.h"
#include "importarchivedialog.h"
+#include <mimelib/enum.h>
#include <twin.h>
#include "kmailicalifaceimpl.h"
@@ -574,7 +575,7 @@ int KMKernel::openComposer (const TQString &to, const TQString &cc,
if( ! GlobalSettings::self()->exchangeCompatibleInvitations() ) {
msgPart->setContentDisposition( attachContDisp );
}
- if( !attachCharset.isEmpty() ) {
+ if( !attachCharset.isEmpty() && (msgPart->type() == DwMime::kTypeText) ) {
// kdDebug(5006) << "KMKernel::openComposer set attachCharset to "
// << attachCharset << endl;
msgPart->setCharset( attachCharset );
diff --git a/kmail/kmmessage.cpp b/kmail/kmmessage.cpp
index c33fdf6a2..d99614785 100644
--- a/kmail/kmmessage.cpp
+++ b/kmail/kmmessage.cpp
@@ -3055,8 +3055,11 @@ void applyHeadersToMessagePart( DwHeaders& headers, KMMessagePart* aPart )
DwParameter *param = ct.FirstParameter();
while(param)
{
- if (!tqstricmp(param->Attribute().c_str(), "charset"))
- aPart->setCharset(TQCString(param->Value().c_str()).lower());
+ if (!tqstricmp(param->Attribute().c_str(), "charset")) {
+ if (aPart->type() == DwMime::kTypeText) {
+ aPart->setCharset(TQCString(param->Value().c_str()).lower());
+ }
+ }
else if (!tqstrnicmp(param->Attribute().c_str(), "name*", 5))
aPart->setName(KMMsgBase::decodeRFC2231String(KMMsgBase::extractRFC2231HeaderField( param->Value().c_str(), "name" )));
else {
diff --git a/kmail/messagecomposer.cpp b/kmail/messagecomposer.cpp
index 2a82da9e4..9b5763dd0 100644
--- a/kmail/messagecomposer.cpp
+++ b/kmail/messagecomposer.cpp
@@ -1251,7 +1251,9 @@ void MessageComposer::composeInlineOpenPGPMessage( KMMessage& theMessage,
}
mOldBodyPart.setContentDisposition( "inline" );
mOldBodyPart.setOriginalContentTypeStr( oldContentType.utf8() );
- mOldBodyPart.setCharset(mCharset);
+ if (mOldBodyPart.type() == DwMime::kTypeText) {
+ mOldBodyPart.setCharset(mCharset);
+ }
addBodyAndAttachments( msg, splitInfo, false, false, mOldBodyPart, Kleo::InlineOpenPGPFormat );
mMessageList.push_back( msg );
if ( it == splitInfos.begin() ) {