summaryrefslogtreecommitdiff
path: root/mailnews/compose
diff options
context:
space:
mode:
authorJeremy Andrews <athenian200@outlook.com>2022-06-01 19:32:33 -0500
committerJeremy Andrews <athenian200@outlook.com>2022-06-04 16:13:32 -0500
commit9c395967cc6726158cf34c977f6c4da4cce742d1 (patch)
treede1b03d73b65e513ab9ec143176cef99236adaef /mailnews/compose
parent64e3f4118a430706046f5757da73ed0081807df7 (diff)
downloaduxp-9c395967cc6726158cf34c977f6c4da4cce742d1.tar.gz
[MailNews] Allow shift-clicking on Edit As New to edit a message as plaintext.
Ref: BZ 731688
Diffstat (limited to 'mailnews/compose')
-rw-r--r--mailnews/compose/public/nsIMsgComposeParams.idl6
-rw-r--r--mailnews/compose/src/nsMsgCompose.cpp4
-rw-r--r--mailnews/compose/src/nsMsgComposeService.cpp12
3 files changed, 19 insertions, 3 deletions
diff --git a/mailnews/compose/public/nsIMsgComposeParams.idl b/mailnews/compose/public/nsIMsgComposeParams.idl
index 87c15eac37..bed6fb4dbf 100644
--- a/mailnews/compose/public/nsIMsgComposeParams.idl
+++ b/mailnews/compose/public/nsIMsgComposeParams.idl
@@ -40,6 +40,12 @@ interface nsIMsgCompType {
const long Redirect = 14;
/**
+ * Used to compose a new message from an existing message. Links
+ * are sanitized since the message could be from external sources.
+ */
+ const long EditAsNew = 15;
+
+ /**
* Add this value to a reply type to suppress quoting the current selection
* which may not belong to the message being replied to.
*/
diff --git a/mailnews/compose/src/nsMsgCompose.cpp b/mailnews/compose/src/nsMsgCompose.cpp
index a7c2140ad7..040d9a4f0d 100644
--- a/mailnews/compose/src/nsMsgCompose.cpp
+++ b/mailnews/compose/src/nsMsgCompose.cpp
@@ -1070,7 +1070,8 @@ nsMsgCompose::Initialize(nsIMsgComposeParams *aParams,
// by checking the identity prefs - but don't clobber the values for
// drafts and templates as they were set up already by mime when
// initializing the message.
- if (m_identity && draftId.IsEmpty() && type != nsIMsgCompType::Template)
+ if (m_identity && draftId.IsEmpty() && type != nsIMsgCompType::Template
+ && type != nsIMsgCompType::EditAsNew)
{
bool requestReturnReceipt = false;
rv = m_identity->GetRequestReturnReceipt(&requestReturnReceipt);
@@ -4766,6 +4767,7 @@ nsMsgCompose::BuildBodyMessageAndSignature()
case nsIMsgCompType::Draft :
case nsIMsgCompType::Template :
case nsIMsgCompType::Redirect :
+ case nsIMsgCompType::EditAsNew :
addSignature = false;
break;
diff --git a/mailnews/compose/src/nsMsgComposeService.cpp b/mailnews/compose/src/nsMsgComposeService.cpp
index bec88f8fe3..dfd2d75b61 100644
--- a/mailnews/compose/src/nsMsgComposeService.cpp
+++ b/mailnews/compose/src/nsMsgComposeService.cpp
@@ -387,14 +387,22 @@ nsMsgComposeService::OpenComposeWindow(const char *msgComposeWindowURL, nsIMsgDB
/* Actually, the only way to implement forward inline is to simulate a template message.
Maybe one day when we will have more time we can change that
*/
- if (type == nsIMsgCompType::ForwardInline || type == nsIMsgCompType::Draft || type == nsIMsgCompType::Template
- || type == nsIMsgCompType::ReplyWithTemplate || type == nsIMsgCompType::Redirect)
+ if (type == nsIMsgCompType::ForwardInline || type == nsIMsgCompType::Draft ||
+ type == nsIMsgCompType::Template ||
+ type == nsIMsgCompType::ReplyWithTemplate ||
+ type == nsIMsgCompType::Redirect ||
+ type == nsIMsgCompType::EditAsNew)
{
nsAutoCString uriToOpen(originalMsgURI);
uriToOpen += (uriToOpen.FindChar('?') == kNotFound) ? '?' : '&';
uriToOpen.Append("fetchCompleteMessage=true");
+ // The compose type that gets transmitted to a compose window open in mime
+ // is communicated using url query parameters here.
+
if (type == nsIMsgCompType::Redirect)
uriToOpen.Append("&redirect=true");
+ else if (type == nsIMsgCompType::EditAsNew)
+ uriToOpen.Append("&editasnew=true");
return LoadDraftOrTemplate(uriToOpen, type == nsIMsgCompType::ForwardInline || type == nsIMsgCompType::Draft ?
nsMimeOutput::nsMimeMessageDraftOrTemplate : nsMimeOutput::nsMimeMessageEditorTemplate,