зеркало из https://github.com/mozilla/pjs.git
84 строки
3.2 KiB
XML
84 строки
3.2 KiB
XML
<?xml version="1.0"?>
|
|
|
|
<bindings id="PreferencesSkinBindings"
|
|
xmlns="http://www.mozilla.org/xbl"
|
|
xmlns:xbl="http://www.mozilla.org/xbl"
|
|
xmlns:xul="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
|
|
|
|
<binding id="fileField">
|
|
<content>
|
|
<xul:stringbundle anonid="bundle" src="chrome://mozapps/locale/preferences/preferences.properties"/>
|
|
<xul:hbox class="fileFieldContentBox" align="center" flex="1">
|
|
<xul:image class="fileFieldIcon" xbl:inherits="src=image"/>
|
|
<xul:textbox class="fileFieldLabel" xbl:inherits="value=label,disabled" flex="1" readonly="true"/>
|
|
</xul:hbox>
|
|
</content>
|
|
<implementation>
|
|
<property name="image" onget="return this.getAttribute('image');"
|
|
onset="this.setAttribute('image', val); return val;"/>
|
|
<property name="label" onget="return this.getAttribute('label');">
|
|
<setter>
|
|
this.setAttribute('label', val);
|
|
var elt = document.getAnonymousElementByAttribute(this, "class", "fileFieldLabel");
|
|
return (elt.value = val);
|
|
</setter>
|
|
</property>
|
|
|
|
<field name="_file">null</field>
|
|
<property name="file" onget="return this._file">
|
|
<setter>
|
|
<![CDATA[
|
|
this._file = val;
|
|
if (val) {
|
|
this.image = this._getIconURLForFile(val);
|
|
this.label = this._getDisplayNameForFile(val);
|
|
}
|
|
else {
|
|
this.removeAttribute("image");
|
|
var bundle = document.getAnonymousElementByAttribute(this, "anonid", "bundle");
|
|
this.label = bundle.getString("downloadHelperNoneSelected");
|
|
}
|
|
return val;
|
|
]]>
|
|
</setter>
|
|
</property>
|
|
<property name="disabled" onget="return this.getAttribute('disabled');"
|
|
onset="this.setAttribute('disabled', val); return val;"/>
|
|
|
|
<method name="_getDisplayNameForFile">
|
|
<parameter name="aFile"/>
|
|
<body>
|
|
<![CDATA[
|
|
#ifdef XP_WIN
|
|
var lfw = aFile.QueryInterface(Components.interfaces.nsILocalFileWin);
|
|
return lfw.getVersionInfoField("FileDescription");
|
|
#else
|
|
// XXXben - Read the bundle name on OS X.
|
|
var ios = Components.classes["@mozilla.org/network/io-service;1"]
|
|
.getService(Components.interfaces.nsIIOService);
|
|
var url = ios.newFileURI(aFile).QueryInterface(Components.interfaces.nsIURL);
|
|
return url.fileName;
|
|
#endif
|
|
]]>
|
|
</body>
|
|
</method>
|
|
|
|
<method name="_getIconURLForFile">
|
|
<parameter name="aFile"/>
|
|
<body>
|
|
<![CDATA[
|
|
if (!aFile)
|
|
return "";
|
|
var ios = Components.classes["@mozilla.org/network/io-service;1"]
|
|
.getService(Components.interfaces.nsIIOService);
|
|
var fph = ios.getProtocolHandler("file")
|
|
.QueryInterface(Components.interfaces.nsIFileProtocolHandler);
|
|
var urlspec = fph.getURLSpecFromFile(aFile);
|
|
return "moz-icon://" + urlspec + "?size=16";
|
|
]]>
|
|
</body>
|
|
</method>
|
|
</implementation>
|
|
</binding>
|
|
</bindings>
|