checking in patch for andreas.premstaller@uibk.ac.at. fixes bug 57566 - Can't delete mail attachments using the mouse. r=ssu, sr=sspitzer, a=asa

This commit is contained in:
ssu%netscape.com 2002-03-15 05:29:21 +00:00
Родитель 3d2827cf98
Коммит f0b97df6c6
3 изменённых файлов: 53 добавлений и 1 удалений

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

@ -342,6 +342,8 @@ var defaultController =
//Edit Menu
case "cmd_pasteQuote":
case "cmd_delete":
case "cmd_selectAll":
case "cmd_find":
case "cmd_findNext":
case "cmd_account":
@ -459,6 +461,10 @@ var defaultController =
case "cmd_findNext":
//Disable the editor specific edit commands if the focus is not into the body
return !focusedElement;
case "cmd_delete":
return MessageHasSelectedAttachments();
case "cmd_selectAll":
return MessageHasAttachments();
case "cmd_account":
case "cmd_preferences":
return true;
@ -579,6 +585,8 @@ var defaultController =
case "cmd_print" : DoCommandPrint(); break;
//Edit Menu
case "cmd_delete" : if (MessageHasSelectedAttachments()) RemoveSelectedAttachment(); break;
case "cmd_selectAll" : if (MessageHasAttachments()) SelectAllAttachments(); break;
case "cmd_account" : MsgAccountManager(null); break;
case "cmd_preferences" : DoCommandPreferences(); break;
@ -661,6 +669,8 @@ function updateComposeItems() {
function updateEditItems() {
goUpdateCommand("cmd_pasteQuote");
goUpdateCommand("cmd_delete");
goUpdateCommand("cmd_selectAll");
goUpdateCommand("cmd_find");
goUpdateCommand("cmd_findNext");
}
@ -2153,6 +2163,32 @@ function AddAttachment(attachment)
}
}
function SelectAllAttachments()
{
var bucketTree = document.getElementById("attachmentBucket");
if (bucketTree)
bucketTree.selectAll();
}
function MessageHasAttachments()
{
var bucketTree = document.getElementById("attachmentBucket");
if (bucketTree)
{
var body = document.getElementById("bucketBody");
return (body && body.hasChildNodes() && (bucketTree == top.document.commandDispatcher.focusedElement));
}
return false;
}
function MessageHasSelectedAttachments()
{
var bucketTree = document.getElementById("attachmentBucket");
if (bucketTree)
return (MessageHasAttachments() && bucketTree.selectedItems.length);
return false;
}
function AttachPage()
{
@ -2257,8 +2293,9 @@ function RemoveSelectedAttachment()
gContentChanged = true;
}
// Clear selection after removal
bucketTree.selectedItems.length = 0;
}
}
function FocusOnFirstAttachment()
@ -2519,6 +2556,9 @@ function editorKeyPress(event)
function AttachmentBucketClicked(event)
{
if (event.button != 0)
return;
if (event.originalTarget.localName == 'treechildren')
goDoCommand('cmd_attachFile');
}

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

@ -117,6 +117,8 @@
<!--command id="cmd_pasteQuote"/ DO NOT INCLUDE THOSE PBROCASTER ESLE THE EDIT MENU WILL BE BROKEN! -->
<!--command id="cmd_find"/-->
<!--command id="cmd_findNext"/-->
<command id="cmd_delete"/>
<command id="cmd_selectAll"/>
<command id="cmd_account" oncommand="goDoCommand('cmd_account')"/>
<!-- View Menu -->
@ -186,6 +188,13 @@
<menuitem label="&selectAll.label;" accesskey="&selectAll.accesskey;" command="cmd_selectAll"/>
</popup>
<popup id="msgComposeAttachmentContext" onpopupshowing="updateEditItems();">
<menuitem label="&delete.label;" accesskey="&delete.accesskey;" command="cmd_delete"/>
<menuitem label="&selectAll.label;" accesskey="&selectAll.accesskey;" command="cmd_selectAll"/>
<menuseparator/>
<menuitem label="&addAttachment.label;" accesskey="&addAttachment.accesskey;" command="cmd_attachFile"/>
</popup>
<toolbox class="toolbox-top" id="headers-box">
<menubar id="compose-menubar" grippytooltiptext="&menuBar.tooltip;">
<menu id="menu_File">
@ -426,6 +435,7 @@
dragdroptree="true"
onkeypress="if (event.keyCode == 8 || event.keyCode == 46) RemoveSelectedAttachment();"
onclick="AttachmentBucketClicked(event);"
context="msgComposeAttachmentContext"
ondragover="nsDragAndDrop.dragOver(event, attachmentBucketObserver);"
ondragdrop="nsDragAndDrop.drop(event, attachmentBucketObserver);"
ondragexit="nsDragAndDrop.dragExit(event, attachmentBucketObserver);">

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

@ -202,3 +202,5 @@
<!ENTITY delete.accesskey "D">
<!ENTITY selectAll.label "Select All">
<!ENTITY selectAll.accesskey "A">
<!ENTITY addAttachment.label "Add Attachment">
<!ENTITY addAttachment.accesskey "t">