Commit 89a54c55 authored by Laurent Montel's avatar Laurent Montel 😁

Fix duplicate code

parent 39ba9fac
......@@ -19,6 +19,7 @@
#include "sendlaterinfo.h"
#include "messagecomposer/sender/akonadisender.h"
#include "messagecomposer/utils/util.h"
#include "messagecore/helpers/messagehelpers.h"
#include "messagecore/utils/stringutil.h"
......@@ -127,9 +128,7 @@ void SendLaterJob::updateAndCleanMessageBeforeSending(const KMime::Message::Ptr
{
msg->date()->setDateTime( KDateTime::currentLocalDateTime() );
MessageCore::StringUtil::removePrivateHeaderFields(msg, true);
msg->removeHeader( "X-KMail-SignatureActionEnabled" );
msg->removeHeader( "X-KMail-EncryptActionEnabled" );
msg->removeHeader( "X-KMail-CryptoMessageFormat" );
MessageComposer::Util::removeNotNecessaryHeaders(msg);
msg->assemble();
}
......
......@@ -297,9 +297,7 @@ void MessageComposer::ComposerViewBase::send ( MessageComposer::MessageSender::S
m_encrypt ? QLatin1String( "true" ) : QLatin1String( "false" ), "utf-8" ) );
m_msg->setHeader( new KMime::Headers::Generic( "X-KMail-CryptoMessageFormat", m_msg.get(), QString::number( m_cryptoMessageFormat ), "utf-8" ) );
} else {
m_msg->removeHeader( "X-KMail-SignatureActionEnabled" );
m_msg->removeHeader( "X-KMail-EncryptActionEnabled" );
m_msg->removeHeader( "X-KMail-CryptoMessageFormat" );
MessageComposer::Util::removeNotNecessaryHeaders(m_msg);
}
if( mSendMethod == MessageComposer::MessageSender::SendImmediate && checkMailDispatcher)
......
......@@ -356,3 +356,9 @@ void MessageComposer::Util::addTextBox(QTextEdit *edit)
}
}
void MessageComposer::Util::removeNotNecessaryHeaders(const KMime::Message::Ptr &msg)
{
msg->removeHeader( "X-KMail-SignatureActionEnabled" );
msg->removeHeader( "X-KMail-EncryptActionEnabled" );
msg->removeHeader( "X-KMail-CryptoMessageFormat" );
}
......@@ -83,6 +83,7 @@ void addSendReplyForwardAction(const KMime::Message::Ptr &message, MailTransport
MESSAGECOMPOSER_EXPORT bool sendMailDispatcherIsOnline( QWidget *parent = 0);
MESSAGECOMPOSER_EXPORT QString rot13(const QString &s);
MESSAGECOMPOSER_EXPORT void addTextBox(QTextEdit *edit);
MESSAGECOMPOSER_EXPORT void removeNotNecessaryHeaders(const KMime::Message::Ptr &msg);
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment