fixing bug 115582 - File/Attachments/Save All doesn't have access key. r=racham, sr=mscott

This commit is contained in:
ssu%netscape.com 2002-02-01 23:05:45 +00:00
Родитель 1f9fe3a20b
Коммит f1e323eb63
5 изменённых файлов: 40 добавлений и 12 удалений

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

@ -877,7 +877,7 @@ Rights Reserved.
observes="cmd_openMessage" observes="cmd_openMessage"
accesskey="&openMessageWindowCmd.accesskey;" accesskey="&openMessageWindowCmd.accesskey;"
key="key_openMessage"/> key="key_openMessage"/>
<menu id="fileAttachmentMenu" label="&openAttachmentCmd.label;"> <menu id="fileAttachmentMenu" label="&openAttachmentCmd.label;" accesskey="&openAttachmentCmd.accesskey;">
<menupopup id="attachmentMenuList" onpopupshowing="FillAttachmentListPopup(this);"/> <menupopup id="attachmentMenuList" onpopupshowing="FillAttachmentListPopup(this);"/>
</menu> </menu>
<menuseparator/> <menuseparator/>

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

@ -47,7 +47,10 @@ var gBuildAttachmentPopupForCurrentMsg = true;
var gBuiltExpandedView = false; var gBuiltExpandedView = false;
var gBuiltCollapsedView = false; var gBuiltCollapsedView = false;
var gOpenLabel; var gOpenLabel;
var gOpenLabelAccesskey;
var gSaveLabel; var gSaveLabel;
var gSaveLabelAccesskey;
var gMessengerBundle;
var msgHeaderParser = Components.classes[msgHeaderParserContractID].getService(Components.interfaces.nsIMsgHeaderParser); var msgHeaderParser = Components.classes[msgHeaderParserContractID].getService(Components.interfaces.nsIMsgHeaderParser);
var abAddressCollector = Components.classes[abAddressCollectorContractID].getService(Components.interfaces.nsIAbAddressCollecter); var abAddressCollector = Components.classes[abAddressCollectorContractID].getService(Components.interfaces.nsIAbAddressCollecter);
@ -870,13 +873,16 @@ function FillAttachmentListPopup(popup)
if (!gBuildAttachmentPopupForCurrentMsg) return; if (!gBuildAttachmentPopupForCurrentMsg) return;
var attachmentIndex = 0;
// otherwise we need to build the attachment view... // otherwise we need to build the attachment view...
// First clear out the old view... // First clear out the old view...
ClearAttachmentMenu(popup); ClearAttachmentMenu(popup);
for (index in currentAttachments) for (index in currentAttachments)
{ {
addAttachmentToPopup(popup, currentAttachments[index]); ++attachmentIndex;
addAttachmentToPopup(popup, currentAttachments[index], attachmentIndex);
} }
gBuildAttachmentPopupForCurrentMsg = false; gBuildAttachmentPopupForCurrentMsg = false;
@ -900,19 +906,28 @@ function GetNumberOfAttachmentsForDisplayedMessage()
} }
// private method used to build up a menu list of attachments // private method used to build up a menu list of attachments
function addAttachmentToPopup(popup, attachment) function addAttachmentToPopup(popup, attachment, attachmentIndex)
{ {
if (popup) if (popup)
{ {
var item = document.createElement('menu'); var item = document.createElement('menu');
if ( item ) if ( item )
{ {
if (!gMessengerBundle)
gMessengerBundle = document.getElementById("bundle_messenger");
// insert the item just before the separator...the separator is the 2nd to last element in the popup. // insert the item just before the separator...the separator is the 2nd to last element in the popup.
item.setAttribute('class', 'menu-iconic'); item.setAttribute('class', 'menu-iconic');
setApplicationIconForAttachment(attachment,item); setApplicationIconForAttachment(attachment,item);
var numItemsInPopup = popup.childNodes.length; var numItemsInPopup = popup.childNodes.length;
item = popup.insertBefore(item, popup.childNodes[numItemsInPopup-2]); item = popup.insertBefore(item, popup.childNodes[numItemsInPopup-2]);
item.setAttribute('label', attachment.displayName);
var formattedDisplayNameString = gMessengerBundle.getFormattedString("attachmentDisplayNameFormat",
[attachmentIndex, attachment.displayName]);
item.setAttribute('label', formattedDisplayNameString);
item.setAttribute('accesskey', attachmentIndex);
var oncommandPrefix = generateCommandSuffixForAttachment(attachment); var oncommandPrefix = generateCommandSuffixForAttachment(attachment);
var openpopup = document.createElement('menupopup'); var openpopup = document.createElement('menupopup');
@ -921,13 +936,17 @@ function addAttachmentToPopup(popup, attachment)
var menuitementry = document.createElement('menuitem'); var menuitementry = document.createElement('menuitem');
menuitementry.setAttribute('oncommand', 'openAttachment' + oncommandPrefix); menuitementry.setAttribute('oncommand', 'openAttachment' + oncommandPrefix);
if (!gSaveLabel || !gOpenLabel) { if (!gSaveLabel)
var messengerBundle = document.getElementById("bundle_messenger"); gSaveLabel = gMessengerBundle.getString("saveLabel");
gSaveLabel = messengerBundle.getString("saveLabel"); if (!gSaveLabelAccesskey)
gOpenLabel = messengerBundle.getString("openLabel"); gSaveLabelAccesskey = gMessengerBundle.getString("saveLabelAccesskey");
} if (!gOpenLabel)
gOpenLabel = gMessengerBundle.getString("openLabel");
if (!gOpenLabelAccesskey)
gOpenLabelAccesskey = gMessengerBundle.getString("openLabelAccesskey");
menuitementry.setAttribute('label', gOpenLabel); menuitementry.setAttribute('label', gOpenLabel);
menuitementry.setAttribute('accesskey', gOpenLabelAccesskey);
menuitementry = openpopup.appendChild(menuitementry); menuitementry = openpopup.appendChild(menuitementry);
var menuseparator = document.createElement('menuseparator'); var menuseparator = document.createElement('menuseparator');
@ -936,6 +955,7 @@ function addAttachmentToPopup(popup, attachment)
menuitementry = document.createElement('menuitem'); menuitementry = document.createElement('menuitem');
menuitementry.setAttribute('oncommand', 'saveAttachment' + oncommandPrefix); menuitementry.setAttribute('oncommand', 'saveAttachment' + oncommandPrefix);
menuitementry.setAttribute('label', gSaveLabel); menuitementry.setAttribute('label', gSaveLabel);
menuitementry.setAttribute('accesskey', gSaveLabelAccesskey);
menuitementry = openpopup.appendChild(menuitementry); menuitementry = openpopup.appendChild(menuitementry);
} // if we created a menu item for this attachment... } // if we created a menu item for this attachment...
} // if we have a popup } // if we have a popup

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

@ -44,7 +44,7 @@ Rights Reserved.
<popup id="attachmentMenuList"> <popup id="attachmentMenuList">
<menuseparator/> <menuseparator/>
<menuitem label="&saveAllAttachmentsCmd.label;" oncommand="SaveAllAttachments();"/> <menuitem label="&saveAllAttachmentsCmd.label;" accesskey="&saveAllAttachmentsCmd.accesskey;" oncommand="SaveAllAttachments();"/>
</popup> </popup>
<tooltip id="attachmentTreeTooltip" <tooltip id="attachmentTreeTooltip"

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

@ -206,7 +206,15 @@ cannotHaveTwoFilterRulesText=The filter cannot be created because the Filter Rul
# msgHdrViewOverlay.js # msgHdrViewOverlay.js
openLabel=Open openLabel=Open
saveLabel=Save openLabelAccesskey=O
saveLabel=Save As...
saveLabelAccesskey=A
# This is the format for prepending accesskeys to the
# each of the attachments in the file|attachments menu:
# ie: 1 file.txt
# 2 another file.txt
attachmentDisplayNameFormat=%S %S
# Connection Error Messages # Connection Error Messages
101=Unknown Error 101=Unknown Error

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

@ -43,4 +43,4 @@ Rights Reserved.
<!ENTITY printAttachmentCmd.label ".Print"> <!ENTITY printAttachmentCmd.label ".Print">
<!ENTITY printAttachmentCmd.accesskey "P"> <!ENTITY printAttachmentCmd.accesskey "P">
<!ENTITY saveAllAttachmentsCmd.label "Save All..."> <!ENTITY saveAllAttachmentsCmd.label "Save All...">
<!ENTITY saveAllAttachmentsCmd.accesskey "l"> <!ENTITY saveAllAttachmentsCmd.accesskey "S">