Bug 99997 - Copy email and address from header to clipboard. r=IanN

Port TB Bug 232021 [name should be included with email address when copying from header menu].
This commit is contained in:
Frank-Rainer Grahl 2019-01-06 23:21:43 +01:00
Родитель e22b6b8b80
Коммит 4498ed172c
3 изменённых файлов: 22 добавлений и 6 удалений

Просмотреть файл

@ -13,6 +13,8 @@
<!ENTITY SendMailTo.accesskey "s">
<!ENTITY CopyEmailAddress.label "Copy Email Address">
<!ENTITY CopyEmailAddress.accesskey "C">
<!ENTITY CopyNameAndEmailAddress.label "Copy Name and Email Address">
<!ENTITY CopyNameAndEmailAddress.accesskey "N">
<!ENTITY CreateFilterFrom.label "Create Filter From…">
<!ENTITY CreateFilterFrom.accesskey "F">
<!ENTITY openInBrowser.label "Open in Browser">

Просмотреть файл

@ -479,12 +479,22 @@ function SendMailTo(fullAddress, aEvent)
MailServices.compose.OpenComposeWindowWithParams(null, params);
}
// CopyEmailAddress takes the email address title button, extracts
// the email address we stored in there and copies it to the clipboard
function CopyEmailAddress(emailAddressNode)
/**
* Takes the email address, extracts the address/name
* we stored in there and copies it to the clipboard.
*
* @param addressNode a node which has an "emailAddress"
* attribute
* @param aIncludeName when true, also copy the name onto the clipboard,
* otherwise only the email address
*/
function CopyEmailAddress(emailAddressNode, aIncludeName = false)
{
if (emailAddressNode)
CopyString(emailAddressNode.getAttribute("emailAddress"));
if (emailAddressNode) {
let address = emailAddressNode.getAttribute(aIncludeName ? "fullAddress"
: "emailAddress");
CopyString(address);
}
}
// show the message id in the context menu

Просмотреть файл

@ -79,7 +79,11 @@
<menuitem id="copyEmailAddressItem"
label="&CopyEmailAddress.label;"
accesskey="&CopyEmailAddress.accesskey;"
oncommand="CopyEmailAddress(document.popupNode)"/>
oncommand="CopyEmailAddress(document.popupNode);"/>
<menuitem id="copyNameAndEmailAddressItem"
label="&CopyNameAndEmailAddress.label;"
accesskey="&CopyNameAndEmailAddress.accesskey;"
oncommand="CopyEmailAddress(document.popupNode, true);"/>
</menupopup>
<menupopup id="attachmentListContext" onpopupshowing="return onShowAttachmentContextMenu();">