kmail: Avoid setting charset on non-textual parts of emails

Signed-off-by: Slávek Banko <slavek.banko@axis.cz>
pull/1/head
Slávek Banko 6 years ago
parent 8996740084
commit 3479159c7f

@ -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

@ -3286,7 +3286,6 @@ void KMComposeWin::slotAttachProperties()
}
}
}
if (msgPart->typeStr().lower() != "text") msgPart->setCharset(TQCString());
}
//-----------------------------------------------------------------------------

@ -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 );

@ -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 {

@ -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() ) {

Loading…
Cancel
Save