Bug 405044, clean up updates.xml, r=gavin, a=beltzner

This commit is contained in:
Olli.Pettay@helsinki.fi 2007-11-27 12:01:16 -08:00
Родитель 7ca4d420ed
Коммит ea19c8a699
1 изменённых файлов: 0 добавлений и 160 удалений

Просмотреть файл

@ -6,165 +6,6 @@
xmlns="http://www.mozilla.org/xbl"
xmlns:xul="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
xmlns:xbl="http://www.mozilla.org/xbl">
<binding id="update" extends="chrome://mozapps/content/shared/richview.xml#richview-item">
<resources>
<stylesheet src="chrome://mozapps/content/update/updates.css"/>
</resources>
<content>
<xul:hbox pack="start">
<xul:label anonid="name" class="update-item-name" xbl:inherits="value=name" crop="right" flex="1"/>
<xul:link class="update-item-details" xbl:inherits="href=detailsURL">&details.link;</xul:link>
</xul:hbox>
<xul:deck anonid="modeDeck">
<xul:label class="update-item-status" xbl:inherits="value=status" flex="1"/>
<xul:vbox>
<xul:progressmeter class="update-item-progress" anonid="progress"
mode="undetermined"/>
<xul:hbox align="center">
<xul:label class="update-item-status" xbl:inherits="value=status" flex="1" crop="right"/>
<xul:button class="update-item-pause" anonid="pauseButton"
label="&pause.label;" accesskey="&pause.accesskey;"/>
</xul:hbox>
</xul:vbox>
</xul:deck>
<xul:stringbundle anonid="strings"
src="chrome://mozapps/locale/update/updates.properties"/>
</content>
<implementation>
<field name="_update">null</field>
<field name="_strings">
document.getAnonymousElementByAttribute(this, "anonid", "strings");
</field>
<field name="_name">
document.getAnonymousElementByAttribute(this, "anonid", "name");
</field>
<field name="_progressBar">
document.getAnonymousElementByAttribute(this, "anonid", "progress");
</field>
<field name="_modeDeck">
document.getAnonymousElementByAttribute(this, "anonid", "modeDeck");
</field>
<field name="_pauseButton">
document.getAnonymousElementByAttribute(this, "anonid", "pauseButton");
</field>
<method name="setUpdate">
<parameter name="update"/>
<body><![CDATA[
this._update = update;
this.name = update.name;
this.setAttribute("detailsURL", update.detailsURL);
this.state = update.selectedPatch.state;
]]></body>
</method>
<property name="name"
onget="return this._name.getAttribute('value');"
onset="this._name.setAttribute('value', val); return val;"/>
<property name="progress"
onget="return parseInt(this._progressBar.getAttribute('value'));"
onset="this._progressBar.setAttribute('value', val); return val;"/>
<property name="status"
onget="return this.getAttribute('status');"
onset="this.setAttribute('status', val); return val;"/>
<field name="_started">false</field>
<method name="startDownload">
<body><![CDATA[
if (!this._started) {
this._progressBar.setAttribute("mode", "normal");
this._pauseButton.disabled = false;
this._started = true;
}
]]></body>
</method>
<method name="stopDownload">
<body><![CDATA[
if (this._started) {
this._progressBar.setAttribute("mode", "undetermined");
this._pauseButton.disabled = true;
this._started = false;
}
]]></body>
</method>
<field name="_paused">false</field>
<property name="paused">
<getter><![CDATA[
return this._paused;
]]></getter>
<setter><![CDATA[
this._paused = val;
var key = val ? "pauseButtonResume" : "pauseButtonPause";
if (val) {
this.setAttribute("old-status", this.status);
//this.status = this._strings.getString("pausedStatus");
this.setAttribute("old-name", this.name);
this.name = this._strings.getFormattedString("pausedName", [this.name]);
LOG("GOAT = " + this._strings.getFormattedString("pausedName", [this.name]));
}
else {
this.status = this.getAttribute("old-status");
this.removeAttribute("old-status");
this.setAttribute("name", this.getAttribute("old-name"));
this.removeAttribute("old-name");
}
this._pauseButton.label = this._strings.getString(key);
return val;
]]></setter>
</property>
<property name="state">
<getter><![CDATA[
return this.getAttribute("state");
]]></getter>
<setter><![CDATA[
this.setAttribute("state", val);
this._modeDeck.setAttribute("selectedIndex", val == "downloading" ? 1 : 0);
var name = this._update.name;
if (val == "downloading") {
var name = this._strings.getFormattedString("downloadingPrefix",
[this._update.name]);
}
this.setAttribute("name", name);
if (val == "failed") {
var failed = this._strings.getString("statusFailed");
this.setAttribute("status", failed);
}
else if (val != "downloading") {
var sdf =
Components.classes["@mozilla.org/intl/scriptabledateformat;1"].
getService(Components.interfaces.nsIScriptableDateFormat);
var installDate = new Date(this._update.installDate);
var dateString = sdf.FormatDateTime("", sdf.dateFormatLong,
sdf.timeFormatSeconds,
date.getFullYear(),
date.getMonth() + 1,
date.getDate(),
date.getHours(),
date.getMinutes(),
date.getSeconds());
dateString = this._strings.getFormattedString("statusSucceededFormat",
[dateString]);
this.setAttribute("status", dateString);
}
return val;
]]></setter>
</property>
<field name="eventPrefix">"update-"</field>
</implementation>
<handlers>
<handler event="command"><![CDATA[
if (event.originalTarget.getAttribute("anonid") == "pauseButton")
this.fireEvent("pause");
]]></handler>
</handlers>
</binding>
<binding id="license">
<content>
@ -387,7 +228,6 @@
return val;
]]></setter>
</property>
onset="this.setAttribute('status', val); return val;"/>
</implementation>
</binding>
</bindings>