From dc68e1d0a6e7b2d7267f06c1b45c7c4a595e0a26 Mon Sep 17 00:00:00 2001 From: "scott%scott-macgregor.org" Date: Mon, 15 Mar 2004 19:41:14 +0000 Subject: [PATCH] Bug #145798 --> Create Filter from Message is not doable when message pane is closed. Porting to thunderbird patch by mcow --- mail/base/content/mail3PaneWindowCommands.js | 17 +++++++---------- mail/base/content/mailWindowOverlay.js | 20 +++++++------------- 2 files changed, 14 insertions(+), 23 deletions(-) diff --git a/mail/base/content/mail3PaneWindowCommands.js b/mail/base/content/mail3PaneWindowCommands.js index 319bf038ee2..43817624da5 100644 --- a/mail/base/content/mail3PaneWindowCommands.js +++ b/mail/base/content/mail3PaneWindowCommands.js @@ -259,17 +259,14 @@ var DefaultController = gDBView.getCommandStatus(nsMsgViewCommandType.toggleThreadWatched, enabled, checkStatus); return enabled.value; case "cmd_createFilterFromPopup": + case "cmd_createFilterFromMenu": var loadedFolder = GetLoadedMsgFolder(); if (!(loadedFolder && loadedFolder.server.canHaveFilters)) - return false; - case "cmd_createFilterFromMenu": - loadedFolder = GetLoadedMsgFolder(); - if (!(loadedFolder && loadedFolder.server.canHaveFilters) || !(IsMessageDisplayedInMessagePane())) - return false; + return false; // else fall thru case "cmd_saveAsFile": case "cmd_saveAsTemplate": - if ( GetNumSelectedMessages() > 1) - return false; + if (GetNumSelectedMessages() > 1) + return false; // else fall thru case "cmd_reply": case "button_reply": case "cmd_replySender": @@ -286,12 +283,12 @@ var DefaultController = case "cmd_print": case "cmd_viewPageSource": case "cmd_reload": - if ( GetNumSelectedMessages() > 0) + if (GetNumSelectedMessages() > 0) { if (gDBView) { - gDBView.getCommandStatus(nsMsgViewCommandType.cmdRequiringMsgBody, enabled, checkStatus); - return enabled.value; + gDBView.getCommandStatus(nsMsgViewCommandType.cmdRequiringMsgBody, enabled, checkStatus); + return enabled.value; } } return false; diff --git a/mail/base/content/mailWindowOverlay.js b/mail/base/content/mailWindowOverlay.js index eec08608a8c..2410e0470c5 100644 --- a/mail/base/content/mailWindowOverlay.js +++ b/mail/base/content/mailWindowOverlay.js @@ -1004,22 +1004,16 @@ function MsgEditMessageAsNew() function MsgCreateFilter() { - var emailAddressNode; + // retrieve Sender direct from selected message's headers + var msgHdr = gDBView.hdrForFirstSelectedMessage; + var headerParser = Components.classes["@mozilla.org/messenger/headerparser;1"].getService(Components.interfaces.nsIMsgHeaderParser); + var emailAddress = headerParser.extractHeaderAddressMailboxes(null, msgHdr.author); - if (gCollapsedHeaderViewMode) - emailAddressNode = document.getElementById("collapsedfromValue"); - else - emailAddressNode = document.getElementById("expandedfromBox").emailAddressNode; - - if (emailAddressNode) - { - var emailAddress = emailAddressNode.getTextAttribute("emailAddress"); - if (emailAddress){ - top.MsgFilters(emailAddress); - } - } + if (emailAddress) + top.MsgFilters(emailAddress); } + function MsgHome(url) { window.open(url, "_blank", "chrome,dependent=yes,all");