append original email when responding
This commit is contained in:
parent
40d3189088
commit
291a60ee82
@ -14,6 +14,7 @@
|
|||||||
#include "services/gmail/gui/emailrecipientcontrol.h"
|
#include "services/gmail/gui/emailrecipientcontrol.h"
|
||||||
|
|
||||||
#include <QCloseEvent>
|
#include <QCloseEvent>
|
||||||
|
#include <QTextDocumentFragment>
|
||||||
|
|
||||||
FormAddEditEmail::FormAddEditEmail(GmailServiceRoot* root, QWidget* parent)
|
FormAddEditEmail::FormAddEditEmail(GmailServiceRoot* root, QWidget* parent)
|
||||||
: QDialog(parent), m_root(root), m_originalMessage(nullptr), m_possibleRecipients({}) {
|
: QDialog(parent), m_root(root), m_originalMessage(nullptr), m_possibleRecipients({}) {
|
||||||
@ -61,6 +62,12 @@ void FormAddEditEmail::execForReply(Message* original_message) {
|
|||||||
auto from_header =
|
auto from_header =
|
||||||
m_root->network()->getMessageMetadata(original_message->m_customId, {QSL("FROM")}, m_root->networkProxy());
|
m_root->network()->getMessageMetadata(original_message->m_customId, {QSL("FROM")}, m_root->networkProxy());
|
||||||
|
|
||||||
|
m_ui.m_txtMessage->setPlainText(QTextDocumentFragment::fromHtml(m_originalMessage->m_contents).toPlainText());
|
||||||
|
m_ui.m_txtMessage->moveCursor(QTextCursor::MoveOperation::Start);
|
||||||
|
m_ui.m_txtMessage->insertHtml(QSL("<p>"
|
||||||
|
"---------- Original message ----------"
|
||||||
|
"</p><br/>"));
|
||||||
|
|
||||||
addRecipientRow(from_header["From"]);
|
addRecipientRow(from_header["From"]);
|
||||||
exec();
|
exec();
|
||||||
}
|
}
|
||||||
@ -72,16 +79,18 @@ void FormAddEditEmail::execForForward(Message* original_message) {
|
|||||||
m_ui.m_txtSubject->setEnabled(false);
|
m_ui.m_txtSubject->setEnabled(false);
|
||||||
m_ui.m_txtMessage->setFocus();
|
m_ui.m_txtMessage->setFocus();
|
||||||
|
|
||||||
// TODO: Obtain "To" header from Gmail API and fill it in too.
|
const QString to_header =
|
||||||
|
m_root->network()->getMessageMetadata(original_message->m_customId, {QSL("TO")}, m_root->networkProxy())["To"];
|
||||||
|
|
||||||
const QString forward_header =
|
const QString forward_header =
|
||||||
QSL("<pre>"
|
QSL("<pre>"
|
||||||
"---------- Forwarded message ---------<br/>"
|
"---------- Forwarded message ---------<br/>"
|
||||||
"From: %1<br/>"
|
"From: %1<br/>"
|
||||||
"Date: %2<br/>"
|
"Date: %2<br/>"
|
||||||
"Subject: %3<br/>"
|
"Subject: %3<br/>"
|
||||||
"To: -"
|
"To: %4"
|
||||||
"</pre><br/>")
|
"</pre><br/>")
|
||||||
.arg(m_originalMessage->m_author, m_originalMessage->m_created.toString(), m_originalMessage->m_title);
|
.arg(m_originalMessage->m_author, m_originalMessage->m_created.toString(), m_originalMessage->m_title, to_header);
|
||||||
|
|
||||||
m_ui.m_txtMessage->setHtml(forward_header + m_originalMessage->m_contents);
|
m_ui.m_txtMessage->setHtml(forward_header + m_originalMessage->m_contents);
|
||||||
m_ui.m_txtMessage->moveCursor(QTextCursor::MoveOperation::Start);
|
m_ui.m_txtMessage->moveCursor(QTextCursor::MoveOperation::Start);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user