Bug 190298: already-attached attachments (in drafts) should be able to
be rename r=mnyromyr, r=philringnalda sr=neil git-svn-id: svn://10.0.0.236/trunk@249943 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
parent
85a8c57fba
commit
f1a04ea430
@ -391,6 +391,7 @@ var defaultController =
|
||||
|
||||
//Edit Menu
|
||||
case "cmd_delete":
|
||||
case "cmd_renameAttachment":
|
||||
case "cmd_selectAll":
|
||||
case "cmd_openAttachment":
|
||||
case "cmd_account":
|
||||
@ -442,6 +443,8 @@ var defaultController =
|
||||
return MessageHasAttachments();
|
||||
case "cmd_openAttachment":
|
||||
return MessageGetNumSelectedAttachments() == 1;
|
||||
case "cmd_renameAttachment":
|
||||
return MessageGetNumSelectedAttachments() == 1;
|
||||
case "cmd_account":
|
||||
|
||||
//View Menu
|
||||
@ -496,6 +499,7 @@ var defaultController =
|
||||
|
||||
//Edit Menu
|
||||
case "cmd_delete" : if (MessageGetNumSelectedAttachments()) RemoveSelectedAttachment(); break;
|
||||
case "cmd_renameAttachment" : if (MessageGetNumSelectedAttachments() == 1) RenameSelectedAttachment(); break;
|
||||
case "cmd_selectAll" : if (MessageHasAttachments()) SelectAllAttachments(); break;
|
||||
case "cmd_openAttachment" : if (MessageGetNumSelectedAttachments() == 1) OpenSelectedAttachment(); break;
|
||||
case "cmd_account" : MsgAccountManager(null); break;
|
||||
@ -632,6 +636,7 @@ function updateEditItems()
|
||||
goUpdateCommand("cmd_pasteNoFormatting");
|
||||
goUpdateCommand("cmd_pasteQuote");
|
||||
goUpdateCommand("cmd_delete");
|
||||
goUpdateCommand("cmd_renameAttachment");
|
||||
goUpdateCommand("cmd_selectAll");
|
||||
goUpdateCommand("cmd_openAttachment");
|
||||
goUpdateCommand("cmd_find");
|
||||
@ -2632,11 +2637,7 @@ function MessageHasAttachments()
|
||||
function MessageGetNumSelectedAttachments()
|
||||
{
|
||||
var bucketList = document.getElementById("attachmentBucket");
|
||||
|
||||
if (bucketList)
|
||||
return bucketList.selectedItems.length;
|
||||
else
|
||||
return 0;
|
||||
return (bucketList) ? bucketList.selectedItems.length : 0;
|
||||
}
|
||||
|
||||
function AttachPage()
|
||||
@ -2728,6 +2729,33 @@ function RemoveSelectedAttachment()
|
||||
}
|
||||
}
|
||||
|
||||
function RenameSelectedAttachment()
|
||||
{
|
||||
var bucket = document.getElementById("attachmentBucket");
|
||||
if (bucket.selectedItems.length != 1)
|
||||
return; // not one attachment selected
|
||||
|
||||
var bundle = document.getElementById("bundle_composeMsgs");
|
||||
var item = bucket.getSelectedItem(0);
|
||||
var attachmentName = {value: item.attachment.name};
|
||||
if (gPromptService.prompt(
|
||||
window,
|
||||
bundle.getString("renameAttachmentTitle"),
|
||||
bundle.getString("renameAttachmentMessage"),
|
||||
attachmentName,
|
||||
null,
|
||||
{value: 0}))
|
||||
{
|
||||
var modifiedAttachmentName = attachmentName.value;
|
||||
if (modifiedAttachmentName == "")
|
||||
return; // name was not filled, bail out
|
||||
|
||||
item.label = modifiedAttachmentName;
|
||||
item.attachment.name = modifiedAttachmentName;
|
||||
gContentChanged = true;
|
||||
}
|
||||
}
|
||||
|
||||
function FocusOnFirstAttachment()
|
||||
{
|
||||
var bucketList = document.getElementById("attachmentBucket");
|
||||
|
||||
@ -154,6 +154,7 @@
|
||||
<command id="cmd_paste" oncommand="goDoCommand('cmd_paste')" disabled="true"/>
|
||||
<command id="cmd_rewrap" oncommand="goDoCommand('cmd_rewrap')"/>
|
||||
<command id="cmd_delete" oncommand="goDoCommand('cmd_delete')" valueDefault="&deleteCmd.label;" disabled="true"/>
|
||||
<command id="cmd_renameAttachment" oncommand="goDoCommand('cmd_renameAttachment')" disabled="true"/>
|
||||
<command id="cmd_selectAll" oncommand="goDoCommand('cmd_selectAll')" disabled="true"/>
|
||||
<command id="cmd_openAttachment" oncommand="goDoCommand('cmd_openAttachment')" disabled="true"/>
|
||||
<command id="cmd_account" oncommand="goDoCommand('cmd_account')"/>
|
||||
@ -279,6 +280,7 @@
|
||||
<popup id="msgComposeAttachmentContext" onpopupshowing="updateEditItems();">
|
||||
<menuitem label="&openAttachment.label;" accesskey="&openAttachment.accesskey;" command="cmd_openAttachment"/>
|
||||
<menuitem label="&delete.label;" accesskey="&delete.accesskey;" command="cmd_delete"/>
|
||||
<menuitem label="&renameAttachment.label;" accesskey="&renameAttachment.accesskey;" command="cmd_renameAttachment"/>
|
||||
<menuitem label="&selectAll.label;" accesskey="&selectAll.accesskey;" command="cmd_selectAll"/>
|
||||
<menuseparator/>
|
||||
<menuitem label="&attachFile.label;" accesskey="&attachFile.accesskey;" command="cmd_attachFile"/>
|
||||
|
||||
@ -328,3 +328,7 @@ mailnews.reply_header_ondate=On %s
|
||||
## reply header in composeMsg
|
||||
## user specified
|
||||
mailnews.reply_header_originalmessage=-------- Original Message --------
|
||||
|
||||
## Strings used by the rename attachment dialog
|
||||
renameAttachmentTitle=Rename Attachment
|
||||
renameAttachmentMessage=New attachment name:
|
||||
|
||||
@ -262,6 +262,8 @@
|
||||
<!ENTITY openAttachment.accesskey "O">
|
||||
<!ENTITY delete.label "Delete">
|
||||
<!ENTITY delete.accesskey "D">
|
||||
<!ENTITY renameAttachment.label "Rename…">
|
||||
<!ENTITY renameAttachment.accesskey "R">
|
||||
<!ENTITY selectAll.label "Select All">
|
||||
<!ENTITY selectAll.accesskey "A">
|
||||
<!ENTITY attachFile.label "Attach File(s)…">
|
||||
|
||||
@ -413,6 +413,7 @@ var defaultController =
|
||||
|
||||
//Edit Menu
|
||||
case "cmd_delete":
|
||||
case "cmd_renameAttachment":
|
||||
case "cmd_selectAll":
|
||||
case "cmd_openAttachment":
|
||||
case "cmd_account":
|
||||
@ -461,6 +462,8 @@ var defaultController =
|
||||
//Edit Menu
|
||||
case "cmd_delete":
|
||||
return MessageGetNumSelectedAttachments() > 0;
|
||||
case "cmd_renameAttachment":
|
||||
return MessageGetNumSelectedAttachments() == 1;
|
||||
case "cmd_selectAll":
|
||||
return MessageHasAttachments();
|
||||
case "cmd_openAttachment":
|
||||
@ -521,6 +524,7 @@ var defaultController =
|
||||
|
||||
//Edit Menu
|
||||
case "cmd_delete" : if (MessageGetNumSelectedAttachments() > 0) RemoveSelectedAttachment(); break;
|
||||
case "cmd_renameAttachment" : if (MessageGetNumSelectedAttachments() == 1) RenameSelectedAttachment(); break;
|
||||
case "cmd_selectAll" : if (MessageHasAttachments()) SelectAllAttachments(); break;
|
||||
case "cmd_openAttachment" : if (MessageGetNumSelectedAttachments() == 1) OpenSelectedAttachment(); break;
|
||||
case "cmd_account" : MsgAccountManager(null); break;
|
||||
@ -640,6 +644,7 @@ function updateEditItems()
|
||||
goUpdateCommand("cmd_pasteNoFormatting");
|
||||
goUpdateCommand("cmd_pasteQuote");
|
||||
goUpdateCommand("cmd_delete");
|
||||
goUpdateCommand("cmd_renameAttachment");
|
||||
goUpdateCommand("cmd_selectAll");
|
||||
goUpdateCommand("cmd_openAttachment");
|
||||
goUpdateCommand("cmd_find");
|
||||
@ -2604,10 +2609,7 @@ function MessageHasAttachments()
|
||||
function MessageGetNumSelectedAttachments()
|
||||
{
|
||||
var bucketList = document.getElementById("attachmentBucket");
|
||||
|
||||
if (bucketList)
|
||||
return bucketList.selectedItems.length;
|
||||
return 0;
|
||||
return (bucketList) ? bucketList.selectedItems.length : 0;
|
||||
}
|
||||
|
||||
function AttachPage()
|
||||
@ -2678,6 +2680,32 @@ function RemoveSelectedAttachment()
|
||||
}
|
||||
}
|
||||
|
||||
function RenameSelectedAttachment()
|
||||
{
|
||||
var bucket = document.getElementById("attachmentBucket");
|
||||
if (bucket.selectedItems.length != 1)
|
||||
return; // not one attachment selected
|
||||
|
||||
var item = bucket.getSelectedItem(0);
|
||||
var attachmentName = {value: item.attachment.name};
|
||||
if (gPromptService.prompt(
|
||||
window,
|
||||
sComposeMsgsBundle.getString("renameAttachmentTitle"),
|
||||
sComposeMsgsBundle.getString("renameAttachmentMessage"),
|
||||
attachmentName,
|
||||
null,
|
||||
{value: 0}))
|
||||
{
|
||||
var modifiedAttachmentName = attachmentName.value;
|
||||
if (modifiedAttachmentName == "")
|
||||
return; // name was not filled, bail out
|
||||
|
||||
item.label = modifiedAttachmentName;
|
||||
item.attachment.name = modifiedAttachmentName;
|
||||
gContentChanged = true;
|
||||
}
|
||||
}
|
||||
|
||||
function FocusOnFirstAttachment()
|
||||
{
|
||||
var bucketList = document.getElementById("attachmentBucket");
|
||||
|
||||
@ -144,6 +144,7 @@
|
||||
<!--command id="cmd_findNext"/-->
|
||||
<command id="cmd_rewrap" oncommand="goDoCommand('cmd_rewrap')"/>
|
||||
<command id="cmd_delete"/>
|
||||
<command id="cmd_renameAttachment" oncommand="goDoCommand('cmd_renameAttachment')" disabled="true"/>
|
||||
<command id="cmd_selectAll"/>
|
||||
<command id="cmd_openAttachment" oncommand="goDoCommand('cmd_openAttachment')"/>
|
||||
<command id="cmd_account" oncommand="goDoCommand('cmd_account')"/>
|
||||
@ -237,6 +238,7 @@
|
||||
<popup id="msgComposeAttachmentContext" onpopupshowing="updateEditItems();">
|
||||
<menuitem label="&openAttachment.label;" accesskey="&openAttachment.accesskey;" command="cmd_openAttachment"/>
|
||||
<menuitem label="&delete.label;" accesskey="&delete.accesskey;" command="cmd_delete"/>
|
||||
<menuitem label="&renameAttachment.label;" accesskey="&renameAttachment.accesskey;" command="cmd_renameAttachment"/>
|
||||
<menuitem label="&selectAll.label;" accesskey="&selectAll.accesskey;" command="cmd_selectAll"/>
|
||||
<menuseparator/>
|
||||
<menuitem label="&attachFile.label;" accesskey="&attachFile.accesskey;" command="cmd_attachFile"/>
|
||||
|
||||
@ -332,3 +332,7 @@ mailnews.reply_header_ondate=On %s
|
||||
## reply header in composeMsg
|
||||
## user specified
|
||||
mailnews.reply_header_originalmessage=-------- Original Message --------
|
||||
|
||||
## Strings used by the rename attachment dialog
|
||||
renameAttachmentTitle=Rename Attachment
|
||||
renameAttachmentMessage=New attachment name:
|
||||
|
||||
@ -219,6 +219,8 @@
|
||||
<!ENTITY openAttachment.accesskey "O">
|
||||
<!ENTITY delete.label "Delete">
|
||||
<!ENTITY delete.accesskey "D">
|
||||
<!ENTITY renameAttachment.label "Rename…">
|
||||
<!ENTITY renameAttachment.accesskey "R">
|
||||
<!ENTITY selectAll.label "Select All">
|
||||
<!ENTITY selectAll.accesskey "A">
|
||||
<!ENTITY attachFile.label "Attach File(s)…">
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user