Fix bug # 23262: if the internet search window is currently open, give it focus (and select new tab if necessary).

This commit is contained in:
rjc%netscape.com 2000-01-07 09:56:20 +00:00
parent 914ea6291b
commit 08fb22a820
4 changed files with 21 additions and 4 deletions

View File

@ -913,7 +913,20 @@ function OpenSearch(tabName, forceDialogFlag, searchStr)
if ((searchMode == 1) || (forceDialogFlag == true))
{
window.openDialog("chrome://search/content/search.xul", "SearchWindow", "dialog=no,close,chrome,resizable", tabName, searchStr);
// Use a single search dialog
var cwindowManager = Components.classes["component://netscape/rdf/datasource?name=window-mediator"].getService();
var iwindowManager = Components.interfaces.nsIWindowMediator;
var windowManager = cwindowManager.QueryInterface(iwindowManager);
var searchWindow = windowManager.GetMostRecentWindow("search:window");
if (searchWindow)
{
searchWindow.focus();
if (searchWindow.loadPage) searchWindow.loadPage(tabName, searchStr);
}
else
{
window.openDialog("chrome://search/content/search.xul", "SearchWindow", "dialog=no,close,chrome,resizable", tabName, searchStr);
}
}
else
{

View File

@ -16,7 +16,7 @@
<box align="horizontal" style="width: 100%;" >
<spring align="horizontal" flex="100%" />
<titledbutton value="&search.label;" />
<html:div>&search.label;</html:div>
<template id="categoryTemplate">
<rule iscontainer="true">
@ -38,7 +38,7 @@
</html:select>
<titledbutton value="&for.label;" />
<html:div>&for.label;</html:div>
<html:input id="searchtext" size="20" onkeyup="if (event.which == 13) { doSearch(); }" />
<html:button id="searchbutton" onclick="return doSearch();">&search.button.label;</html:button>
<html:button id="stopbutton" onclick="return doStop();" style="display: none;" >&stop.button.label;</html:button>

View File

@ -1,5 +1,6 @@
var gSearchStr = "";
var gTabName = "";
function loadPage(thePage, searchStr)
{
@ -38,6 +39,9 @@ function loadPage(thePage, searchStr)
results="about:blank";
}
if (tabName == gTabName) return(true);
gTabName = tabName;
if ((content != "") && (results != ""))
{
var contentFrame = document.getElementById("content");

View File

@ -4,7 +4,7 @@
<!DOCTYPE window SYSTEM "chrome://search/locale/search.dtd">
<window id="search-window" title="&window.title.label;"
class="dialog"
class="dialog" windowtype="search:window"
width="500" height="400" x="20" y="20" persist="width height x y" align="vertical"
xmlns:html="http://www.w3.org/TR/REC-html40"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"