Bug 328293. Save all, detach all and delete all are supurfluous for one attachment.

r=mscott.
This commit is contained in:
alfred.peng%sun.com 2007-06-22 02:18:49 +00:00
Родитель efa4262a57
Коммит d9a3f574ee
2 изменённых файлов: 29 добавлений и 33 удалений

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

@ -1117,51 +1117,47 @@ function onShowAttachmentContextMenu()
// if no attachments are selected, disable the Open and Save...
var attachmentList = document.getElementById('attachmentList');
var selectedAttachments = attachmentList.selectedItems;
var attachmentList = document.getElementById('attachmentListContext');
var openMenu = document.getElementById('context-openAttachment');
var saveMenu = document.getElementById('context-saveAttachment');
var detachMenu = document.getElementById('context-detachAttachment');
var deleteMenu = document.getElementById('context-deleteAttachment');
var menuSingleSeparator = document.getElementById('context-menu-singleSeparator');
var menuAllSeparator = document.getElementById('context-menu-allSeparator');
var saveAllMenu = document.getElementById('context-saveAllAttachments');
var detachAllMenu = document.getElementById('context-detachAllAttachments');
var deleteAllMenu = document.getElementById('context-deleteAllAttachments');
var canDetach = CanDetachAttachments();
var canOpen = false;
for (var i = 0; i < selectedAttachments.length && !canOpen; i++)
canOpen = selectedAttachments[i].attachment.contentType != 'text/x-moz-deleted';
if (canOpen && selectedAttachments.length == 1)
if (selectedAttachments.length == 1)
{
openMenu.removeAttribute('disabled');
openMenu.setAttribute('hidden', !canOpen);
saveMenu.setAttribute('hidden', !canOpen);
menuSingleSeparator.setAttribute('hidden', !canOpen);
detachMenu.setAttribute('hidden', !canDetach || !canOpen);
deleteMenu.setAttribute('hidden', !canDetach || !canOpen);
menuSingleSeparator.setAttribute('hidden', !canDetach || !canOpen);
menuAllSeparator.setAttribute('hidden', 'true');
saveAllMenu.setAttribute('hidden', 'true');
detachAllMenu.setAttribute('hidden', 'true');
deleteAllMenu.setAttribute('hidden', 'true');
}
else
{
openMenu.setAttribute('disabled', true);
}
if (canOpen)
{
saveMenu.removeAttribute('disabled');
}
else
{
saveMenu.setAttribute('disabled', true);
}
if (canDetach && canOpen)
{
detachMenu.removeAttribute('disabled');
deleteMenu.removeAttribute('disabled');
}
else
{
detachMenu.setAttribute('disabled', 'true');
deleteMenu.setAttribute('disabled', 'true');
}
if (canDetach)
{
detachAllMenu.removeAttribute('disabled');
deleteAllMenu.removeAttribute('disabled');
}
else
{
detachAllMenu.setAttribute('disabled', 'true');
deleteAllMenu.setAttribute('disabled', 'true');
openMenu.setAttribute('hidden', 'true');
saveMenu.setAttribute('hidden', 'true');
detachMenu.setAttribute('hidden', 'true');
deleteMenu.setAttribute('hidden', 'true');
saveAllMenu.setAttribute('hidden', 'false');
menuSingleSeparator.setAttribute('hidden', 'true');
menuAllSeparator.setAttribute('hidden', 'true');
detachAllMenu.setAttribute('hidden', !canDetach);
deleteAllMenu.setAttribute('hidden', !canDetach);
}
}

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

@ -59,12 +59,12 @@
oncommand="handleAttachmentSelection('openAttachment');"/>
<menuitem id="context-saveAttachment" label="&saveAsAttachmentCmd.label;" accesskey="&saveAsAttachmentCmd.accesskey;"
oncommand="handleAttachmentSelection('saveAttachment');"/>
<menuseparator/>
<menuseparator id="context-menu-singleSeparator"/>
<menuitem id="context-detachAttachment" label="&detachAttachmentCmd.label;"
oncommand="handleAttachmentSelection('detachAttachment');"/>
<menuitem id="context-deleteAttachment" label="&deleteAttachmentCmd.label;"
oncommand="handleAttachmentSelection('deleteAttachment');"/>
<menuseparator/>
<menuseparator id="context-menu-allSeparator"/>
<menuitem id="context-saveAllAttachments" oncommand="HandleAllAttachments('save');"
label="&saveAllAttachmentsCmd.label;" accesskey="&saveAllAttachmentsCmd.accesskey;"/>
<menuitem id="context-detachAllAttachments" oncommand="HandleAllAttachments('detach');"