diff --git a/suite/common/search/internetresults.xul b/suite/common/search/internetresults.xul
index 8452b9253c5..f06082d5179 100644
--- a/suite/common/search/internetresults.xul
+++ b/suite/common/search/internetresults.xul
@@ -142,6 +142,6 @@
-
+
diff --git a/suite/common/search/search-editor.js b/suite/common/search/search-editor.js
index dea17f3a71c..cbb4832e4a5 100644
--- a/suite/common/search/search-editor.js
+++ b/suite/common/search/search-editor.js
@@ -32,6 +32,7 @@ var RDF = null;
var RDFC = null;
var RDFCUtils = null;
var catDS = null;
+var internetSearchDS = null;
try
{
@@ -74,6 +75,8 @@ function doLoad()
if (internetSearch) internetSearch = internetSearch.QueryInterface(Components.interfaces.nsIInternetSearchService);
if (internetSearch)
{
+ internetSearchDS = internetSearch.QueryInterface(Components.interfaces.nsIRDFDataSource);
+
catDS = internetSearch.GetCategoryDataSource();
if (catDS) catDS = catDS.QueryInterface(Components.interfaces.nsIRDFDataSource);
if (catDS)
@@ -279,6 +282,13 @@ function AddEngine()
RDFC.Init(catDS, categoryRes);
+ var urlRes = RDF.GetResource("http://home.netscape.com/NC-rdf#URL");
+ if (!urlRes) return(false);
+ var typeRes = RDF.GetResource("http://home.netscape.com/NC-rdf#searchtype");
+ if (!typeRes) return(false);
+ var engineRes = RDF.GetResource("http://home.netscape.com/NC-rdf#Engine");
+ if (!engineRes) return(false);
+
for (var x = 0; x < select_list.length; x++)
{
var id = select_list[x].getAttribute("id");
@@ -286,6 +296,23 @@ function AddEngine()
var idRes = RDF.GetResource(id);
if (!idRes) return(false);
+ // try and find/use alias to search engine
+ var privateEngineFlag = internetSearchDS.HasAssertion(idRes, typeRes, engineRes, true);
+ if (privateEngineFlag == true)
+ {
+ var node = internetSearchDS.GetTarget(idRes, urlRes, true);
+ if (node) node = node.QueryInterface(Components.interfaces.nsIRDFLiteral);
+ if (node)
+ {
+ if (node.Value)
+ {
+ id = node.Value;
+ idRes = RDF.GetResource(id);
+ if (!idRes) return(false);
+ }
+ }
+ }
+
var nodeIndex = RDFC.IndexOf(idRes);
if (nodeIndex < 1)
{
diff --git a/suite/common/search/shared.js b/suite/common/search/shared.js
index 5907641e808..c237feb8278 100644
--- a/suite/common/search/shared.js
+++ b/suite/common/search/shared.js
@@ -164,11 +164,46 @@ function fillContextMenu(name, treeName)
popupNode.removeChild(popupNode.childNodes[popupNode.childNodes.length - 1]);
}
+ var searchMode = 0;
+ if (pref) searchMode = pref.GetIntPref("browser.search.mode");
+ if (pref && bundle)
+ {
+ // then add a menu separator (if necessary)
+ if (popupNode.childNodes.length > 0)
+ {
+ if (popupNode.childNodes[popupNode.childNodes.length - 1].tagName != "menuseparator")
+ {
+ var menuSep = document.createElement("menuseparator");
+ popupNode.appendChild(menuSep);
+ }
+ }
+ // And then add a "Search Mode" menu item
+ var propMenuName = (searchMode == 0) ? bundle.GetStringFromName("enableAdvanced") : bundle.GetStringFromName("disableAdvanced");
+ var menuItem = document.createElement("menuitem");
+ menuItem.setAttribute("value", propMenuName);
+ popupNode.appendChild(menuItem);
+ // Work around bug # 26402 by setting "oncommand" attribute
+ // AFTER appending menuitem
+ menuItem.setAttribute("oncommand", "return setSearchMode();");
+ }
+
return(true);
}
+function setSearchMode()
+{
+ var searchMode = 0;
+ if (pref) searchMode = pref.GetIntPref("browser.search.mode");
+ if (searchMode == 0) searchMode = 1;
+ else searchMode = 0;
+ if (pref) pref.SetIntPref("browser.search.mode", searchMode);
+ return(true);
+}
+
+
+
function doContextCmd(cmdName, treeName)
{
var treeNode = document.getElementById(treeName);
diff --git a/suite/locales/en-US/chrome/common/search/search-panel.properties b/suite/locales/en-US/chrome/common/search/search-panel.properties
index 9e4c71476e7..b71302255ec 100644
--- a/suite/locales/en-US/chrome/common/search/search-panel.properties
+++ b/suite/locales/en-US/chrome/common/search/search-panel.properties
@@ -1 +1,3 @@
-enterstringandlocation=Enter some text to search for and select at least one location to search.
\ No newline at end of file
+enterstringandlocation=Enter some text to search for and select at least one location to search.
+enableAdvanced=Enable advanced search options
+disableAdvanced=Disabled advanced search options