diff options
author | Matt A. Tobin <mattatobin@localhost.localdomain> | 2018-02-02 04:16:08 -0500 |
---|---|---|
committer | Matt A. Tobin <mattatobin@localhost.localdomain> | 2018-02-02 04:16:08 -0500 |
commit | 5f8de423f190bbb79a62f804151bc24824fa32d8 (patch) | |
tree | 10027f336435511475e392454359edea8e25895d /toolkit/content/widgets/filefield.xml | |
parent | 49ee0794b5d912db1f95dce6eb52d781dc210db5 (diff) | |
download | UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.gz UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.lz UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.xz UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.zip |
Add m-esr52 at 52.6.0
Diffstat (limited to 'toolkit/content/widgets/filefield.xml')
-rw-r--r-- | toolkit/content/widgets/filefield.xml | 96 |
1 files changed, 96 insertions, 0 deletions
diff --git a/toolkit/content/widgets/filefield.xml b/toolkit/content/widgets/filefield.xml new file mode 100644 index 000000000..f81761eb5 --- /dev/null +++ b/toolkit/content/widgets/filefield.xml @@ -0,0 +1,96 @@ +<?xml version="1.0"?> +<!-- This Source Code Form is subject to the terms of the Mozilla Public + - License, v. 2.0. If a copy of the MPL was not distributed with this + - file, You can obtain one at http://mozilla.org/MPL/2.0/. --> + + +<bindings id="filefieldBindings" + 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" extends="chrome://global/content/bindings/general.xml#basetext"> + <resources> + <stylesheet src="chrome://global/skin/filefield.css"/> + </resources> + <content> + <xul:stringbundle anonid="bundle" src="chrome://global/locale/filefield.properties"/> + <xul:hbox class="fileFieldContentBox" align="center" flex="1" xbl:inherits="disabled"> + <xul:image class="fileFieldIcon" xbl:inherits="src=image,disabled"/> + <xul:textbox class="fileFieldLabel" xbl:inherits="value=label,disabled,accesskey,tabindex,aria-labelledby" flex="1" readonly="true"/> + </xul:hbox> + </content> + <implementation implements="nsIDOMXULLabeledControlElement"> + <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> + <method name="_getDisplayNameForFile"> + <parameter name="aFile"/> + <body> + <![CDATA[ + if (/Win/.test(navigator.platform)) { + var lfw = aFile.QueryInterface(Components.interfaces.nsILocalFileWin); + try { + return lfw.getVersionInfoField("FileDescription"); + } + catch (e) { + // fall through to the filename + } + } else if (/Mac/.test(navigator.platform)) { + var lfm = aFile.QueryInterface(Components.interfaces.nsILocalFileMac); + try { + return lfm.bundleDisplayName; + } + catch (e) { + // fall through to the file name + } + } + 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; + ]]> + </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> |