Bug 88633 Disable the attachments menuitem when we have no attachments r=Stefan.Borggraefe sr=mscott
git-svn-id: svn://10.0.0.236/trunk@156694 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
@@ -651,7 +651,7 @@ function CreateDBView(msgFolder, viewType, viewFlags, sortType, sortOrder)
|
||||
|
||||
// based on the collapsed state of the thread pane/message pane splitter,
|
||||
// suppress message display if appropriate.
|
||||
gDBView.suppressMsgDisplay = IsThreadAndMessagePaneSplitterCollapsed();
|
||||
gDBView.suppressMsgDisplay = IsMessagePaneCollapsed();
|
||||
|
||||
UpdateSortIndicators(gCurSortType, sortOrder);
|
||||
}
|
||||
@@ -682,8 +682,18 @@ function GetSelectedFolderResource()
|
||||
return GetFolderResource(folderTree, startIndex.value);
|
||||
}
|
||||
|
||||
function NotifyChangedMessagePaneVisibility(now_hidden)
|
||||
function ChangeMessagePaneVisibility(now_hidden)
|
||||
{
|
||||
// we also have to hide the File/Attachments menuitem
|
||||
node = document.getElementById("fileAttachmentMenu");
|
||||
if (node)
|
||||
node.hidden = now_hidden;
|
||||
|
||||
if (gDBView) {
|
||||
// the collapsed state is the state after we released the mouse
|
||||
// so we take it as it is
|
||||
gDBView.suppressMsgDisplay = now_hidden;
|
||||
}
|
||||
var event = document.createEvent('Events');
|
||||
if (now_hidden) {
|
||||
event.initEvent('messagepane-hide', false, true);
|
||||
@@ -698,22 +708,14 @@ function OnMouseUpThreadAndMessagePaneSplitter()
|
||||
{
|
||||
// the collapsed state is the state after we released the mouse
|
||||
// so we take it as it is
|
||||
var now_hidden = IsThreadAndMessagePaneSplitterCollapsed();
|
||||
if (gDBView) {
|
||||
gDBView.suppressMsgDisplay = now_hidden;
|
||||
}
|
||||
NotifyChangedMessagePaneVisibility(now_hidden);
|
||||
ChangeMessagePaneVisibility(IsMessagePaneCollapsed());
|
||||
}
|
||||
|
||||
function OnClickThreadAndMessagePaneSplitterGrippy()
|
||||
{
|
||||
// the collapsed state is the state when we clicked on the grippy
|
||||
// not when afterwards, so we need to reverse this value
|
||||
var now_hidden = !IsThreadAndMessagePaneSplitterCollapsed();
|
||||
if (gDBView) {
|
||||
gDBView.suppressMsgDisplay = now_hidden;
|
||||
}
|
||||
NotifyChangedMessagePaneVisibility(now_hidden);
|
||||
ChangeMessagePaneVisibility(!IsMessagePaneCollapsed());
|
||||
}
|
||||
|
||||
function FolderPaneSelectionChange()
|
||||
|
||||
@@ -894,7 +894,7 @@ function IsFolderSelected()
|
||||
|
||||
function IsMessageDisplayedInMessagePane()
|
||||
{
|
||||
return (!IsThreadAndMessagePaneSplitterCollapsed() && (GetNumSelectedMessages() > 0));
|
||||
return (!IsMessagePaneCollapsed() && (GetNumSelectedMessages() > 0));
|
||||
}
|
||||
|
||||
function MsgDeleteFolder()
|
||||
@@ -1047,7 +1047,7 @@ function SwitchPaneFocus(event)
|
||||
searchInput.focus();
|
||||
else if ((focusedElement == threadTree || focusedElement == searchInput) && !IsFolderPaneCollapsed())
|
||||
folderTree.focus();
|
||||
else if (focusedElement != messagePane && !IsThreadAndMessagePaneSplitterCollapsed())
|
||||
else if (focusedElement != messagePane && !IsMessagePaneCollapsed())
|
||||
SetFocusMessagePane();
|
||||
else
|
||||
threadTree.focus();
|
||||
@@ -1056,7 +1056,7 @@ function SwitchPaneFocus(event)
|
||||
{
|
||||
if (focusedElement == searchInput)
|
||||
threadTree.focus();
|
||||
else if (focusedElement == threadTree && !IsThreadAndMessagePaneSplitterCollapsed())
|
||||
else if (focusedElement == threadTree && !IsMessagePaneCollapsed())
|
||||
SetFocusMessagePane();
|
||||
else if (focusedElement != folderTree && !IsFolderPaneCollapsed())
|
||||
folderTree.focus();
|
||||
|
||||
@@ -133,34 +133,9 @@ function goUpdateMailMenuItems(commandset)
|
||||
|
||||
function file_init()
|
||||
{
|
||||
if (!gMessengerBundle)
|
||||
gMessengerBundle = document.getElementById("bundle_messenger");
|
||||
file_attachments();
|
||||
/* file_attachments() can return false to indicate a load failure,
|
||||
but if you return false to oncreate then
|
||||
the popup menu will not display which is not a good thing.
|
||||
*/
|
||||
|
||||
document.commandDispatcher.updateCommands('create-menu-file');
|
||||
}
|
||||
|
||||
function file_attachments()
|
||||
{
|
||||
var numAttachments = GetNumberOfAttachmentsForDisplayedMessage();
|
||||
var amParent=document.getElementById('fileAttachmentMenu');
|
||||
if (!amParent)
|
||||
return false;
|
||||
|
||||
// hide the attachment menu item if the message does not have any messages..
|
||||
if (numAttachments > 0)
|
||||
{
|
||||
amParent.removeAttribute('hidden');
|
||||
}
|
||||
else
|
||||
amParent.setAttribute('hidden',true);
|
||||
return true;
|
||||
}
|
||||
|
||||
function InitEditMessagesMenu()
|
||||
{
|
||||
goSetMenuValue('cmd_delete', 'valueDefault');
|
||||
@@ -183,7 +158,7 @@ function view_init()
|
||||
{
|
||||
var message_menuitem_hidden = message_menuitem.getAttribute("hidden");
|
||||
if(message_menuitem_hidden != "true"){
|
||||
message_menuitem.setAttribute('checked',!IsThreadAndMessagePaneSplitterCollapsed());
|
||||
message_menuitem.setAttribute('checked', !IsMessagePaneCollapsed());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1049,7 +1049,7 @@
|
||||
key="key_openFileMessage"
|
||||
accesskey="&openMessageFileCmd.accesskey;"
|
||||
oncommand="MsgOpenFromFile();"/>
|
||||
<menu id="fileAttachmentMenu" label="&openAttachmentCmd.label;" accesskey="&openAttachmentCmd.accesskey;">
|
||||
<menu id="fileAttachmentMenu" label="&openAttachmentCmd.label;" accesskey="&openAttachmentCmd.accesskey;" disabled="true" persist="hidden">
|
||||
<menupopup id="attachmentMenuList" onpopupshowing="FillAttachmentListPopup(this);"/>
|
||||
</menu>
|
||||
<menuitem id="menu_close"/>
|
||||
|
||||
@@ -381,6 +381,11 @@ var messageHeaderSink = {
|
||||
// we only need to do this on the first attachment
|
||||
var numAttachments = currentAttachments.length;
|
||||
if (numAttachments == 1) {
|
||||
// we also have to enable the File/Attachments menuitem
|
||||
var node = document.getElementById("fileAttachmentMenu");
|
||||
if (node)
|
||||
node.removeAttribute("disabled");
|
||||
|
||||
try {
|
||||
// convert the uri into a hdr
|
||||
var hdr = messenger.messageServiceFromURI(uri).messageURIToMsgHdr(uri);
|
||||
@@ -667,6 +672,11 @@ function HideMessageHeaderPane()
|
||||
node = document.getElementById("expandedHeaderView");
|
||||
if (node)
|
||||
node.collapsed = true;
|
||||
|
||||
// we also have to disable the File/Attachments menuitem
|
||||
node = document.getElementById("fileAttachmentMenu");
|
||||
if (node)
|
||||
node.setAttribute("disabled", "true");
|
||||
}
|
||||
|
||||
function OutputNewsgroups(headerEntry, headerValue)
|
||||
@@ -1116,6 +1126,11 @@ function SaveAllAttachments()
|
||||
|
||||
function ClearAttachmentList()
|
||||
{
|
||||
// we also have to disable the File/Attachments menuitem
|
||||
node = document.getElementById("fileAttachmentMenu");
|
||||
if (node)
|
||||
node.setAttribute("disabled", "true");
|
||||
|
||||
// clear selection
|
||||
var list = document.getElementById('attachmentList');
|
||||
list.clearSelection();
|
||||
|
||||
@@ -1039,7 +1039,7 @@ function GetTotalCountElement()
|
||||
return totalCount;
|
||||
}
|
||||
|
||||
function IsThreadAndMessagePaneSplitterCollapsed()
|
||||
function IsMessagePaneCollapsed()
|
||||
{
|
||||
var messagePane = GetMessagePane();
|
||||
try {
|
||||
|
||||
Reference in New Issue
Block a user