File kdepim-trinity-avoid-charset-on-nontext.patch of Package kdepim3
diff -Naru kdepim-3.5.10_orig/kmail/kmcommands.cpp kdepim-3.5.10/kmail/kmcommands.cpp
--- kdepim-3.5.10_orig/kmail/kmcommands.cpp 2018-04-23 03:21:10.353536944 +0000
+++ kdepim-3.5.10/kmail/kmcommands.cpp 2018-04-23 03:23:47.835095819 +0000
@@ -1309,13 +1309,10 @@
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);
@@ -2828,7 +2825,9 @@
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 -Naru kdepim-3.5.10_orig/kmail/kmcomposewin.cpp kdepim-3.5.10/kmail/kmcomposewin.cpp
--- kdepim-3.5.10_orig/kmail/kmcomposewin.cpp 2008-08-19 18:15:47.000000000 +0000
+++ kdepim-3.5.10/kmail/kmcomposewin.cpp 2018-04-23 03:24:36.182333584 +0000
@@ -3206,7 +3206,6 @@
}
}
}
- if (msgPart->typeStr().lower() != "text") msgPart->setCharset(QCString());
}
//-----------------------------------------------------------------------------
diff -Naru kdepim-3.5.10_orig/kmail/kmkernel.cpp kdepim-3.5.10/kmail/kmkernel.cpp
--- kdepim-3.5.10_orig/kmail/kmkernel.cpp 2018-04-23 03:21:10.377536576 +0000
+++ kdepim-3.5.10/kmail/kmkernel.cpp 2018-04-23 03:25:58.397155972 +0000
@@ -44,6 +44,7 @@
#include "kmcommands.h"
#include "kmsystemtray.h"
#include "transportmanager.h"
+#include <mimelib/enum.h>
#include <kwin.h>
#include "kmailicalifaceimpl.h"
@@ -536,7 +537,7 @@
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 -Naru kdepim-3.5.10_orig/kmail/kmmessage.cpp kdepim-3.5.10/kmail/kmmessage.cpp
--- kdepim-3.5.10_orig/kmail/kmmessage.cpp 2008-08-19 18:15:47.000000000 +0000
+++ kdepim-3.5.10/kmail/kmmessage.cpp 2018-04-23 03:33:16.582778683 +0000
@@ -3016,8 +3016,11 @@
DwParameter *param = ct.FirstParameter();
while(param)
{
- if (!qstricmp(param->Attribute().c_str(), "charset"))
- aPart->setCharset(QCString(param->Value().c_str()).lower());
+ if (!qstricmp(param->Attribute().c_str(), "charset")) {
+ if (aPart->type() == DwMime::kTypeText) {
+ aPart->setCharset(QCString(param->Value().c_str()).lower());
+ }
+ }
else if (!qstrnicmp(param->Attribute().c_str(), "name*", 5))
aPart->setName(KMMsgBase::decodeRFC2231String(KMMsgBase::extractRFC2231HeaderField( param->Value().c_str(), "name" )));
else {
diff -Naru kdepim-3.5.10_orig/kmail/messagecomposer.cpp kdepim-3.5.10/kmail/messagecomposer.cpp
--- kdepim-3.5.10_orig/kmail/messagecomposer.cpp 2008-02-13 09:39:37.000000000 +0000
+++ kdepim-3.5.10/kmail/messagecomposer.cpp 2018-04-23 03:27:55.607517191 +0000
@@ -1253,7 +1253,9 @@
}
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() ) {