From c5dc01643fbe68236332d0b42da1806bdb833368 Mon Sep 17 00:00:00 2001 From: Montel Laurent Date: Sun, 6 Nov 2016 07:40:54 +0100 Subject: [PATCH] Fix Bug 372085 - KMail 5.3.2: forwarding or replying to html mails do not preserve links FIXED-IN: 5.4.0 BUG: 372085 --- src/kmcommands.cpp | 11 +++++++---- src/kmcommands.h | 5 +++-- src/kmmainwidget.cpp | 7 ++++--- src/kmreadermainwin.cpp | 8 ++++---- 4 files changed, 18 insertions(+), 13 deletions(-) diff --git a/src/kmcommands.cpp b/src/kmcommands.cpp index dc3994f88..78654b85e 100644 --- a/src/kmcommands.cpp +++ b/src/kmcommands.cpp @@ -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); } diff --git a/src/kmcommands.h b/src/kmcommands.h index 2d3957854..e22677bfb 100644 --- a/src/kmcommands.h +++ b/src/kmcommands.h @@ -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 diff --git a/src/kmmainwidget.cpp b/src/kmmainwidget.cpp index e66fde148..99143f544 100644 --- a/src/kmmainwidget.cpp +++ b/src/kmmainwidget.cpp @@ -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(); diff --git a/src/kmreadermainwin.cpp b/src/kmreadermainwin.cpp index 1094ecc78..f2d90c999 100644 --- a/src/kmreadermainwin.cpp +++ b/src/kmreadermainwin.cpp @@ -251,12 +251,12 @@ void KMReaderMainWin::slotForwardInlineMsg() QSharedPointer 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();