зеркало из https://github.com/mozilla/gecko-dev.git
Add a search preference panel
This commit is contained in:
Родитель
88d9f13d73
Коммит
98da51e126
|
@ -0,0 +1,94 @@
|
|||
/*
|
||||
* The contents of this file are subject to the Netscape Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is Mozilla Communicator client code, released
|
||||
* March 31, 1998.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998-1999 Netscape Communications Corporation. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Contributor(s): Robert John Churchill (rjc@netscape.com)
|
||||
*/
|
||||
|
||||
var pref = null;
|
||||
try
|
||||
{
|
||||
pref = Components.classes["component://netscape/preferences"];
|
||||
if (pref) pref = pref.getService();
|
||||
if (pref) pref = pref.QueryInterface(Components.interfaces.nsIPref);
|
||||
}
|
||||
catch(ex)
|
||||
{
|
||||
dump("failed to get prefs service!\n");
|
||||
pref = null;
|
||||
}
|
||||
|
||||
|
||||
|
||||
function InitSingleEngineList()
|
||||
{
|
||||
dump("InitSingleEngineList called.\n");
|
||||
|
||||
var defaultEngineURI = null;
|
||||
try
|
||||
{
|
||||
if (pref)
|
||||
{
|
||||
var defaultEngineURI = pref.CopyCharPref("browser.search.defaultengine");
|
||||
}
|
||||
}
|
||||
catch(ex)
|
||||
{
|
||||
defaultEngineURI = null;
|
||||
}
|
||||
|
||||
if ((!defaultEngineURI) || (defaultEngineURI == "")) return;
|
||||
|
||||
var engineList = document.getElementById("engineList");
|
||||
if (!engineList) return;
|
||||
var numEngines = engineList.length;
|
||||
if (numEngines < 1) return;
|
||||
|
||||
for (var x=0; x<numEngines; x++)
|
||||
{
|
||||
var engineNode = engineList.childNodes[x];
|
||||
if (!engineNode) continue;
|
||||
var uri = engineNode.getAttribute("id");
|
||||
if (!uri) continue;
|
||||
if (uri != defaultEngineURI) continue;
|
||||
|
||||
engineList.selectedIndex = x;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
function setDefaultSearchEngine(object)
|
||||
{
|
||||
var defaultEngineURI = object.options[object.selectedIndex].getAttribute("id");
|
||||
dump("Default Engine: " + defaultEngineURI + "\n");
|
||||
|
||||
try
|
||||
{
|
||||
if (pref)
|
||||
{
|
||||
pref.SetCharPref("browser.search.defaultengine", defaultEngineURI);
|
||||
}
|
||||
}
|
||||
catch (ex)
|
||||
{
|
||||
dump("failed to set 'browser.search.defaultengine' pref\n");
|
||||
}
|
||||
return(true);
|
||||
}
|
|
@ -0,0 +1,79 @@
|
|||
<?xml version="1.0"?>
|
||||
<!--
|
||||
The contents of this file are subject to the Netscape Public
|
||||
License Version 1.1 (the "License"); you may not use this file
|
||||
except in compliance with the License. You may obtain a copy of
|
||||
the License at http://www.mozilla.org/NPL/
|
||||
|
||||
Software distributed under the License is distributed on an "AS
|
||||
IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
implied. See the License for the specific language governing
|
||||
rights and limitations under the License.
|
||||
|
||||
The Original Code is Mozilla Communicator client code, released
|
||||
March 31, 1998.
|
||||
|
||||
The Initial Developer of the Original Code is Netscape
|
||||
Communications Corporation. Portions created by Netscape are
|
||||
Copyright (C) 1998-1999 Netscape Communications Corporation. All
|
||||
Rights Reserved.
|
||||
|
||||
Contributor(s): Robert John Churchill (rjc@netscape.com)
|
||||
-->
|
||||
|
||||
<?xml-stylesheet href="chrome://pref/skin/" type="text/css"?>
|
||||
|
||||
<!DOCTYPE window SYSTEM "chrome://pref/locale/pref-search.dtd" >
|
||||
<window xmlns:html="http://www.w3.org/TR/REC-html40"
|
||||
class="dialog"
|
||||
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
|
||||
onload="InitSingleEngineList(); return StartUp('search');" title="&title.label;"
|
||||
align="vertical">
|
||||
|
||||
<html:script language="javascript" src="chrome://pref/content/PrefsWindow.js"/>
|
||||
<html:script language="javascript" src="chrome://pref/content/pref-search.js"/>
|
||||
|
||||
<box class="header" align="horizontal">
|
||||
<titledbutton class="left-header-text" value="&lHeader;"/>
|
||||
<spring class="header-spring" flex="1"/>
|
||||
<titledbutton class="right-header-text" value="&rHeader;"/>
|
||||
</box>
|
||||
|
||||
|
||||
<box align="vertical">
|
||||
<html:fieldset flex="1">
|
||||
<html:legend align="left">
|
||||
<html:div>&legendHeader;</html:div>
|
||||
</html:legend>
|
||||
|
||||
<html:div>
|
||||
<html:input name="fonts" type="radio" id="pref:0:int:browser.search.powermode" val="checked" />
|
||||
<html:label for="pref:0:int:browser.search.powermode" accesskey="t" tabindex="0">
|
||||
&browserSearchButtonText.label;
|
||||
</html:label>
|
||||
|
||||
<html:select id="engineList" ref="NC:SearchEngineRoot"
|
||||
datasources="rdf:internetsearch"
|
||||
sortResource="http://home.netscape.com/NC-rdf#Name" sortDirection="ascending"
|
||||
onchange="return setDefaultSearchEngine(this)" >
|
||||
|
||||
<template>
|
||||
<html:option uri="..." value="..." >
|
||||
<text value="rdf:http://home.netscape.com/NC-rdf#Name" />
|
||||
</html:option>
|
||||
</template>
|
||||
|
||||
</html:select>
|
||||
|
||||
</html:div>
|
||||
|
||||
<html:div>
|
||||
<html:input name="fonts" type="radio" id="pref:1:int:browser.search.powermode" val="checked" />
|
||||
<html:label for="pref:1:int:browser.search.powermode" accesskey="t" tabindex="0">
|
||||
&enablePowerSearch.label;
|
||||
</html:label>
|
||||
</html:div>
|
||||
|
||||
</html:fieldset>
|
||||
</box>
|
||||
</window>
|
|
@ -117,6 +117,12 @@
|
|||
</treerow>
|
||||
</treeitem>
|
||||
|
||||
<treeitem open="true">
|
||||
<treerow>
|
||||
<treecell indent="true" name="chrome://pref/content/pref-search.xul" value="&search.label;"/>
|
||||
</treerow>
|
||||
</treeitem>
|
||||
|
||||
<treeitem open="true">
|
||||
<treerow>
|
||||
<treecell indent="true" name="chrome://pref/content/pref-smart_browsing.xul" value="&smartBrowse.label;"/>
|
||||
|
|
|
@ -0,0 +1,12 @@
|
|||
<!-- extracted from content/pref-search.xul -->
|
||||
|
||||
<!--LOCALIZATION NOTE : FILE The Search prefs dialog -->
|
||||
<!--LOCALIZATION NOTE (title.label): DONT_TRANSLATE -->
|
||||
<!ENTITY title.label "Search">
|
||||
|
||||
<!--LOCALIZATION NOTE (lHeader): Translate "Search" according to Netscape glossary -->
|
||||
<!ENTITY lHeader "Search">
|
||||
<!ENTITY rHeader "Configure Search">
|
||||
<!ENTITY legendHeader "When clicking the 'Search' button:">
|
||||
<!ENTITY browserSearchButtonText.label "use a single search engine:">
|
||||
<!ENTITY enablePowerSearch.label "open the Smart Search window">
|
|
@ -9,6 +9,7 @@
|
|||
<!ENTITY navigator.label "Navigator">
|
||||
<!ENTITY languages.label "Languages">
|
||||
<!ENTITY applications.label "Applications">
|
||||
<!ENTITY search.label "Search">
|
||||
<!--LOCALIZATION NOTE (smartBrowse.label): DONT_TRANSLATE -->
|
||||
<!ENTITY smartBrowse.label "Smart Browsing">
|
||||
<!ENTITY mail.label "Mail and Newsgroups">
|
||||
|
|
|
@ -14,6 +14,8 @@ pref-offline.xul
|
|||
pref-proxies.xul
|
||||
pref-proxy-manual.xul
|
||||
pref-publish.xul
|
||||
pref-search.js
|
||||
pref-search.xul
|
||||
pref-smart_browsing.xul
|
||||
pref-smartupdate.xul
|
||||
PrefsWindow.js
|
||||
|
|
|
@ -46,6 +46,8 @@ EXPORT_RESOURCE_CONTENT = \
|
|||
$(srcdir)/pref-proxy-manual.xul \
|
||||
$(srcdir)/pref-publish.xul \
|
||||
$(srcdir)/pref-mousewheel.xul \
|
||||
$(srcdir)/pref-search.js \
|
||||
$(srcdir)/pref-search.xul \
|
||||
$(srcdir)/pref-smart_browsing.xul \
|
||||
$(srcdir)/pref-smartupdate.xul \
|
||||
$(srcdir)/fontScalingOverlay.xul \
|
||||
|
|
|
@ -40,6 +40,8 @@ install::
|
|||
$(MAKE_INSTALL) pref-proxies.xul $(DIST)\bin\chrome\pref\content\default
|
||||
$(MAKE_INSTALL) pref-proxy-manual.xul $(DIST)\bin\chrome\pref\content\default
|
||||
$(MAKE_INSTALL) pref-publish.xul $(DIST)\bin\chrome\pref\content\default
|
||||
$(MAKE_INSTALL) pref-search.js $(DIST)\bin\chrome\pref\content\default
|
||||
$(MAKE_INSTALL) pref-search.xul $(DIST)\bin\chrome\pref\content\default
|
||||
$(MAKE_INSTALL) pref-smart_browsing.xul $(DIST)\bin\chrome\pref\content\default
|
||||
$(MAKE_INSTALL) pref-smartupdate.xul $(DIST)\bin\chrome\pref\content\default
|
||||
$(MAKE_INSTALL) PrefsWindow.js $(DIST)\bin\chrome\pref\content\default
|
||||
|
|
|
@ -0,0 +1,94 @@
|
|||
/*
|
||||
* The contents of this file are subject to the Netscape Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is Mozilla Communicator client code, released
|
||||
* March 31, 1998.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998-1999 Netscape Communications Corporation. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Contributor(s): Robert John Churchill (rjc@netscape.com)
|
||||
*/
|
||||
|
||||
var pref = null;
|
||||
try
|
||||
{
|
||||
pref = Components.classes["component://netscape/preferences"];
|
||||
if (pref) pref = pref.getService();
|
||||
if (pref) pref = pref.QueryInterface(Components.interfaces.nsIPref);
|
||||
}
|
||||
catch(ex)
|
||||
{
|
||||
dump("failed to get prefs service!\n");
|
||||
pref = null;
|
||||
}
|
||||
|
||||
|
||||
|
||||
function InitSingleEngineList()
|
||||
{
|
||||
dump("InitSingleEngineList called.\n");
|
||||
|
||||
var defaultEngineURI = null;
|
||||
try
|
||||
{
|
||||
if (pref)
|
||||
{
|
||||
var defaultEngineURI = pref.CopyCharPref("browser.search.defaultengine");
|
||||
}
|
||||
}
|
||||
catch(ex)
|
||||
{
|
||||
defaultEngineURI = null;
|
||||
}
|
||||
|
||||
if ((!defaultEngineURI) || (defaultEngineURI == "")) return;
|
||||
|
||||
var engineList = document.getElementById("engineList");
|
||||
if (!engineList) return;
|
||||
var numEngines = engineList.length;
|
||||
if (numEngines < 1) return;
|
||||
|
||||
for (var x=0; x<numEngines; x++)
|
||||
{
|
||||
var engineNode = engineList.childNodes[x];
|
||||
if (!engineNode) continue;
|
||||
var uri = engineNode.getAttribute("id");
|
||||
if (!uri) continue;
|
||||
if (uri != defaultEngineURI) continue;
|
||||
|
||||
engineList.selectedIndex = x;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
function setDefaultSearchEngine(object)
|
||||
{
|
||||
var defaultEngineURI = object.options[object.selectedIndex].getAttribute("id");
|
||||
dump("Default Engine: " + defaultEngineURI + "\n");
|
||||
|
||||
try
|
||||
{
|
||||
if (pref)
|
||||
{
|
||||
pref.SetCharPref("browser.search.defaultengine", defaultEngineURI);
|
||||
}
|
||||
}
|
||||
catch (ex)
|
||||
{
|
||||
dump("failed to set 'browser.search.defaultengine' pref\n");
|
||||
}
|
||||
return(true);
|
||||
}
|
|
@ -0,0 +1,79 @@
|
|||
<?xml version="1.0"?>
|
||||
<!--
|
||||
The contents of this file are subject to the Netscape Public
|
||||
License Version 1.1 (the "License"); you may not use this file
|
||||
except in compliance with the License. You may obtain a copy of
|
||||
the License at http://www.mozilla.org/NPL/
|
||||
|
||||
Software distributed under the License is distributed on an "AS
|
||||
IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
implied. See the License for the specific language governing
|
||||
rights and limitations under the License.
|
||||
|
||||
The Original Code is Mozilla Communicator client code, released
|
||||
March 31, 1998.
|
||||
|
||||
The Initial Developer of the Original Code is Netscape
|
||||
Communications Corporation. Portions created by Netscape are
|
||||
Copyright (C) 1998-1999 Netscape Communications Corporation. All
|
||||
Rights Reserved.
|
||||
|
||||
Contributor(s): Robert John Churchill (rjc@netscape.com)
|
||||
-->
|
||||
|
||||
<?xml-stylesheet href="chrome://pref/skin/" type="text/css"?>
|
||||
|
||||
<!DOCTYPE window SYSTEM "chrome://pref/locale/pref-search.dtd" >
|
||||
<window xmlns:html="http://www.w3.org/TR/REC-html40"
|
||||
class="dialog"
|
||||
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
|
||||
onload="InitSingleEngineList(); return StartUp('search');" title="&title.label;"
|
||||
align="vertical">
|
||||
|
||||
<html:script language="javascript" src="chrome://pref/content/PrefsWindow.js"/>
|
||||
<html:script language="javascript" src="chrome://pref/content/pref-search.js"/>
|
||||
|
||||
<box class="header" align="horizontal">
|
||||
<titledbutton class="left-header-text" value="&lHeader;"/>
|
||||
<spring class="header-spring" flex="1"/>
|
||||
<titledbutton class="right-header-text" value="&rHeader;"/>
|
||||
</box>
|
||||
|
||||
|
||||
<box align="vertical">
|
||||
<html:fieldset flex="1">
|
||||
<html:legend align="left">
|
||||
<html:div>&legendHeader;</html:div>
|
||||
</html:legend>
|
||||
|
||||
<html:div>
|
||||
<html:input name="fonts" type="radio" id="pref:0:int:browser.search.powermode" val="checked" />
|
||||
<html:label for="pref:0:int:browser.search.powermode" accesskey="t" tabindex="0">
|
||||
&browserSearchButtonText.label;
|
||||
</html:label>
|
||||
|
||||
<html:select id="engineList" ref="NC:SearchEngineRoot"
|
||||
datasources="rdf:internetsearch"
|
||||
sortResource="http://home.netscape.com/NC-rdf#Name" sortDirection="ascending"
|
||||
onchange="return setDefaultSearchEngine(this)" >
|
||||
|
||||
<template>
|
||||
<html:option uri="..." value="..." >
|
||||
<text value="rdf:http://home.netscape.com/NC-rdf#Name" />
|
||||
</html:option>
|
||||
</template>
|
||||
|
||||
</html:select>
|
||||
|
||||
</html:div>
|
||||
|
||||
<html:div>
|
||||
<html:input name="fonts" type="radio" id="pref:1:int:browser.search.powermode" val="checked" />
|
||||
<html:label for="pref:1:int:browser.search.powermode" accesskey="t" tabindex="0">
|
||||
&enablePowerSearch.label;
|
||||
</html:label>
|
||||
</html:div>
|
||||
|
||||
</html:fieldset>
|
||||
</box>
|
||||
</window>
|
|
@ -117,6 +117,12 @@
|
|||
</treerow>
|
||||
</treeitem>
|
||||
|
||||
<treeitem open="true">
|
||||
<treerow>
|
||||
<treecell indent="true" name="chrome://pref/content/pref-search.xul" value="&search.label;"/>
|
||||
</treerow>
|
||||
</treeitem>
|
||||
|
||||
<treeitem open="true">
|
||||
<treerow>
|
||||
<treecell indent="true" name="chrome://pref/content/pref-smart_browsing.xul" value="&smartBrowse.label;"/>
|
||||
|
|
|
@ -14,6 +14,7 @@ pref-offline.dtd
|
|||
pref-proxies.dtd
|
||||
pref-proxy-manual.dtd
|
||||
pref-publish.dtd
|
||||
pref-search.dtd
|
||||
pref-smart_browsing.dtd
|
||||
pref-smartupdate.dtd
|
||||
PrefsWindow.dtd
|
||||
|
|
|
@ -44,6 +44,7 @@ EXPORT_RESOURCE_CONTENT = \
|
|||
$(srcdir)/pref-proxies.dtd \
|
||||
$(srcdir)/pref-proxy-manual.dtd \
|
||||
$(srcdir)/pref-publish.dtd \
|
||||
$(srcdir)/pref-search.dtd \
|
||||
$(srcdir)/pref-smart_browsing.dtd \
|
||||
$(srcdir)/pref-smartupdate.dtd \
|
||||
$(srcdir)/pref-mousewheel.dtd \
|
||||
|
|
|
@ -40,6 +40,7 @@ install::
|
|||
$(MAKE_INSTALL) pref-proxies.dtd $(DIST)\bin\chrome\pref\locale\en-US
|
||||
$(MAKE_INSTALL) pref-proxy-manual.dtd $(DIST)\bin\chrome\pref\locale\en-US
|
||||
$(MAKE_INSTALL) pref-publish.dtd $(DIST)\bin\chrome\pref\locale\en-US
|
||||
$(MAKE_INSTALL) pref-search.dtd $(DIST)\bin\chrome\pref\locale\en-US
|
||||
$(MAKE_INSTALL) pref-smart_browsing.dtd $(DIST)\bin\chrome\pref\locale\en-US
|
||||
$(MAKE_INSTALL) pref-smartupdate.dtd $(DIST)\bin\chrome\pref\locale\en-US
|
||||
$(MAKE_INSTALL) PrefsWindow.dtd $(DIST)\bin\chrome\pref\locale\en-US
|
||||
|
|
|
@ -0,0 +1,12 @@
|
|||
<!-- extracted from content/pref-search.xul -->
|
||||
|
||||
<!--LOCALIZATION NOTE : FILE The Search prefs dialog -->
|
||||
<!--LOCALIZATION NOTE (title.label): DONT_TRANSLATE -->
|
||||
<!ENTITY title.label "Search">
|
||||
|
||||
<!--LOCALIZATION NOTE (lHeader): Translate "Search" according to Netscape glossary -->
|
||||
<!ENTITY lHeader "Search">
|
||||
<!ENTITY rHeader "Configure Search">
|
||||
<!ENTITY legendHeader "When clicking the 'Search' button:">
|
||||
<!ENTITY browserSearchButtonText.label "use a single search engine:">
|
||||
<!ENTITY enablePowerSearch.label "open the Smart Search window">
|
|
@ -9,6 +9,7 @@
|
|||
<!ENTITY navigator.label "Navigator">
|
||||
<!ENTITY languages.label "Languages">
|
||||
<!ENTITY applications.label "Applications">
|
||||
<!ENTITY search.label "Search">
|
||||
<!--LOCALIZATION NOTE (smartBrowse.label): DONT_TRANSLATE -->
|
||||
<!ENTITY smartBrowse.label "Smart Browsing">
|
||||
<!ENTITY mail.label "Mail and Newsgroups">
|
||||
|
|
Загрузка…
Ссылка в новой задаче