Commit c5dc0164 authored by Laurent Montel's avatar Laurent Montel 😁
Browse files

Fix Bug 372085 - KMail 5.3.2: forwarding or replying to html mails do not preserve links

FIXED-IN: 5.4.0
BUG: 372085
parent 081ed978
......@@ -896,20 +896,22 @@ KMCommand::Result KMReplyCommand::execute()
}
KMForwardCommand::KMForwardCommand(QWidget *parent,
const Akonadi::Item::List &msgList, uint identity, const QString &templateName)
const Akonadi::Item::List &msgList, uint identity, const QString &templateName, const QString &selection)
: KMCommand(parent, msgList),
mIdentity(identity),
mTemplate(templateName)
mTemplate(templateName),
mSelection(selection)
{
fetchScope().fetchFullPayload(true);
fetchScope().setAncestorRetrieval(Akonadi::ItemFetchScope::Parent);
}
KMForwardCommand::KMForwardCommand(QWidget *parent, const Akonadi::Item &msg,
uint identity, const QString &templateName)
uint identity, const QString &templateName, const QString &selection)
: KMCommand(parent, msg),
mIdentity(identity),
mTemplate(templateName)
mTemplate(templateName),
mSelection(selection)
{
fetchScope().fetchFullPayload(true);
fetchScope().setAncestorRetrieval(Akonadi::ItemFetchScope::Parent);
......@@ -927,6 +929,7 @@ KMCommand::Result KMForwardCommand::createComposer(const Akonadi::Item &item)
MessageFactory factory(msg, item.id(), MailCommon::Util::updatedCollection(item.parentCollection()));
factory.setIdentityManager(KMKernel::self()->identityManager());
factory.setFolderIdentity(MailCommon::Util::folderIdentity(item));
factory.setSelection(mSelection);
if (!mTemplate.isEmpty()) {
factory.setTemplate(mTemplate);
}
......
......@@ -338,9 +338,9 @@ class KMForwardCommand : public KMCommand
public:
KMForwardCommand(QWidget *parent, const Akonadi::Item::List &msgList,
uint identity = 0, const QString &templateName = QString());
uint identity = 0, const QString &templateName = QString(), const QString &selection = QString());
KMForwardCommand(QWidget *parent, const Akonadi::Item &msg,
uint identity = 0, const QString &templateName = QString());
uint identity = 0, const QString &templateName = QString(), const QString &selection = QString());
private:
KMCommand::Result createComposer(const Akonadi::Item &item);
......@@ -349,6 +349,7 @@ private:
private:
uint mIdentity;
QString mTemplate;
QString mSelection;
};
class KMForwardAttachedCommand : public KMCommand
......
......@@ -1619,8 +1619,9 @@ void KMMainWidget::slotForwardInlineMsg()
if (selectedMessages.isEmpty()) {
return;
}
const QString text = mMsgView ? mMsgView->copyText() : QString();
KMForwardCommand *command = new KMForwardCommand(
this, selectedMessages, mCurrentFolder->identity()
this, selectedMessages, mCurrentFolder->identity(), QString(), text
);
command->start();
......@@ -2093,10 +2094,10 @@ void KMMainWidget::slotCustomForwardMsg(const QString &tmpl)
if (selectedMessages.isEmpty()) {
return;
}
const QString text = mMsgView ? mMsgView->copyText() : QString();
qCDebug(KMAIL_LOG) << "Forward with template:" << tmpl;
KMForwardCommand *command = new KMForwardCommand(
this, selectedMessages, mCurrentFolder->identity(), tmpl
this, selectedMessages, mCurrentFolder->identity(), tmpl, text
);
command->start();
......
......@@ -251,12 +251,12 @@ void KMReaderMainWin::slotForwardInlineMsg()
QSharedPointer<FolderCollection> fd = FolderCollection::forCollection(parentCol, false);
if (fd)
command = new KMForwardCommand(this, mReaderWin->message(),
fd->identity());
fd->identity(), QString(), mReaderWin->copyText());
else {
command = new KMForwardCommand(this, mReaderWin->message());
command = new KMForwardCommand(this, mReaderWin->message(), 0, QString(), mReaderWin->copyText());
}
} else {
command = new KMForwardCommand(this, mReaderWin->message());
command = new KMForwardCommand(this, mReaderWin->message(), 0, QString(), mReaderWin->copyText());
}
connect(command, &KMTrashMsgCommand::completed, this, &KMReaderMainWin::slotReplyOrForwardFinished);
command->start();
......@@ -335,7 +335,7 @@ void KMReaderMainWin::slotCustomForwardMsg(const QString &tmpl)
}
KMForwardCommand *command = new KMForwardCommand(this,
currentItem,
0, tmpl);
0, tmpl, mReaderWin->copyText());
connect(command, &KMForwardCommand::completed, this, &KMReaderMainWin::slotReplyOrForwardFinished);
command->start();
......
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