Bug 452317 - FeedConverter.js: QueryInterface should throw NS_ERROR_NO_INTERFACE...
[wine-gecko.git] / toolkit / mozapps / preferences / preferences.xml
blobc8094da144fc9cd0683c8c95fc48f62d50f9b370
1 <?xml version="1.0"?>
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">
9     <content>
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"/>
14       </xul:hbox>
15     </content>
16     <implementation implements="nsIDOMXULLabeledControlElement">
17       <property name="label" onget="return this.getAttribute('label');">
18         <setter>
19           this.setAttribute('label', val); 
20           var elt = document.getAnonymousElementByAttribute(this, "class", "fileFieldLabel");
21           return (elt.value = val);
22         </setter>
23       </property>
24       
25       <field name="_file">null</field>
26       <property name="file"  onget="return this._file">
27         <setter>
28         <![CDATA[
29           this._file = val; 
30           if (val) {
31             this.image = this._getIconURLForFile(val);
32             this.label = this._getDisplayNameForFile(val);
33           }
34           else {
35             this.removeAttribute("image");
36             var bundle = document.getAnonymousElementByAttribute(this, "anonid", "bundle");
37             this.label = bundle.getString("downloadHelperNoneSelected");
38           }            
39           return val;
40         ]]>
41         </setter>
42       </property>      
43       <method name="_getDisplayNameForFile">
44         <parameter name="aFile"/>
45         <body>
46         <![CDATA[
47 #ifdef XP_WIN
48           var lfw = aFile.QueryInterface(Components.interfaces.nsILocalFileWin);
49           try {
50             return lfw.getVersionInfoField("FileDescription"); 
51           }
52           catch (e) {
53             // fall through to the filename
54           }
55 #endif
56 #ifdef XP_MACOSX
57           var lfm = aFile.QueryInterface(Components.interfaces.nsILocalFileMac);
58           try {
59             return lfm.bundleDisplayName;
60           }
61           catch (e) {
62             // fall through to the file name
63           }
64 #endif
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);
68           return url.fileName;
69         ]]>
70         </body>
71       </method>
72       
73       <method name="_getIconURLForFile">
74         <parameter name="aFile"/>
75         <body>
76         <![CDATA[
77           if (!aFile)
78             return "";
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";  
85         ]]>
86         </body>
87       </method>
88     </implementation>
89   </binding>
90 </bindings>