Commit 942a637d authored by Laurent Montel's avatar Laurent Montel 😁
Browse files

Fix Bug 358233 - Reply-To is missing in compose message window

FIXED-IN: 5.10.0
BUG: 358233
parent fb10c1d1
cmake_minimum_required(VERSION 3.0)
set(PIM_VERSION "5.9.61")
set(PIM_VERSION "5.9.62")
if (POLICY CMP0053)
cmake_policy(SET CMP0053 NEW)
......@@ -10,12 +10,6 @@ project(Messagelib VERSION ${PIM_VERSION})
option(MIMETREEPARSER_ONLY_BUILD "Build only mimetreeparser" FALSE)
option(KDEPIM_ENTERPRISE_BUILD "Enable features specific to the enterprise branch, which are normally disabled. Also, it disables many components not needed for Kontact such as the Kolab client." FALSE)
option(IMPLEMENT_REPLY_TO_SUPPORT_RECIPIENT "EXperimental" FALSE)
if (IMPLEMENT_REPLY_TO_SUPPORT_RECIPIENT)
set(IMPLEMENT_REPLY_TO_SUPPORT_RECIPIENT TRUE)
endif()
set(KF5_VERSION "5.51.0")
......
......@@ -19,7 +19,6 @@
*/
#include "composerviewbase.h"
#include "config-messagecomposer.h"
#include "attachment/attachmentcontrollerbase.h"
#include "attachment/attachmentmodel.h"
......@@ -133,9 +132,7 @@ void ComposerViewBase::setMessage(const KMime::Message::Ptr &msg, bool allowDecr
m_recipientsEditor->setRecipientString(m_msg->to()->mailboxes(), MessageComposer::Recipient::To);
m_recipientsEditor->setRecipientString(m_msg->cc()->mailboxes(), MessageComposer::Recipient::Cc);
m_recipientsEditor->setRecipientString(m_msg->bcc()->mailboxes(), MessageComposer::Recipient::Bcc);
#ifdef IMPLEMENT_REPLY_TO_SUPPORT_RECIPIENT
m_recipientsEditor->setRecipientString(m_msg->replyTo()->mailboxes(), MessageComposer::Recipient::ReplyTo);
#endif
m_recipientsEditor->setFocusBottom();
// If we are loading from a draft, load unexpanded aliases as well
......@@ -163,7 +160,6 @@ void ComposerViewBase::setMessage(const KMime::Message::Ptr &msg, bool allowDecr
}
}
}
#ifdef IMPLEMENT_REPLY_TO_SUPPORT_RECIPIENT
if (auto hrd = m_msg->headerByType("X-KMail-UnExpanded-Reply-To")) {
const QStringList spl = hrd->asUnicodeString().split(QLatin1Char(','));
for (const QString &addr : spl) {
......@@ -172,7 +168,6 @@ void ComposerViewBase::setMessage(const KMime::Message::Ptr &msg, bool allowDecr
}
}
}
#endif
}
// First, we copy the message and then parse it to the object tree parser.
......@@ -403,9 +398,7 @@ void ComposerViewBase::readyForSending()
job->setTo(m_recipientsEditor->recipientStringList(MessageComposer::Recipient::To));
job->setCc(m_recipientsEditor->recipientStringList(MessageComposer::Recipient::Cc));
job->setBcc(m_recipientsEditor->recipientStringList(MessageComposer::Recipient::Bcc));
#ifdef IMPLEMENT_REPLY_TO_SUPPORT_RECIPIENT
job->setReplyTo(m_recipientsEditor->recipientStringList(MessageComposer::Recipient::ReplyTo));
#endif
connect(job, &MessageComposer::EmailAddressResolveJob::result, this, &ComposerViewBase::slotEmailAddressResolved);
job->start();
......@@ -451,11 +444,9 @@ void ComposerViewBase::slotEmailAddressResolved(KJob *job)
case MessageComposer::Recipient::Bcc:
mExpandedBcc << r->email();
break;
#ifdef IMPLEMENT_REPLY_TO_SUPPORT_RECIPIENT
case MessageComposer::Recipient::ReplyTo:
mExpandedReplyTo << r->email();
break;
#endif
case MessageComposer::Recipient::Undefined:
Q_ASSERT(!"Unknown recpient type!");
break;
......@@ -477,13 +468,11 @@ void ComposerViewBase::slotEmailAddressResolved(KJob *job)
unExpandedBcc << exp;
}
}
#ifdef IMPLEMENT_REPLY_TO_SUPPORT_RECIPIENT
foreach (const QString &exp, resolveJob->expandedReplyTo()) {
if (!mExpandedReplyTo.contains(exp)) { // this address was expanded, so save it explicitly
unExpandedReplyTo << exp;
}
}
#endif
auto header = new KMime::Headers::Generic("X-KMail-UnExpanded-To");
header->from7BitString(unExpandedTo.join(QStringLiteral(", ")).toLatin1());
m_msg->setHeader(header);
......@@ -493,11 +482,9 @@ void ComposerViewBase::slotEmailAddressResolved(KJob *job)
header = new KMime::Headers::Generic("X-KMail-UnExpanded-BCC");
header->from7BitString(unExpandedBcc.join(QStringLiteral(", ")).toLatin1());
m_msg->setHeader(header);
#ifdef IMPLEMENT_REPLY_TO_SUPPORT_RECIPIENT
header = new KMime::Headers::Generic("X-KMail-UnExpanded-Reply-To");
header->from7BitString(unExpandedReplyTo.join(QStringLiteral(", ")).toLatin1());
m_msg->setHeader(header);
#endif
autoresizeImage = false;
}
......@@ -828,25 +815,18 @@ void ComposerViewBase::fillInfoPart(MessageComposer::InfoPart *infoPart, Compose
}
infoPart->setTransportId(m_transport->currentTransportId());
#ifndef IMPLEMENT_REPLY_TO_SUPPORT_RECIPIENT
infoPart->setReplyTo(replyTo());
#endif
if (expansion == UseExpandedRecipients) {
infoPart->setFrom(mExpandedFrom);
infoPart->setTo(mExpandedTo);
infoPart->setCc(mExpandedCc);
infoPart->setBcc(mExpandedBcc);
#ifdef IMPLEMENT_REPLY_TO_SUPPORT_RECIPIENT
infoPart->setReplyTo(mExpandedReplyTo);
#endif
} else {
infoPart->setFrom(from());
infoPart->setTo(m_recipientsEditor->recipientStringList(MessageComposer::Recipient::To));
infoPart->setCc(m_recipientsEditor->recipientStringList(MessageComposer::Recipient::Cc));
infoPart->setBcc(m_recipientsEditor->recipientStringList(MessageComposer::Recipient::Bcc));
#ifdef IMPLEMENT_REPLY_TO_SUPPORT_RECIPIENT
infoPart->setReplyTo(m_recipientsEditor->recipientStringList(MessageComposer::Recipient::ReplyTo));
#endif
}
infoPart->setSubject(subject());
infoPart->setUserAgent(QStringLiteral("KMail"));
......@@ -879,11 +859,9 @@ void ComposerViewBase::fillInfoPart(MessageComposer::InfoPart *infoPart, Compose
if (auto hdr = m_msg->headerByType("X-KMail-UnExpanded-BCC")) {
extras << hdr;
}
#ifdef IMPLEMENT_REPLY_TO_SUPPORT_RECIPIENT
if (auto hdr = m_msg->headerByType("X-KMail-UnExpanded-Reply-To")) {
extras << hdr;
}
#endif
if (auto hdr = m_msg->organization(false)) {
extras << hdr;
}
......@@ -1470,11 +1448,7 @@ QString ComposerViewBase::from() const
QString ComposerViewBase::replyTo() const
{
#ifdef IMPLEMENT_REPLY_TO_SUPPORT_RECIPIENT
return MessageComposer::Util::cleanedUpHeaderString(m_recipientsEditor->recipientString(MessageComposer::Recipient::ReplyTo));
#else
return MessageComposer::Util::cleanedUpHeaderString(m_replyTo);
#endif
}
QString ComposerViewBase::subject() const
......@@ -1547,11 +1521,9 @@ void ComposerViewBase::updateRecipients(const KIdentityManagement::Identity &ide
} else if (type == MessageComposer::Recipient::Cc) {
oldIdentList = oldIdent.cc();
newIdentList = ident.cc();
#ifdef IMPLEMENT_REPLY_TO_SUPPORT_RECIPIENT
} else if (type == MessageComposer::Recipient::ReplyTo) {
oldIdentList = oldIdent.replyToAddr();
newIdentList = ident.replyToAddr();
#endif
} else {
return;
}
......@@ -1574,9 +1546,7 @@ void ComposerViewBase::identityChanged(const KIdentityManagement::Identity &iden
{
updateRecipients(ident, oldIdent, MessageComposer::Recipient::Bcc);
updateRecipients(ident, oldIdent, MessageComposer::Recipient::Cc);
#ifdef IMPLEMENT_REPLY_TO_SUPPORT_RECIPIENT
updateRecipients(ident, oldIdent, MessageComposer::Recipient::ReplyTo);
#endif
KIdentityManagement::Signature oldSig = const_cast<KIdentityManagement::Identity &>
(oldIdent).signature();
......@@ -1667,11 +1637,6 @@ void ComposerViewBase::setFrom(const QString &from)
m_from = from;
}
void ComposerViewBase::setReplyTo(const QString &replyTo)
{
m_replyTo = replyTo;
}
void ComposerViewBase::setSubject(const QString &subject)
{
m_subject = subject;
......@@ -2107,7 +2072,7 @@ void ComposerViewBase::addFollowupReminder(const QString &messageId)
MessageComposer::FollowupReminderCreateJob *job = new MessageComposer::FollowupReminderCreateJob;
job->setSubject(m_subject);
job->setMessageId(messageId);
job->setTo(m_replyTo.isEmpty() ? mExpandedTo.join(QLatin1Char(',')) : m_replyTo);
job->setTo(mExpandedReplyTo.isEmpty() ? mExpandedTo.join(QLatin1Char(',')) : mExpandedReplyTo.join(QLatin1Char(',')));
job->setFollowUpReminderDate(mFollowUpDate);
job->setCollectionToDo(mFollowUpCollection);
job->start();
......
......@@ -24,7 +24,6 @@
#include "messagecomposer_export.h"
#include "messagecomposer/messagesender.h"
#include "MessageComposer/Recipient"
#include <AkonadiCore/collection.h>
#include <KMime/Message>
......@@ -170,7 +169,6 @@ public:
* values are set before sending.
*/
void setFrom(const QString &from);
void setReplyTo(const QString &replyTo);
void setSubject(const QString &subject);
/**
......@@ -353,7 +351,9 @@ private:
bool m_urgent = false;
bool m_requestDeleveryConfirmation = false;
Kleo::CryptoMessageFormat m_cryptoMessageFormat;
QString mExpandedFrom, m_from, m_replyTo, m_subject;
QString mExpandedFrom;
QString m_from;
QString m_subject;
QStringList mExpandedTo, mExpandedCc, mExpandedBcc, mExpandedReplyTo;
QList< QByteArray > m_charsets;
QMap<QByteArray, QString> m_customHeader;
......
#cmakedefine IMPLEMENT_REPLY_TO_SUPPORT_RECIPIENT 1
......@@ -23,7 +23,6 @@
*/
#include "recipient.h"
#include "config-messagecomposer.h"
#include <KLocalizedString>
......@@ -136,9 +135,7 @@ QStringList Recipient::allTypeLabels()
types.append(typeLabel(To));
types.append(typeLabel(Cc));
types.append(typeLabel(Bcc));
#ifdef IMPLEMENT_REPLY_TO_SUPPORT_RECIPIENT
types.append(typeLabel(ReplyTo));
#endif
return types;
}
......
......@@ -257,7 +257,11 @@ void RecipientsEditor::slotLineAdded(MultiplyingLine *line)
} else {
RecipientLineNG *last_rec = qobject_cast< RecipientLineNG * >(lines().at(lines().count() - 2));
if (last_rec) {
rec->setRecipientType(last_rec->recipientType());
if (last_rec->recipientType() == Recipient::ReplyTo) {
rec->setRecipientType(Recipient::To);
} else {
rec->setRecipientType(last_rec->recipientType());
}
}
}
line->fixTabOrder(lines().constLast()->tabOut());
......
......@@ -79,25 +79,19 @@ RecipientsPicker::RecipientsPicker(QWidget *parent)
buttonBox->addButton(mUser2Button, QDialogButtonBox::ActionRole);
mUser3Button = new QPushButton;
buttonBox->addButton(mUser3Button, QDialogButtonBox::ActionRole);
#ifdef IMPLEMENT_REPLY_TO_SUPPORT_RECIPIENT
mUser4Button = new QPushButton;
buttonBox->addButton(mUser4Button, QDialogButtonBox::ActionRole);
#endif
connect(buttonBox, &QDialogButtonBox::rejected, this, &RecipientsPicker::reject);
mainLayout->addWidget(buttonBox);
#ifdef IMPLEMENT_REPLY_TO_SUPPORT_RECIPIENT
mUser4Button->setText(i18n("Add as &Reply-To"));
#endif
mUser3Button->setText(i18n("Add as &To"));
mUser2Button->setText(i18n("Add as CC"));
mUser1Button->setText(i18n("Add as &BCC"));
connect(mUser1Button, &QPushButton::clicked, this, &RecipientsPicker::slotBccClicked);
connect(mUser2Button, &QPushButton::clicked, this, &RecipientsPicker::slotCcClicked);
connect(mUser3Button, &QPushButton::clicked, this, &RecipientsPicker::slotToClicked);
#ifdef IMPLEMENT_REPLY_TO_SUPPORT_RECIPIENT
connect(mUser4Button, &QPushButton::clicked, this, &RecipientsPicker::slotReplyToClicked);
#endif
mView->emailAddressSelectionWidget()->searchLineEdit()->setFocus();
......@@ -117,9 +111,7 @@ void RecipientsPicker::slotSelectionChanged()
mUser1Button->setEnabled(hasSelection);
mUser2Button->setEnabled(hasSelection);
mUser3Button->setEnabled(hasSelection);
#ifdef IMPLEMENT_REPLY_TO_SUPPORT_RECIPIENT
mUser4Button->setEnabled(hasSelection);
#endif
}
void RecipientsPicker::setRecipients(const Recipient::List &)
......@@ -133,10 +125,7 @@ void RecipientsPicker::setDefaultType(Recipient::Type type)
mUser1Button->setDefault(type == Recipient::To);
mUser2Button->setDefault(type == Recipient::Cc);
mUser3Button->setDefault(type == Recipient::Bcc);
#ifdef IMPLEMENT_REPLY_TO_SUPPORT_RECIPIENT
mUser4Button->setDefault(type == Recipient::ReplyTo);
#endif
}
void RecipientsPicker::slotToClicked()
......@@ -146,9 +135,7 @@ void RecipientsPicker::slotToClicked()
void RecipientsPicker::slotReplyToClicked()
{
#ifdef IMPLEMENT_REPLY_TO_SUPPORT_RECIPIENT
pick(Recipient::ReplyTo);
#endif
}
void RecipientsPicker::slotCcClicked()
......
......@@ -22,7 +22,6 @@
#define MESSAGECOMPOSER_RECIPIENTSPICKER_H
#include <MessageComposer/Recipient>
#include "config-messagecomposer.h"
#include <kcontacts/addressee.h>
#include <QDialog>
......@@ -74,9 +73,7 @@ private:
KLDAP::LdapSearchDialog *mLdapSearchDialog = nullptr;
Recipient::Type mDefaultType;
#ifdef IMPLEMENT_REPLY_TO_SUPPORT_RECIPIENT
QPushButton *mUser4Button = nullptr;
#endif
QPushButton *mUser3Button = nullptr;
QPushButton *mUser2Button = nullptr;
QPushButton *mUser1Button = nullptr;
......
Supports Markdown
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