3 <bindings id="PreferencesSkinBindings"
4 xmlns="http://www.mozilla.org/xbl"
5 xmlns:xbl="http://www.mozilla.org/xbl"
6 xmlns:xul="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
8 <binding id="fileField" extends="chrome://global/content/bindings/general.xml#control-item">
10 <xul:stringbundle anonid="bundle" src="chrome://mozapps/locale/preferences/preferences.properties"/>
11 <xul:hbox class="fileFieldContentBox" align="center" flex="1" xbl:inherits="disabled">
12 <xul:image class="fileFieldIcon" xbl:inherits="src=image,disabled"/>
13 <xul:textbox class="fileFieldLabel" xbl:inherits="value=label,disabled,accesskey,tabindex,aria-labelledby" flex="1" readonly="true"/>
16 <implementation implements="nsIDOMXULLabeledControlElement">
17 <property name="label" onget="return this.getAttribute('label');">
19 this.setAttribute('label', val);
20 var elt = document.getAnonymousElementByAttribute(this, "class", "fileFieldLabel");
21 return (elt.value = val);
25 <field name="_file">null</field>
26 <property name="file" onget="return this._file">
31 this.image = this._getIconURLForFile(val);
32 this.label = this._getDisplayNameForFile(val);
35 this.removeAttribute("image");
36 var bundle = document.getAnonymousElementByAttribute(this, "anonid", "bundle");
37 this.label = bundle.getString("downloadHelperNoneSelected");
43 <method name="_getDisplayNameForFile">
44 <parameter name="aFile"/>
48 var lfw = aFile.QueryInterface(Components.interfaces.nsILocalFileWin);
50 return lfw.getVersionInfoField("FileDescription");
53 // fall through to the filename
57 var lfm = aFile.QueryInterface(Components.interfaces.nsILocalFileMac);
59 return lfm.bundleDisplayName;
62 // fall through to the file name
65 var ios = Components.classes["@mozilla.org/network/io-service;1"]
66 .getService(Components.interfaces.nsIIOService);
67 var url = ios.newFileURI(aFile).QueryInterface(Components.interfaces.nsIURL);
73 <method name="_getIconURLForFile">
74 <parameter name="aFile"/>
79 var ios = Components.classes["@mozilla.org/network/io-service;1"]
80 .getService(Components.interfaces.nsIIOService);
81 var fph = ios.getProtocolHandler("file")
82 .QueryInterface(Components.interfaces.nsIFileProtocolHandler);
83 var urlspec = fph.getURLSpecFromFile(aFile);
84 return "moz-icon://" + urlspec + "?size=16";