зеркало из https://github.com/mozilla/pjs.git
*** empty log message ***
This commit is contained in:
Родитель
34a78a2415
Коммит
58b15a0906
|
@ -8,25 +8,19 @@
|
|||
<binding id="urlbar" extends="chrome://global/content/autocomplete.xml#autocomplete">
|
||||
<implementation>
|
||||
<constructor><![CDATA[
|
||||
var pbi = this.mPrefs.QueryInterface(Components.interfaces.nsIPrefBranchInternal);
|
||||
if (pbi)
|
||||
pbi.addObserver("browser.urlbar", this.mPrefObserver, false);
|
||||
this.mPrefs.addObserver("browser.urlbar", this.mPrefObserver);
|
||||
|
||||
this.updatePref("browser.urlbar.showPopup");
|
||||
this.updatePref("browser.urlbar.autoFill");
|
||||
]]></constructor>
|
||||
|
||||
<destructor><![CDATA[
|
||||
var pbi = this.mPrefs.QueryInterface(Components.interfaces.nsIPrefBranchInternal);
|
||||
if (pbi)
|
||||
pbi.removeObserver("browser.urlbar", this.mPrefObserver);
|
||||
this.mPrefs.removeObserver("browser.urlbar", this.mPrefObserver);
|
||||
]]></destructor>
|
||||
|
||||
<field name="mPrefs">
|
||||
var svc = Components.classes["@mozilla.org/preferences-service;1"]
|
||||
.getService(Components.interfaces.nsIPrefService);
|
||||
svc.getBranch(null);
|
||||
</field>
|
||||
<property name="mPrefs">
|
||||
Components.classes["@mozilla.org/preferences;1"].getService(Components.interfaces.nsIPref);
|
||||
</property>
|
||||
|
||||
<property name="mPrefObserver"><![CDATA[
|
||||
({
|
||||
|
@ -43,9 +37,9 @@
|
|||
<parameter name="aPref"/>
|
||||
<body><![CDATA[
|
||||
if (!aPref.indexOf("browser.urlbar.showPopup")) {
|
||||
this.showPopup = this.mPrefs.getBoolPref("browser.urlbar.showPopup");
|
||||
this.showPopup = this.mPrefs.GetBoolPref("browser.urlbar.showPopup");
|
||||
} else if (!aPref.indexOf("browser.urlbar.autoFill")) {
|
||||
this.autoFill = this.mPrefs.getBoolPref("browser.urlbar.autoFill");
|
||||
this.autoFill = this.mPrefs.GetBoolPref("browser.urlbar.autoFill");
|
||||
}
|
||||
]]></body>
|
||||
</method>
|
||||
|
@ -66,19 +60,13 @@
|
|||
<implementation>
|
||||
<constructor><![CDATA[
|
||||
// listen for changes to default search engine
|
||||
var pbi = this.mPrefs.QueryInterface(Components.interfaces.nsIPrefBranchInternal);
|
||||
if (pbi) {
|
||||
pbi.addObserver("browser.search", this.mPrefObserver, false);
|
||||
pbi.addObserver("browser.urlbar", this.mPrefObserver, false);
|
||||
}
|
||||
this.mPrefs.addObserver("browser.search", this.mPrefObserver);
|
||||
this.mPrefs.addObserver("browser.urlbar", this.mPrefObserver);
|
||||
]]></constructor>
|
||||
|
||||
<destructor><![CDATA[
|
||||
var pbi = this.mPrefs.QueryInterface(Components.interfaces.nsIPrefBranchInternal);
|
||||
if (pbi) {
|
||||
pbi.removeObserver("browser.search", this.mPrefObserver);
|
||||
pbi.removeObserver("browser.urlbar", this.mPrefObserver);
|
||||
}
|
||||
this.mPrefs.removeObserver("browser.search", this.mPrefObserver);
|
||||
this.mPrefs.removeObserver("browser.urlbar", this.mPrefObserver);
|
||||
]]></destructor>
|
||||
|
||||
<property name="selectedIndex"
|
||||
|
@ -120,11 +108,9 @@
|
|||
document.getAnonymousElementByAttribute(this, "role", "search-box");
|
||||
</property>
|
||||
|
||||
<field name="mPrefs">
|
||||
var svc = Components.classes["@mozilla.org/preferences-service;1"]
|
||||
.getService(Components.interfaces.nsIPrefService);
|
||||
svc.getBranch(null);
|
||||
</field>
|
||||
<property name="mPrefs">
|
||||
Components.classes["@mozilla.org/preferences;1"].getService(Components.interfaces.nsIPref);
|
||||
</property>
|
||||
|
||||
<property name="mPrefObserver"><![CDATA[
|
||||
({
|
||||
|
@ -169,7 +155,7 @@
|
|||
<parameter name="aPref"/>
|
||||
<body><![CDATA[
|
||||
if (!aPref.indexOf("browser.urlbar.showSearch"))
|
||||
this.showSearch = this.mPrefs.getBoolPref("browser.urlbar.showSearch");
|
||||
this.showSearch = this.mPrefs.GetBoolPref("browser.urlbar.showSearch");
|
||||
]]></body>
|
||||
</method>
|
||||
|
||||
|
@ -210,12 +196,10 @@
|
|||
|
||||
var defaultEngine = null;
|
||||
try {
|
||||
defaultEngine = this.mPrefs.getComplexValue("browser.search.defaultengine",
|
||||
Components.interfaces.nsISupportsWString);
|
||||
defaultEngine = this.mPrefs.CopyUnicharPref("browser.search.defaultengine");
|
||||
} catch(ex) {
|
||||
this.ensureDefaultEnginePrefs(rdf, ds);
|
||||
defaultEngine = this.mPrefs.getComplexValue("browser.search.defaultengine",
|
||||
Components.interfaces.nsISupportsWString);
|
||||
defaultEngine = this.mPrefs.CopyUnicharPref("browser.search.defaultengine");
|
||||
}
|
||||
|
||||
if (defaultEngine) {
|
||||
|
@ -243,8 +227,7 @@
|
|||
<parameter name="aRDF"/>
|
||||
<parameter name="aDS"/>
|
||||
<body><![CDATA[
|
||||
var defaultName = this.mPrefs.getComplexValue("browser.search.defaultenginename",
|
||||
Components.interfaces.nsIPrefLocalizedString);
|
||||
var defaultName = this.mPrefs.getLocalizedUnicharPref("browser.search.defaultenginename");
|
||||
const kNC_Root = aRDF.GetResource("NC:SearchEngineRoot");
|
||||
const kNC_child = aRDF.GetResource("http://home.netscape.com/NC-rdf#child");
|
||||
const kNC_Name = aRDF.GetResource("http://home.netscape.com/NC-rdf#Name");
|
||||
|
@ -254,9 +237,7 @@
|
|||
var engineRes = arcs.getNext().QueryInterface(Components.interfaces.nsIRDFResource);
|
||||
var name = this.readRDFString(aDS, engineRes, kNC_Name);
|
||||
if (name == defaultName)
|
||||
this.mPrefs.setComplexValue("browser.search.defaultengine",
|
||||
Components.interfaces.nsISupportsWString,
|
||||
engineRes.Value);
|
||||
this.mPrefs.SetUnicharPref("browser.search.defaultengine", engineRes.Value);
|
||||
}
|
||||
]]></body>
|
||||
</method>
|
||||
|
|
Загрузка…
Ссылка в новой задаче