#44800, fixed our current window handling code for the search window and filterlist dialog to use nsIWindowMediator to fix the problem where choosing "Search Messages" or "Message Filters" twice made the popupmenus go blank.

r=bhuvan, sr=sspitzer
This commit is contained in:
hwaara%chello.se 2001-07-24 23:32:00 +00:00
parent 7e5d62053b
commit 7348fb87b4
4 changed files with 39 additions and 3 deletions

View File

@ -27,6 +27,7 @@ var gPromptService;
var gOfflinePromptsBundle;
var nsPrefBranch = null;
var gOfflineManager;
var gWindowManagerInterface;
// Disable the new account menu item if the account preference is locked.
// Two other affected areas are the account central and the account manager
@ -319,6 +320,15 @@ function GetFirstSelectedMsgFolder()
return result;
}
function GetWindowMediator()
{
if (gWindowManagerInterface)
return gWindowManagerInterface;
var windowManager = Components.classes['@mozilla.org/rdf/datasource;1?name=window-mediator'].getService();
return (gWindowManagerInterface = windowManager.QueryInterface(Components.interfaces.nsIWindowMediator));
}
function GetInboxFolder(server)
{
try {
@ -894,13 +904,36 @@ function MsgCanFindAgain()
function MsgSearchMessages()
{
var preselectedFolder = GetFirstSelectedMsgFolder();
window.openDialog("chrome://messenger/content/SearchDialog.xul", "SearchMail", "chrome,resizable,centerscreen,dialog=no", { folder: preselectedFolder });
var windowManagerInterface = GetWindowMediator();
var searchWindow = windowManagerInterface.getMostRecentWindow("mailnews:search");
if (searchWindow)
searchWindow.focus();
else
window.openDialog("chrome://messenger/content/SearchDialog.xul", "",
"chrome,resizable,centerscreen,dialog=no", { folder: preselectedFolder });
}
function MsgFilters()
{
var preselectedFolder = GetFirstSelectedMsgFolder();
window.openDialog("chrome://messenger/content/FilterListDialog.xul", "FilterDialog", "chrome,resizable,centerscreen", { folder: preselectedFolder });
var windowManagerInterface = GetWindowMediator();
var filterList = windowManagerInterface.getMostRecentWindow("mailnews:filterlist");
if (filterList)
{
var filterEditor = windowManagerInterface.getMostRecentWindow("mailnews:filtereditor");
// If the filtereditor is open, then we focus that because it is modal and
// thus blocking the filterlist from focusing.
if (filterEditor)
filterEditor.focus();
else
filterList.focus();
}
else
window.openDialog("chrome://messenger/content/FilterListDialog.xul", "",
"chrome,resizable,centerscreen,dialog=yes", { folder: preselectedFolder });
}
function MsgViewAllHeaders()

View File

@ -36,6 +36,7 @@ Contributor(s):
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
title="&window.title;"
orient="vertical"
windowtype="mailnews:filtereditor"
width="510" height="360"
persist="width height screenX screenY"
onload="filterEditorOnLoad('msgFccFolderPicker');">

View File

@ -30,6 +30,7 @@ Contributor(s): H
xmlns:nc="http://home.netscape.com/NC-rdf#"
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
orient="vertical"
windowtype="mailnews:filterlist"
onload="onLoad();"
width="440"
height="320"
@ -74,7 +75,7 @@ Contributor(s): H
<tree id="filterTree" class="inset" flex="1"
onselect="onFilterSelect(event);"
ondblclick="onFilterDoubleClick(event);"
datasources="rdf:msgfilters rdf:msgaccountmanager "
datasources="rdf:msgfilters rdf:msgaccountmanager"
containment="http://home.netscape.com/NC-rdf#child">
<treehead>

View File

@ -35,6 +35,7 @@ Rights Reserved.
onload="searchOnLoad(); SetDatasources()"
onunload="searchOnUnload();"
onclose="onSearchStop();"
windowtype="mailnews:search"
title="&searchDialogTitle.label;"
width="640" height="470"
persist="screenX screenY width height"