~ubuntu-branches/debian/stretch/downthemall/stretch

« back to all changes in this revision

Viewing changes to chrome/content/preferences/bindings.xml

  • Committer: Package Import Robot
  • Author(s): Michael Meskes
  • Date: 2016-09-21 13:33:55 UTC
  • mto: This revision was merged to the branch mainline in revision 11.
  • Revision ID: package-import@ubuntu.com-20160921133355-ylst3mzzo82mghyw
Tags: upstream-3.0.6
ImportĀ upstreamĀ versionĀ 3.0.6

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
<?xml version="1.0"?>
 
2
<!-- This Source Code Form is subject to the terms of the Mozilla Public
 
3
        - License, v. 2.0. If a copy of the MPL was not distributed with this
 
4
        - file, You can obtain one at http://mozilla.org/MPL/2.0/. -->
 
5
 
 
6
<!DOCTYPE bindings [
 
7
        <!ENTITY % prefsDTD SYSTEM "chrome://dta/locale/prefpanes.dtd">
 
8
        %prefsDTD;
 
9
        <!ENTITY % defprefsDTD SYSTEM "chrome://dta-locale/content/prefpanes.dtd">
 
10
        %defprefsDTD;
 
11
]>
 
12
<bindings 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">
 
13
        <binding id="serverlimit-base" extends="chrome://global/content/bindings/richlistbox.xml#richlistitem">
 
14
                <implementation>
 
15
                        <field name="_host">document.getAnonymousElementByAttribute(this, 'anonid', 'host');</field>
 
16
                        <field name="_connectionsLabel">document.getAnonymousElementByAttribute(this, 'anonid', 'connectionsLabel');</field>
 
17
                        <field name="_speedLabel">document.getAnonymousElementByAttribute(this, 'anonid', 'speedLabel');</field>
 
18
                        <field name="_segmentsLabel">document.getAnonymousElementByAttribute(this, 'anonid', 'segmentsLabel');</field>
 
19
 
 
20
                        <property name="host" onget="return this._host.value;" />
 
21
 
 
22
                        <constructor>this.refresh();</constructor>
 
23
 
 
24
                        <method name="postEvent">
 
25
                                <parameter name="eventType" />
 
26
                                <body><![CDATA[
 
27
                                        let evt = document.createEvent('UIEvents');
 
28
                                        evt.initUIEvent(eventType, true, true, null, 0);
 
29
                                        return this.dispatchEvent(evt);
 
30
                                ]]></body>
 
31
                        </method>
 
32
 
 
33
                        <method name="refresh">
 
34
                                <body><![CDATA[
 
35
                                        this._connectionsLabel.value = (this.connections > 0) ? this.connections : _('unlimited');
 
36
                                        this._speedLabel.value = (this.speed > 0) ? Utils.formatSpeed(this.speed * 1024) : _('unlimited');
 
37
                                        this._segmentsLabel.value = (this.segments > 0) ? this.segments : _('unlimited');
 
38
                                ]]></body>
 
39
                        </method>
 
40
 
 
41
                        <method name="edit">
 
42
                                <body><![CDATA[
 
43
                                        this.postEvent('LimitsEdit');
 
44
                                ]]></body>
 
45
                        </method>
 
46
                </implementation>
 
47
        </binding>
 
48
        <binding id="serverlimit" extends="chrome://dta/content/preferences/bindings.xml#serverlimit-base">
 
49
                <content>
 
50
                        <xul:grid flex="1">
 
51
                                <xul:columns>
 
52
                                        <xul:column/>
 
53
                                        <xul:column flex="1"/>
 
54
                                </xul:columns>
 
55
                                <xul:rows>
 
56
                                        <xul:hbox class="serverlimit-host" align="center">
 
57
                                                <xul:image class="serverlimit-host-image" />
 
58
                                                <xul:label anonid="host" xbl:inherits="value=host" class="serverlimit-host-label" crop="right" />
 
59
                                        </xul:hbox>
 
60
                                        <xul:row>
 
61
                                                <xul:label value="&serverspane.connections.label;" class="serverlimit-desc-label" />
 
62
                                                <xul:label class="serverlimit-connections-label serverlimit-value-label" anonid="connectionsLabel" />
 
63
                                        </xul:row>
 
64
                                        <xul:row>
 
65
                                                <xul:label value="&serverspane.speed2.label;" class="serverlimit-desc-label" />
 
66
                                                <xul:label class="serverlimit-speed-label serverlimit-value-label" anonid="speedLabel" />
 
67
                                        </xul:row>
 
68
                                        <xul:row>
 
69
                                                <xul:label value="&serverspane.segments.label;" class="serverlimit-desc-label" />
 
70
                                                <xul:label class="serverlimit-segments-label serverlimit-value-label" anonid="segmentsLabel" />
 
71
                                        </xul:row>
 
72
                                </xul:rows>
 
73
                        </xul:grid>
 
74
                </content>
 
75
                <implementation>
 
76
                        <property name="connections" onget="return parseInt(this.getAttribute('connections'));" />
 
77
                        <property name="speed" onget="return parseInt(this.getAttribute('speed'));" />
 
78
                        <property name="segments" onget="return parseInt(this.getAttribute('segments'));" />
 
79
                </implementation>
 
80
        </binding>
 
81
        <binding id="serverlimit-selected" extends="chrome://dta/content/preferences/bindings.xml#serverlimit-base">
 
82
                <content>
 
83
                        <xul:hbox flex="1">
 
84
                                <xul:grid flex="1">
 
85
                                        <xul:columns>
 
86
                                                <xul:column/>
 
87
                                                <xul:column flex="1"/>
 
88
                                        </xul:columns>
 
89
                                        <xul:rows>
 
90
                                                <xul:hbox class="serverlimit-host" align="center">
 
91
                                                        <xul:image class="serverlimit-host-image" />
 
92
                                                        <xul:label anonid="host" xbl:inherits="value=host" class="serverlimit-host-label" crop="right" />
 
93
                                                </xul:hbox>
 
94
                                                <xul:row>
 
95
                                                        <xul:label value="&serverspane.connections.label;" class="serverlimit-desc-label" />
 
96
                                                        <xul:label class="serverlimit-connections-label serverlimit-value-label" anonid="connectionsLabel" />
 
97
                                                </xul:row>
 
98
                                                <xul:row>
 
99
                                                        <xul:label value="&serverspane.speed2.label;" class="serverlimit-desc-label" />
 
100
                                                        <xul:label class="serverlimit-speed-label serverlimit-value-label" anonid="speedLabel" />
 
101
                                                </xul:row>
 
102
                                                <xul:row>
 
103
                                                        <xul:label value="&serverspane.segments.label;" class="serverlimit-desc-label" />
 
104
                                                        <xul:label class="serverlimit-segments-label serverlimit-value-label" anonid="segmentsLabel" />
 
105
                                                </xul:row>
 
106
                                        </xul:rows>
 
107
                                </xul:grid>
 
108
                                <xul:separator class="thin"/>
 
109
                                <xul:vbox pack="start" class="serverlimit-buttons">
 
110
                                        <xul:button label="&serverspane.edit.label;" anonid="editButton" />
 
111
                                        <xul:button label="&serverspane.remove.label;" anonid="removeButton" />
 
112
                                </xul:vbox>
 
113
                        </xul:hbox>
 
114
                </content>
 
115
                <implementation>
 
116
                        <property name="connections" onget="return parseInt(this.getAttribute('connections'));" />
 
117
                        <property name="speed" onget="return parseInt(this.getAttribute('speed'));" />
 
118
                        <property name="segments" onget="return parseInt(this.getAttribute('segments'));" />
 
119
                        <method name="removeLimit">
 
120
                                <body><![CDATA[
 
121
                                        if (!this.postEvent('LimitsCanRemove')) {
 
122
                                                return;
 
123
                                        }
 
124
                                        this.limit.remove();
 
125
                                        this.postEvent('LimitsRemoved');
 
126
                                ]]></body>
 
127
                        </method>
 
128
                </implementation>
 
129
                <handlers>
 
130
                        <handler event="command"><![CDATA[
 
131
                                switch (event.originalTarget.getAttribute('anonid')) {
 
132
                                        case 'editButton':
 
133
                                                this.edit();
 
134
                                                break;
 
135
                                        case 'removeButton':
 
136
                                                this.removeLimit();
 
137
                                                break;
 
138
                                }
 
139
                        ]]></handler>
 
140
                        <handler event="click" clickcount="2"><![CDATA[
 
141
                                this.edit();
 
142
                        ]]></handler>
 
143
                </handlers>
 
144
        </binding>
 
145
        <binding id="serverlimit-editing" extends="chrome://dta/content/preferences/bindings.xml#serverlimit-base">
 
146
                <content>
 
147
                        <xul:hbox flex="1">
 
148
                                <xul:grid flex="1" class="serverlimit-grid">
 
149
                                        <xul:columns>
 
150
                                                <xul:column/>
 
151
                                                <xul:column flex="1"/>
 
152
                                        </xul:columns>
 
153
                                        <xul:rows>
 
154
                                                <xul:hbox class="serverlimit-host" align="center">
 
155
                                                        <xul:image class="serverlimit-host-image" />
 
156
                                                        <xul:label anonid="host" xbl:inherits="value=host" class="serverlimit-host-label" crop="right" />
 
157
                                                </xul:hbox>
 
158
                                                <xul:row>
 
159
                                                        <xul:label value="&serverspane.connections.label;" />
 
160
                                                        <xul:radiogroup anonid="connectionsGroup" orient="horizontal" class="serverlimit-radiogroup">
 
161
                                                                <xul:radio label="&serverspane.unlimited;" value="unlimited" />
 
162
                                                                <xul:radio label="&serverspane.limited;" value="limited" />
 
163
                                                                <xul:hbox align="center">
 
164
                                                                        <xul:scale min="1" max="10" anonid="connections" xbl:inherits="value=connections" />
 
165
                                                                        <xul:label class="serverlimit-connections-label serverlimit-scale-label" anonid="connectionsLabel" />
 
166
                                                                </xul:hbox>
 
167
                                                        </xul:radiogroup>
 
168
                                                </xul:row>
 
169
                                                <xul:row>
 
170
                                                        <xul:label value="&serverspane.speed2.label;" />
 
171
                                                        <xul:radiogroup anonid="speedGroup" orient="horizontal" class="serverlimit-radiogroup">
 
172
                                                                <xul:radio label="&serverspane.unlimited;" value="unlimited" />
 
173
                                                                <xul:radio label="&serverspane.limited;" value="limited" />
 
174
                                                                <xul:hbox align="center">
 
175
                                                                        <xul:textbox type="number" min="1" max="20480" size="5" increment="4" pageincrement="16" anonid="speed" xbl:inherits="value=speed" />
 
176
                                                                        <xul:label class="serverlimit-speed-label serverlimit-scale-label" anonid="speedLabel" />
 
177
                                                                </xul:hbox>
 
178
                                                        </xul:radiogroup>
 
179
                                                </xul:row>
 
180
                                                <xul:row>
 
181
                                                        <xul:label value="&serverspane.segments.label;" />
 
182
                                                        <xul:radiogroup anonid="segmentsGroup" orient="horizontal" class="serverlimit-radiogroup">
 
183
                                                                <xul:radio label="&serverspane.unlimited;" value="unlimited" />
 
184
                                                                <xul:radio label="&serverspane.limited;" value="limited" />
 
185
                                                                <xul:hbox align="center">
 
186
                                                                        <xul:scale min="1" max="10" anonid="segments" xbl:inherits="value=segments" />
 
187
                                                                        <xul:label class="serverlimit-segments-label serverlimit-scale-label" anonid="segmentsLabel" />
 
188
                                                                </xul:hbox>
 
189
                                                        </xul:radiogroup>
 
190
                                                </xul:row>
 
191
                                        </xul:rows>
 
192
                                </xul:grid>
 
193
                                <xul:separator class="thin"/>
 
194
                                <xul:vbox pack="start" class="serverlimit-buttons">
 
195
                                        <xul:button anonid="saveButton" />
 
196
                                        <xul:button label="&serverspane.cancel.label;" anonid="cancelButton" />
 
197
                                </xul:vbox>
 
198
                        </xul:hbox>
 
199
                </content>
 
200
                <implementation>
 
201
                        <field name="_connectionsGroup">document.getAnonymousElementByAttribute(this, 'anonid', 'connectionsGroup');</field>
 
202
                        <field name="_connections">document.getAnonymousElementByAttribute(this, 'anonid', 'connections');</field>
 
203
 
 
204
                        <field name="_speedGroup">document.getAnonymousElementByAttribute(this, 'anonid', 'speedGroup');</field>
 
205
                        <field name="_speed">document.getAnonymousElementByAttribute(this, 'anonid', 'speed');</field>
 
206
 
 
207
                        <field name="_segmentsGroup">document.getAnonymousElementByAttribute(this, 'anonid', 'segmentsGroup');</field>
 
208
                        <field name="_segments">document.getAnonymousElementByAttribute(this, 'anonid', 'segments');</field>
 
209
 
 
210
                        <field name="_saveButton">document.getAnonymousElementByAttribute(this, 'anonid', 'saveButton');</field>
 
211
 
 
212
                        <property name="connections">
 
213
                                <getter><![CDATA[
 
214
                                        if (this._connectionsGroup.value == "unlimited") {
 
215
                                                return -1;
 
216
                                        }
 
217
                                        return parseInt(this._connections.value);
 
218
                                ]]></getter>
 
219
                        </property>
 
220
 
 
221
                        <property name="speed">
 
222
                                <getter><![CDATA[
 
223
                                        if (this._speedGroup.value == "unlimited") {
 
224
                                                return -1;
 
225
                                        }
 
226
                                        return parseInt(this._speed.value);
 
227
                                ]]></getter>
 
228
                        </property>
 
229
 
 
230
                        <property name="segments">
 
231
                                <getter><![CDATA[
 
232
                                        if (this._segmentsGroup.value == "unlimited") {
 
233
                                                return 0;
 
234
                                        }
 
235
                                        return parseInt(this._segments.value);
 
236
                                ]]></getter>
 
237
                        </property>
 
238
 
 
239
                        <constructor><![CDATA[
 
240
                                this._connectionsGroup.value = this.getAttribute('connections') <= 0 ? 'unlimited' : 'limited';
 
241
                                this._speedGroup.value = this.getAttribute('speed') <= 0 ? 'unlimited' : 'limited';
 
242
                                this._segmentsGroup.value = this.getAttribute('segments') <= 0 ? 'unlimited' : 'limited';
 
243
 
 
244
                                this._saveButton.label = _(this.limit.isNew ? 'createlimit' : 'savelimit');
 
245
                                this.parentNode.ensureElementIsVisible(this);
 
246
                        ]]></constructor>
 
247
 
 
248
                        <method name="saveEdit">
 
249
                                <body><![CDATA[
 
250
                                        if (!this.postEvent("LimitsEditSave")) {
 
251
                                                return;
 
252
                                        }
 
253
 
 
254
                                        this.limit.connections = this.connections;
 
255
                                        this.limit.speed = this.speed;
 
256
                                        this.limit.segments = this.segments;
 
257
 
 
258
                                        this.setAttribute('connections', this.connections);
 
259
                                        this.setAttribute('speed', this.speed);
 
260
                                        this.setAttribute('segments', this.segments);
 
261
 
 
262
                                        this.limit.save();
 
263
                                ]]></body>
 
264
                        </method>
 
265
 
 
266
                        <method name="cancelEdit">
 
267
                                <body><![CDATA[
 
268
                                        this.postEvent("LimitsEditCancel");
 
269
                                ]]></body>
 
270
                        </method>
 
271
                        <method name="changedConnections">
 
272
                                <body><![CDATA[
 
273
                                        if (this._connectionsGroup.value != 'limited') {
 
274
                                                return;
 
275
                                        }
 
276
                                        this._connections.value = Math.max(this.limit.connections, 0) || 2;
 
277
                                        this.refresh();
 
278
                                ]]></body>
 
279
                        </method>
 
280
                        <method name="changedSpeed">
 
281
                                <body><![CDATA[
 
282
                                        if (this._speedGroup.value != 'limited') {
 
283
                                                return;
 
284
                                        }
 
285
                                        this._speed.value = Math.max(this.limit.speed, 0) || 100;
 
286
                                        this.refresh();
 
287
                                ]]></body>
 
288
                        </method>
 
289
                        <method name="changedSegments">
 
290
                                <body><![CDATA[
 
291
                                        if (this._segmentsGroup.value != 'limited') {
 
292
                                                return;
 
293
                                        }
 
294
                                        this._segments.value = Math.max(this.limit.segments, 0) || 1;
 
295
                                        this.refresh();
 
296
                                ]]></body>
 
297
                        </method>
 
298
                </implementation>
 
299
                <handlers>
 
300
                        <handler event="change">this.refresh();</handler>
 
301
                        <handler event="command"><![CDATA[
 
302
                                switch (event.originalTarget.getAttribute('anonid')) {
 
303
                                        case 'saveButton':
 
304
                                                this.saveEdit();
 
305
                                                break;
 
306
                                        case 'cancelButton':
 
307
                                                this.cancelEdit();
 
308
                                                break;
 
309
                                }
 
310
                        ]]></handler>
 
311
                        <handler event="select"><![CDATA[
 
312
                                switch (event.originalTarget.getAttribute('anonid')) {
 
313
                                        case 'connectionsGroup':
 
314
                                                this.changedConnections();
 
315
                                                break;
 
316
                                        case 'speedGroup':
 
317
                                                this.changedSpeed();
 
318
                                                break;
 
319
                                        case 'segmentsGroup':
 
320
                                                this.changedSegments();
 
321
                                                break;
 
322
                                }
 
323
                                this.refresh();
 
324
                        ]]></handler>
 
325
                </handlers>
 
326
        </binding>
 
327
 
 
328
        <binding id="timepicker" extends="chrome://global/content/bindings/datetimepicker.xml#timepicker">
 
329
                <implementation>
 
330
                        <field name="is24HourClock">false</field>
 
331
                        <field name="hourLeadingZero">false</field>
 
332
                        <field name="minuteLeadingZero">true</field>
 
333
                        <field name="secondLeadingZero">true</field>
 
334
                        <field name="amIndicator">"AM"</field>
 
335
                        <field name="pmIndicator">"PM"</field>
 
336
                </implementation>
 
337
        </binding>
 
338
</bindings>