From d63000ffb06f1c74b5d3215477135715d57355d7 Mon Sep 17 00:00:00 2001 From: "putterman%netscape.com" Date: Sat, 26 Aug 2000 20:54:51 +0000 Subject: [PATCH] Fixes for 48246, 48985, and 20129. Fixed up enabling and disabling of 3pane menu items. Added accelerators. Added busy cursor around sorting, threading and folder loading. r=bienvenu --- .../resources/content/addressbook.xul | 4 - .../base/resources/content/commandglue.js | 25 +- .../base/resources/content/folderPane.xul | 2 +- .../content/mail3PaneWindowCommands.js | 247 ++++++++++++------ .../content/mail3PaneWindowVertLayout.xul | 5 +- .../base/resources/content/mailABOverlay.xul | 2 +- .../resources/content/mailEditorOverlay.xul | 3 +- .../content/mailMessengerComposeOverlay.xul | 2 +- .../content/mailMessengerOverlay.xul | 4 +- .../content/mailNavigatorOverlay.xul | 2 +- .../base/resources/content/mailOverlay.xul | 6 +- mailnews/base/resources/content/mailWindow.js | 20 ++ .../resources/content/mailWindowOverlay.js | 150 ++++++++--- .../resources/content/mailWindowOverlay.xul | 103 ++++---- .../base/resources/content/messageWindow.js | 159 ++++++++++- mailnews/base/resources/content/messenger.xul | 7 +- .../resources/content/msgMail3PaneWindow.js | 66 +++-- mailnews/base/resources/content/threadPane.js | 31 ++- .../base/resources/content/threadPane.xul | 10 +- .../base/resources/locale/en-US/messenger.dtd | 9 +- .../resources/content/messengercompose.xul | 2 +- 21 files changed, 626 insertions(+), 233 deletions(-) diff --git a/mailnews/addrbook/resources/content/addressbook.xul b/mailnews/addrbook/resources/content/addressbook.xul index 8b405ed91a24..b66112b6969d 100644 --- a/mailnews/addrbook/resources/content/addressbook.xul +++ b/mailnews/addrbook/resources/content/addressbook.xul @@ -64,7 +64,6 @@ Rights Reserved. - @@ -88,7 +87,6 @@ Rights Reserved. - @@ -117,8 +115,6 @@ Rights Reserved. - - diff --git a/mailnews/base/resources/content/commandglue.js b/mailnews/base/resources/content/commandglue.js index f26f24f0215a..8e7be09b63e2 100644 --- a/mailnews/base/resources/content/commandglue.js +++ b/mailnews/base/resources/content/commandglue.js @@ -177,6 +177,7 @@ function ChangeFolderByURI(uri, isThreaded, sortID, sortDirection) { try { + SetBusyCursor(window, true); gCurrentFolderToReroot = uri; gCurrentLoadingFolderIsThreaded = isThreaded; gCurrentLoadingFolderSortID = sortID; @@ -191,6 +192,7 @@ function ChangeFolderByURI(uri, isThreaded, sortID, sortDirection) } else { + SetBusyCursor(window, true); gCurrentFolderToReroot = ""; gCurrentLoadingFolderIsThreaded = false; gCurrentLoadingFolderSortID = ""; @@ -240,9 +242,9 @@ function RerootFolder(uri, newFolder, isThreaded, sortID, sortDirection) var column = FindThreadPaneColumnBySortResource(sortID); if(column) - SortThreadPane(column, sortID, "http://home.netscape.com/NC-rdf#Date", false, sortDirection); + SortThreadPane(column, sortID, "http://home.netscape.com/NC-rdf#Date", false, sortDirection, false); else - SortThreadPane("DateColumn", "http://home.netscape.com/NC-rdf#Date", "", false, null); + SortThreadPane("DateColumn", "http://home.netscape.com/NC-rdf#Date", "", false, null, false); SetSentFolderColumns(IsSpecialFolder(newFolder, "Sent")); @@ -256,6 +258,7 @@ function RerootFolder(uri, newFolder, isThreaded, sortID, sortDirection) msgNavigationService.EnsureDocumentIsLoaded(document); UpdateStatusMessageCounts(newFolder); + } function SetSentFolderColumns(isSentFolder) @@ -352,9 +355,13 @@ function RestoreThreadPaneSelection(selectionArray) messageElement = document.getElementById(selectionArray[i]); } - tree.addItemToSelection(messageElement); - if(messageElement && (i==0)) - tree.ensureElementIsVisible(messageElement); + if(messageElement) + { + dump("We have a messageElement\n"); + tree.addItemToSelection(messageElement); + if(i==0) + tree.ensureElementIsVisible(messageElement); + } } } @@ -394,9 +401,9 @@ function FindThreadPaneColumnBySortResource(sortID) //If toggleCurrentDirection is true, then get current direction and flip to opposite. //If it's not true then use the direction passed in. -function SortThreadPane(column, sortKey, secondarySortKey, toggleCurrentDirection, direction) +function SortThreadPane(column, sortKey, secondarySortKey, toggleCurrentDirection, direction, changeCursor) { - dump("In SortThreadPane\n"); + //dump("In SortThreadPane\n"); var node = document.getElementById(column); if(!node) return false; @@ -430,7 +437,11 @@ function SortThreadPane(column, sortKey, secondarySortKey, toggleCurrentDirectio var selection = SaveThreadPaneSelection(); var beforeSortTime = new Date(); + if(changeCursor) + SetBusyCursor(window, true); var result = SortColumn(node, sortKey, secondarySortKey, direction); + if(changeCursor) + SetBusyCursor(window, false); var afterSortTime = new Date(); var timeToSort = (afterSortTime.getTime() - beforeSortTime.getTime())/1000; diff --git a/mailnews/base/resources/content/folderPane.xul b/mailnews/base/resources/content/folderPane.xul index c712df938311..1c19294bb8ae 100644 --- a/mailnews/base/resources/content/folderPane.xul +++ b/mailnews/base/resources/content/folderPane.xul @@ -34,7 +34,7 @@ 0) { var specialFolder = null; + var isServer = null; + var serverType = null; try { - specialFolder = folderTree.selectedItems[0].getAttribute('SpecialFolder'); + var selectedFolder = folderTree.selectedItems[0]; + specialFolder = selectedFolder.getAttribute('SpecialFolder'); + isServer = selectedFolder.getAttribute('IsServer'); + serverType = selectedFolder.getAttribute('ServerType'); } catch (ex) { //dump("specialFolder failure: " + ex + "\n"); } - if (specialFolder == "Inbox" || specialFolder == "Trash") + if (specialFolder == "Inbox" || specialFolder == "Trash" || isServer == "true") return false; else return true; @@ -175,10 +180,15 @@ var DefaultController = { case "cmd_reply": case "button_reply": + case "cmd_replySender": + case "cmd_replyGroup": case "cmd_replyall": case "button_replyall": case "cmd_forward": case "button_forward": + case "cmd_forwardInline": + case "cmd_forwardAttachment": + case "cmd_editAsNew": case "cmd_delete": case "button_delete": case "cmd_shiftDelete": @@ -189,16 +199,6 @@ var DefaultController = case "cmd_previousMsg": case "cmd_previousUnreadMsg": case "cmd_previousFlaggedMsg": - case "cmd_sortBySubject": - case "cmd_sortByDate": - case "cmd_sortByFlag": - case "cmd_sortByPriority": - case "cmd_sortBySender": - case "cmd_sortBySize": - case "cmd_sortByStatus": - case "cmd_sortByRead": - case "cmd_sortByOrderReceived": - case "cmd_sortByThread": case "cmd_viewAllMsgs": case "cmd_viewUnreadMsgs": case "cmd_undo": @@ -212,6 +212,17 @@ var DefaultController = case "cmd_saveAsTemplate": case "cmd_viewPageSource": case "cmd_reload": + case "cmd_getNewMessages": + case "cmd_find": + case "cmd_findAgain": + case "cmd_markAsRead": + case "cmd_markAllRead": + case "cmd_markThreadAsRead": + case "cmd_markAsFlagged": + case "cmd_file": + case "cmd_emptyTrash": + case "cmd_compactFolder": + case "cmd_sortByThread": return true; default: return false; @@ -224,10 +235,15 @@ var DefaultController = { case "cmd_reply": case "button_reply": + case "cmd_replySender": + case "cmd_replyGroup": case "cmd_replyall": case "button_replyall": case "cmd_forward": case "button_forward": + case "cmd_forwardInline": + case "cmd_forwardAttachment": + case "cmd_editAsNew": case "cmd_delete": case "button_delete": case "cmd_shiftDelete": @@ -237,10 +253,11 @@ var DefaultController = case "cmd_saveAsTemplate": case "cmd_viewPageSource": case "cmd_reload": - var threadTree = GetThreadTree(); - var numSelected = 0; - if ( threadTree && threadTree.selectedItems ) - numSelected = threadTree.selectedItems.length; + case "cmd_markThreadAsRead": + case "cmd_markAsFlagged": + case "cmd_file": + var numSelected = GetNumSelectedMessages(); + if ( command == "cmd_delete") { if ( numSelected < 2 ) @@ -254,20 +271,17 @@ var DefaultController = case "cmd_nextUnreadThread": case "cmd_previousMsg": case "cmd_previousUnreadMsg": - //Input and TextAreas should get access to the keys that cause these commands. - //Currently if we don't do this then we will steal the key away and you can't type them - //in these controls. This is a bug that should be fixed and when it is we can get rid of - //this. - var focusedElement = top.document.commandDispatcher.focusedElement; - if(focusedElement) - { - var name = focusedElement.localName; - return ((name != "INPUT") && (name != "TEXTAREA")); - } + return MailAreaHasFocus() && IsViewNavigationItemEnabled(); + case "cmd_markAsRead": + if(!MailAreaHasFocus()) + return false; else - { - return true; - } + return(GetNumSelectedMessages() > 0); + case "cmd_markAllRead": + return(MailAreaHasFocus() && IsFolderSelected()); + case "cmd_find": + case "cmd_findAgain": + return IsFindEnabled(); break; case "cmd_expandAllThreads": case "cmd_collapseAllThreads": @@ -275,15 +289,7 @@ var DefaultController = break; case "cmd_nextFlaggedMsg": case "cmd_previousFlaggedMsg": - case "cmd_sortBySubject": - case "cmd_sortByDate": - case "cmd_sortByFlag": - case "cmd_sortByPriority": - case "cmd_sortBySender": - case "cmd_sortBySize": - case "cmd_sortByStatus": - case "cmd_sortByRead": - case "cmd_sortByOrderReceived": + return IsViewNavigationItemEnabled(); case "cmd_viewAllMsgs": return true; case "cmd_sortByThread": @@ -297,6 +303,12 @@ var DefaultController = return SetupUndoRedoCommand(command); case "cmd_renameFolder": return IsRenameFolderEnabled(); + case "cmd_getNewMessages": + return IsGetNewMessagesEnabled(); + case "cmd_emptyTrash": + return IsEmptyTrashEnabled(); + case "cmd_compactFolder": + return IsCompactFolderEnabled(); default: return false; } @@ -308,15 +320,33 @@ var DefaultController = switch ( command ) { + case "cmd_getNewMessages": + MsgGetMessage(); + break; case "cmd_reply": MsgReplyMessage(null); break; + case "cmd_replySender": + MsgReplySender(null); + break; + case "cmd_replyGroup": + MsgReplyGroup(null); + break; case "cmd_replyall": MsgReplyToAllMessage(null); break; case "cmd_forward": MsgForwardMessage(null); break; + case "cmd_forwardInline": + MsgForwardAsInline(null); + break; + case "cmd_forwardAttachment": + MsgForwardAsAttachment(null); + break; + case "cmd_editAsNew": + MsgEditMessageAsNew(); + break; case "cmd_delete": MsgDeleteMessage(false, false); break; @@ -347,33 +377,6 @@ var DefaultController = case "cmd_previousFlaggedMsg": MsgPreviousFlaggedMessage(); break; - case "cmd_sortBySubject": - MsgSortBySubject(); - break; - case "cmd_sortByDate": - MsgSortByDate(); - break; - case "cmd_sortByFlag": - MsgSortByFlagged(); - break; - case "cmd_sortByPriority": - MsgSortByPriority(); - break; - case "cmd_sortBySender": - MsgSortBySender(); - break; - case "cmd_sortBySize": - MsgSortBySize(); - break; - case "cmd_sortByStatus": - MsgSortByStatus(); - break; - case "cmd_sortByRead": - MsgSortByRead(); - break; - case "cmd_sortByOrderReceived": - MsgSortByOrderReceived(); - break; case "cmd_sortByThread": MsgSortByThread(); break; @@ -416,6 +419,30 @@ var DefaultController = case "cmd_reload": MsgReload(); return; + case "cmd_find": + MsgFind(); + return; + case "cmd_findAgain": + MsgFindAgain(); + return; + case "cmd_markAsRead": + MsgMarkMsgAsRead(null); + return; + case "cmd_markThreadAsRead": + MsgMarkThreadAsRead(); + return; + case "cmd_markAllRead": + MsgMarkAllRead(); + return; + case "cmd_markAsFlagged": + MsgMarkAsFlagged(null); + return; + case "cmd_emptyTrash": + MsgEmptyTrash(); + return; + case "cmd_compactFolder": + MsgCompactFolder(); + return; } }, @@ -431,6 +458,29 @@ var DefaultController = } }; +function MailAreaHasFocus() +{ + //Input and TextAreas should get access to the keys that cause these commands. + //Currently if we don't do this then we will steal the key away and you can't type them + //in these controls. This is a bug that should be fixed and when it is we can get rid of + //this. + var focusedElement = top.document.commandDispatcher.focusedElement; + if(focusedElement) + { + var name = focusedElement.localName; + return ((name != "INPUT") && (name != "TEXTAREA")); + } + return true; +} + +function GetNumSelectedMessages() +{ + var threadTree = GetThreadTree(); + var numSelected = 0; + if ( threadTree && threadTree.selectedItems ) + numSelected = threadTree.selectedItems.length; + return numSelected; +} function CommandUpdate_Mail() { @@ -449,11 +499,6 @@ function CommandUpdate_Mail() }*/ goUpdateCommand('cmd_delete'); - goUpdateCommand('button_delete'); - goUpdateCommand('button_reply'); - goUpdateCommand('button_replyall'); - goUpdateCommand('button_forward'); - goUpdateCommand('cmd_shiftDelete'); goUpdateCommand('cmd_nextMsg'); goUpdateCommand('cmd_nextUnreadMsg'); goUpdateCommand('cmd_nextUnreadThread'); @@ -461,27 +506,45 @@ function CommandUpdate_Mail() goUpdateCommand('cmd_previousMsg'); goUpdateCommand('cmd_previousUnreadMsg'); goUpdateCommand('cmd_previousFlaggedMsg'); - goUpdateCommand('cmd_sortBySubject'); - goUpdateCommand('cmd_sortByDate'); - goUpdateCommand('cmd_sortByFlag'); - goUpdateCommand('cmd_sortByPriority'); - goUpdateCommand('cmd_sortBySender'); - goUpdateCommand('cmd_sortBySize'); - goUpdateCommand('cmd_sortByStatus'); - goUpdateCommand('cmd_sortByRead'); - goUpdateCommand('cmd_sortByOrderReceived'); goUpdateCommand('cmd_sortByThread'); goUpdateCommand('cmd_viewAllMsgs'); goUpdateCommand('cmd_viewUnreadMsgs'); goUpdateCommand('cmd_expandAllThreads'); goUpdateCommand('cmd_collapseAllThreads'); goUpdateCommand('cmd_renameFolder'); + goUpdateCommand('cmd_getNewMessages'); + goUpdateCommand('cmd_find'); + goUpdateCommand('cmd_findAgain'); + goUpdateCommand('cmd_markAllRead'); + goUpdateCommand('cmd_emptyTrash'); + goUpdateCommand('cmd_compactFolder'); +} + +function ThreadTreeUpdate_Mail(command) +{ + goUpdateCommand('button_delete'); + goUpdateCommand('button_reply'); + goUpdateCommand('button_replyall'); + goUpdateCommand('button_forward'); + goUpdateCommand('cmd_shiftDelete'); + goUpdateCommand('cmd_reply'); + goUpdateCommand('cmd_replySender'); + goUpdateCommand('cmd_replyGroup'); + goUpdateCommand('cmd_replyall'); + goUpdateCommand('cmd_forward'); + goUpdateCommand('cmd_forwardInline'); + goUpdateCommand('cmd_forwardAttachment'); + goUpdateCommand('cmd_editAsNew'); goUpdateCommand('cmd_openMessage'); goUpdateCommand('cmd_print'); goUpdateCommand('cmd_saveAsFile'); goUpdateCommand('cmd_saveAsTemplate'); goUpdateCommand('cmd_viewPageSource'); goUpdateCommand('cmd_reload'); + goUpdateCommand('cmd_markAsRead'); + goUpdateCommand('cmd_markThreadAsRead'); + goUpdateCommand('cmd_markAsFlagged'); + goUpdateCommand('cmd_file'); } function SetupUndoRedoCommand(command) @@ -599,6 +662,32 @@ function IsRenameFolderEnabled() return false; } + +function IsViewNavigationItemEnabled() +{ + return IsFolderSelected(); +} + +function IsFolderSelected() +{ + var tree = GetFolderTree(); + var folderList = tree.selectedItems; + + if(folderList.length == 1) + { + var folderNode = folderList[0]; + return(folderNode.getAttribute("IsServer") != "true"); + } + else + return false; +} + +function IsFindEnabled() +{ + return (!IsThreadAndMessagePaneSplitterCollapsed() && (gCurrentDisplayedMessage != null)); + +} + function MsgDeleteFolder() { //get the selected elements diff --git a/mailnews/base/resources/content/mail3PaneWindowVertLayout.xul b/mailnews/base/resources/content/mail3PaneWindowVertLayout.xul index d35bdb7369c4..7e23226cc7a1 100644 --- a/mailnews/base/resources/content/mail3PaneWindowVertLayout.xul +++ b/mailnews/base/resources/content/mail3PaneWindowVertLayout.xul @@ -68,7 +68,10 @@ Rights Reserved. commandupdater="true" events="focus,tree-select" oncommandupdate="CommandUpdate_Mail()"/> - + diff --git a/mailnews/base/resources/content/mailABOverlay.xul b/mailnews/base/resources/content/mailABOverlay.xul index 3a485b800068..dd63e02d7449 100644 --- a/mailnews/base/resources/content/mailABOverlay.xul +++ b/mailnews/base/resources/content/mailABOverlay.xul @@ -8,7 +8,7 @@ - + diff --git a/mailnews/base/resources/content/mailEditorOverlay.xul b/mailnews/base/resources/content/mailEditorOverlay.xul index 1db8177b3dc5..cae6f771b8f3 100644 --- a/mailnews/base/resources/content/mailEditorOverlay.xul +++ b/mailnews/base/resources/content/mailEditorOverlay.xul @@ -31,7 +31,7 @@ - + @@ -39,5 +39,6 @@ + diff --git a/mailnews/base/resources/content/mailMessengerComposeOverlay.xul b/mailnews/base/resources/content/mailMessengerComposeOverlay.xul index 254fa1f4c469..c50584d522f8 100644 --- a/mailnews/base/resources/content/mailMessengerComposeOverlay.xul +++ b/mailnews/base/resources/content/mailMessengerComposeOverlay.xul @@ -8,7 +8,7 @@ - + diff --git a/mailnews/base/resources/content/mailMessengerOverlay.xul b/mailnews/base/resources/content/mailMessengerOverlay.xul index 437692917c3f..ea1885a87ba3 100644 --- a/mailnews/base/resources/content/mailMessengerOverlay.xul +++ b/mailnews/base/resources/content/mailMessengerOverlay.xul @@ -3,12 +3,12 @@ - - + diff --git a/mailnews/base/resources/content/mailNavigatorOverlay.xul b/mailnews/base/resources/content/mailNavigatorOverlay.xul index f4757d71922f..866b0e77631d 100644 --- a/mailnews/base/resources/content/mailNavigatorOverlay.xul +++ b/mailnews/base/resources/content/mailNavigatorOverlay.xul @@ -41,7 +41,7 @@ - + diff --git a/mailnews/base/resources/content/mailOverlay.xul b/mailnews/base/resources/content/mailOverlay.xul index 4c4090a5bd02..ae5ced0be813 100644 --- a/mailnews/base/resources/content/mailOverlay.xul +++ b/mailnews/base/resources/content/mailOverlay.xul @@ -44,5 +44,9 @@ - + + + + + diff --git a/mailnews/base/resources/content/mailWindow.js b/mailnews/base/resources/content/mailWindow.js index 838e560c2a4d..4c085d9f5150 100644 --- a/mailnews/base/resources/content/mailWindow.js +++ b/mailnews/base/resources/content/mailWindow.js @@ -315,3 +315,23 @@ function StopUrls() { msgWindow.StopUrls(); } + +function loadStartPage() { + try { + startpageenabled= pref.GetBoolPref("mailnews.start_page.enabled"); + + if (startpageenabled) { + startpage = pref.CopyCharPref("mailnews.start_page.url"); + if (startpage != "") { + window.frames["messagepane"].location = startpage; + dump("start message pane with: " + startpage + "\n"); + ClearMessageSelection(); + } + } + } + catch (ex) { + dump("Error loading start page.\n"); + return; + } +} + diff --git a/mailnews/base/resources/content/mailWindowOverlay.js b/mailnews/base/resources/content/mailWindowOverlay.js index 575f62b69a66..2cb6e34ede63 100644 --- a/mailnews/base/resources/content/mailWindowOverlay.js +++ b/mailnews/base/resources/content/mailWindowOverlay.js @@ -52,12 +52,11 @@ function InitViewMessagesMenu() function InitMessageMenu() { - var messages = GetSelectedMessages(); - var numMessages = messages.length; + var aMessage = GetSelectedMessage(0); var isNews = false; - if(numMessages > 0) + if(aMessage) { - isNews = GetMessageType(messages[0]) == "news"; + isNews = GetMessageType(aMessage) == "news"; } //We show reply to Newsgroups only for news messages. @@ -78,6 +77,15 @@ function InitMessageMenu() replySenderMenuItem.setAttribute("hidden", isNews ? "" : "true"); } + //disable the move and copy menus only if there are no messages selected. + var moveMenu = document.getElementById("moveMenu"); + if(moveMenu) + moveMenu.setAttribute("disabled", !aMessage); + + var copyMenu = document.getElementById("copyMenu"); + if(copyMenu) + copyMenu.setAttribute("disabled", !aMessage); + } function GetMessageType(message) @@ -100,60 +108,62 @@ function InitMessageMarkMenu() function InitMarkReadMenuItem() { - var messages = GetSelectedMessages(); - var numMessages = messages.length; - var compositeDS = GetCompositeDataSource("MarkMessageRead"); - var property = RDF.GetResource('http://home.netscape.com/NC-rdf#IsUnread'); - - var areMessagesRead; - - if(numMessages == 0) - areMessagesRead = false; - else - { - areMessagesRead = true; - for(var i = 0; i < numMessages; i++) - { - var result = compositeDS.GetTarget(messages[i], property, true); - result = result.QueryInterface(Components.interfaces.nsIRDFLiteral); - if(result.Value == "true") - { - areMessagesRead = false; - break; - } - } - } + areMessagesRead = SelectedMessagesAreRead(); var markReadMenuItem = document.getElementById("markReadMenuItem"); if(markReadMenuItem) markReadMenuItem.setAttribute("checked", areMessagesRead); } +function SelectedMessagesAreRead() +{ + var aMessage = GetSelectedMessage(0); + + var compositeDS = GetCompositeDataSource("MarkMessageRead"); + var property = RDF.GetResource('http://home.netscape.com/NC-rdf#IsUnread'); + + var areMessagesRead =false; + + if(!aMessage) + areMessagesRead = false; + else + { + var result = compositeDS.GetTarget(aMessage, property, true); + result = result.QueryInterface(Components.interfaces.nsIRDFLiteral); + areMessagesRead = result.Value != "true" + } + + return areMessagesRead; +} + function InitMarkFlaggedMenuItem() { - var messages = GetSelectedMessages(); - var numMessages = messages.length; + areMessagesFlagged = SelectedMessagesAreFlagged(); + + var markFlaggedMenuItem = document.getElementById("markFlaggedMenuItem"); + if(markFlaggedMenuItem) + markFlaggedMenuItem.setAttribute("checked", areMessagesFlagged); +} + +function SelectedMessagesAreFlagged() +{ + var aMessage = GetSelectedMessage(0); var compositeDS = GetCompositeDataSource("MarkMessageFlagged"); var property = RDF.GetResource('http://home.netscape.com/NC-rdf#Flagged'); var areMessagesFlagged = false; - for(var i = 0; i < numMessages; i++) + if(!aMessage) + areMessagesFlagged = false; + else { - var result = compositeDS.GetTarget(messages[i], property, true); + var result = compositeDS.GetTarget(aMessage, property, true); result = result.QueryInterface(Components.interfaces.nsIRDFLiteral); - if(result.Value == "flagged") - { - areMessagesFlagged = true; - break; - } + areMessagesFlagged = (result.Value == "flagged"); } - - var markFlaggedMenuItem = document.getElementById("markFlaggedMenuItem"); - if(markFlaggedMenuItem) - markFlaggedMenuItem.setAttribute("checked", areMessagesFlagged); + return areMessagesFlagged; } function GetFirstSelectedMsgFolder() @@ -454,6 +464,10 @@ function CloseMailWindow() function MsgMarkMsgAsRead(markRead) { + if(markRead == null) + { + markRead= !SelectedMessagesAreRead(); + } var selectedMessages = GetSelectedMessages(); var compositeDataSource = GetCompositeDataSource("MarkMessageRead"); @@ -462,6 +476,11 @@ function MsgMarkMsgAsRead(markRead) function MsgMarkAsFlagged(markFlagged) { + if(markFlagged == null) + { + markFlagged= !SelectedMessagesAreFlagged(); + } + var selectedMessages = GetSelectedMessages(); var compositeDataSource = GetCompositeDataSource("MarkMessageFlagged"); @@ -582,6 +601,57 @@ function PrintEnginePrint() return true; } +function IsMailFolderSelected() +{ + var selectedFolders = GetSelectedMsgFolders(); + var numFolders = selectedFolders.length; + if(numFolders !=1) + return false; + + var folder = selectedFolders[0]; + if (!folder) + return false; + + var server = folder.server; + var serverType = server.type; + + if((serverType == "nntp")) + return false; + else return true; +} + +function IsGetNewMessagesEnabled() +{ + var selectedFolders = GetSelectedMsgFolders(); + var numFolders = selectedFolders.length; + if(numFolders !=1) + return false; + + var folder = selectedFolders[0]; + if (!folder) + return false; + + var server = folder.server; + var isServer = folder.isServer; + var serverType = server.type; + + if(isServer && (serverType == "nntp")) + return false; + else if(serverType == "none") + return false; + else + return true; +} + +function IsEmptyTrashEnabled() +{ + return IsMailFolderSelected(); +} + +function IsCompactFolderEnabled() +{ + return IsMailFolderSelected(); +} function MsgMarkByDate() {} function MsgOpenAttachment() {} diff --git a/mailnews/base/resources/content/mailWindowOverlay.xul b/mailnews/base/resources/content/mailWindowOverlay.xul index 97af76b61ac2..7614d0d4990d 100644 --- a/mailnews/base/resources/content/mailWindowOverlay.xul +++ b/mailnews/base/resources/content/mailWindowOverlay.xul @@ -73,23 +73,18 @@ Rights Reserved. - - - - - - - - - - + + + + + @@ -104,6 +99,16 @@ Rights Reserved. + + + + + + + + + + @@ -123,10 +128,12 @@ Rights Reserved. - - + + + + - + @@ -135,6 +142,9 @@ Rights Reserved. + + + @@ -560,7 +570,8 @@ Rights Reserved. + key="key_getNewMessages" + observes="cmd_getNewMessages"/> @@ -571,11 +582,11 @@ Rights Reserved. - - - + observes="cmd_emptyTrash"/> + + @@ -624,17 +635,17 @@ Rights Reserved. accesskey="&showMessageCmd.accesskey;" oncommand="MsgToggleMessagePane();"/> - + - - - - - - - - - + + + + + + + + + @@ -682,8 +693,8 @@ Rights Reserved. - - + + @@ -721,29 +732,29 @@ Rights Reserved. + observes="cmd_reply"/> + observes="cmd_replySender"/> + observes="cmd_replyGroup"/> + observes="cmd_replyall"/> + observes="cmd_forward"/> - - + + - + @@ -847,11 +858,11 @@ Rights Reserved. - - - + + + - + @@ -865,15 +876,15 @@ Rights Reserved. - -