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/. -->
7
<!ENTITY % prefsDTD SYSTEM "chrome://dta/locale/prefpanes.dtd">
9
<!ENTITY % defprefsDTD SYSTEM "chrome://dta-locale/content/prefpanes.dtd">
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">
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>
20
<property name="host" onget="return this._host.value;" />
22
<constructor>this.refresh();</constructor>
24
<method name="postEvent">
25
<parameter name="eventType" />
27
let evt = document.createEvent('UIEvents');
28
evt.initUIEvent(eventType, true, true, null, 0);
29
return this.dispatchEvent(evt);
33
<method name="refresh">
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');
43
this.postEvent('LimitsEdit');
48
<binding id="serverlimit" extends="chrome://dta/content/preferences/bindings.xml#serverlimit-base">
53
<xul:column flex="1"/>
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" />
61
<xul:label value="&serverspane.connections.label;" class="serverlimit-desc-label" />
62
<xul:label class="serverlimit-connections-label serverlimit-value-label" anonid="connectionsLabel" />
65
<xul:label value="&serverspane.speed2.label;" class="serverlimit-desc-label" />
66
<xul:label class="serverlimit-speed-label serverlimit-value-label" anonid="speedLabel" />
69
<xul:label value="&serverspane.segments.label;" class="serverlimit-desc-label" />
70
<xul:label class="serverlimit-segments-label serverlimit-value-label" anonid="segmentsLabel" />
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'));" />
81
<binding id="serverlimit-selected" extends="chrome://dta/content/preferences/bindings.xml#serverlimit-base">
87
<xul:column flex="1"/>
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" />
95
<xul:label value="&serverspane.connections.label;" class="serverlimit-desc-label" />
96
<xul:label class="serverlimit-connections-label serverlimit-value-label" anonid="connectionsLabel" />
99
<xul:label value="&serverspane.speed2.label;" class="serverlimit-desc-label" />
100
<xul:label class="serverlimit-speed-label serverlimit-value-label" anonid="speedLabel" />
103
<xul:label value="&serverspane.segments.label;" class="serverlimit-desc-label" />
104
<xul:label class="serverlimit-segments-label serverlimit-value-label" anonid="segmentsLabel" />
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" />
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">
121
if (!this.postEvent('LimitsCanRemove')) {
125
this.postEvent('LimitsRemoved');
130
<handler event="command"><![CDATA[
131
switch (event.originalTarget.getAttribute('anonid')) {
140
<handler event="click" clickcount="2"><![CDATA[
145
<binding id="serverlimit-editing" extends="chrome://dta/content/preferences/bindings.xml#serverlimit-base">
148
<xul:grid flex="1" class="serverlimit-grid">
151
<xul:column flex="1"/>
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" />
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" />
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" />
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" />
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" />
201
<field name="_connectionsGroup">document.getAnonymousElementByAttribute(this, 'anonid', 'connectionsGroup');</field>
202
<field name="_connections">document.getAnonymousElementByAttribute(this, 'anonid', 'connections');</field>
204
<field name="_speedGroup">document.getAnonymousElementByAttribute(this, 'anonid', 'speedGroup');</field>
205
<field name="_speed">document.getAnonymousElementByAttribute(this, 'anonid', 'speed');</field>
207
<field name="_segmentsGroup">document.getAnonymousElementByAttribute(this, 'anonid', 'segmentsGroup');</field>
208
<field name="_segments">document.getAnonymousElementByAttribute(this, 'anonid', 'segments');</field>
210
<field name="_saveButton">document.getAnonymousElementByAttribute(this, 'anonid', 'saveButton');</field>
212
<property name="connections">
214
if (this._connectionsGroup.value == "unlimited") {
217
return parseInt(this._connections.value);
221
<property name="speed">
223
if (this._speedGroup.value == "unlimited") {
226
return parseInt(this._speed.value);
230
<property name="segments">
232
if (this._segmentsGroup.value == "unlimited") {
235
return parseInt(this._segments.value);
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';
244
this._saveButton.label = _(this.limit.isNew ? 'createlimit' : 'savelimit');
245
this.parentNode.ensureElementIsVisible(this);
248
<method name="saveEdit">
250
if (!this.postEvent("LimitsEditSave")) {
254
this.limit.connections = this.connections;
255
this.limit.speed = this.speed;
256
this.limit.segments = this.segments;
258
this.setAttribute('connections', this.connections);
259
this.setAttribute('speed', this.speed);
260
this.setAttribute('segments', this.segments);
266
<method name="cancelEdit">
268
this.postEvent("LimitsEditCancel");
271
<method name="changedConnections">
273
if (this._connectionsGroup.value != 'limited') {
276
this._connections.value = Math.max(this.limit.connections, 0) || 2;
280
<method name="changedSpeed">
282
if (this._speedGroup.value != 'limited') {
285
this._speed.value = Math.max(this.limit.speed, 0) || 100;
289
<method name="changedSegments">
291
if (this._segmentsGroup.value != 'limited') {
294
this._segments.value = Math.max(this.limit.segments, 0) || 1;
300
<handler event="change">this.refresh();</handler>
301
<handler event="command"><![CDATA[
302
switch (event.originalTarget.getAttribute('anonid')) {
311
<handler event="select"><![CDATA[
312
switch (event.originalTarget.getAttribute('anonid')) {
313
case 'connectionsGroup':
314
this.changedConnections();
319
case 'segmentsGroup':
320
this.changedSegments();
328
<binding id="timepicker" extends="chrome://global/content/bindings/datetimepicker.xml#timepicker">
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>