gecko/mobile/chrome/content/bindings/downloads.xml

189 lines
7.9 KiB
XML

<?xml version="1.0"?>
<!DOCTYPE bindings [
<!ENTITY % browserDTD SYSTEM "chrome://browser/locale/browser.dtd">
%browserDTD;
]>
<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">
<binding id="download-base" extends="chrome://browser/content/bindings.xml#richlistitem">
<implementation>
<field name="nsIDLMgr">Components.interfaces.nsIDownloadManager</field>
<property name="paused">
<getter>
<![CDATA[
return parseInt(this.getAttribute("state")) == this.nsIDLMgr.DOWNLOAD_PAUSED;
]]>
</getter>
</property>
<property name="openable">
<getter>
<![CDATA[
return parseInt(this.getAttribute("state")) == this.nsIDLMgr.DOWNLOAD_FINISHED;
]]>
</getter>
</property>
<property name="inProgress">
<getter>
<![CDATA[
var state = parseInt(this.getAttribute("state"));
return state == this.nsIDLMgr.DOWNLOAD_NOTSTARTED ||
state == this.nsIDLMgr.DOWNLOAD_QUEUED ||
state == this.nsIDLMgr.DOWNLOAD_DOWNLOADING ||
state == this.nsIDLMgr.DOWNLOAD_PAUSED ||
state == this.nsIDLMgr.DOWNLOAD_SCANNING;
]]>
</getter>
</property>
<property name="removable">
<getter>
<![CDATA[
var state = parseInt(this.getAttribute("state"));
return state == this.nsIDLMgr.DOWNLOAD_FINISHED ||
state == this.nsIDLMgr.DOWNLOAD_CANCELED ||
state == this.nsIDLMgr.DOWNLOAD_BLOCKED_PARENTAL ||
state == this.nsIDLMgr.DOWNLOAD_BLOCKED_POLICY ||
state == this.nsIDLMgr.DOWNLOAD_DIRTY ||
state == this.nsIDLMgr.DOWNLOAD_FAILED;
]]>
</getter>
</property>
</implementation>
</binding>
<binding id="download-not-started" extends="#download-base">
<content orient="horizontal" align="start">
<xul:image validate="always" xbl:inherits="src=iconURL"/>
<xul:vbox flex="1">
<xul:hbox align="center">
<xul:label class="title" xbl:inherits="value=target" crop="center" flex="1"/>
<xul:label class="normal" xbl:inherits="value=datetime"/>
</xul:hbox>
<xul:hbox>
<xul:label class="normal" xbl:inherits="value=status"/>
</xul:hbox>
<xul:hbox class="show-on-select" align="center">
<xul:button anonid="showpage-button" label="&downloadShowPage.label;"
oncommand="DownloadsView.showPage(document.getBindingParent(this));"/>
<xul:spacer flex="1"/>
</xul:hbox>
</xul:vbox>
</content>
<implementation>
<constructor>
<![CDATA[
let referrer = this.hasAttribute("referrer");
if (!referrer)
document.getAnonymousElementByAttribute(this, "anonid", "showpage-button").setAttribute("disabled", "true");
]]>
</constructor>
</implementation>
</binding>
<binding id="download-downloading" extends="#download-base">
<content orient="horizontal" align="start">
<xul:image validate="always" xbl:inherits="src=iconURL"/>
<xul:vbox flex="1">
<xul:hbox align="center">
<xul:label class="title" xbl:inherits="value=target" crop="center" flex="1"/>
<xul:label class="normal" xbl:inherits="value=datetime"/>
</xul:hbox>
<xul:hbox align="center">
<xul:progressmeter anonid="progressmeter" mode="normal" value="0" flex="1" xbl:inherits="value=progress,mode=progressmode"/>
<xul:button class="download-pause" label="&downloadPause.label;"
oncommand="DownloadsView.pauseDownload(document.getBindingParent(this));"/>
<xul:button class="download-cancel" label="&downloadCancel.label;"
oncommand="DownloadsView.cancelDownload(document.getBindingParent(this));"/>
</xul:hbox>
<xul:label class="normal" xbl:inherits="value=status" crop="end"/>
</xul:vbox>
</content>
</binding>
<binding id="download-paused" extends="#download-base">
<content orient="horizontal" align="start">
<xul:image validate="always" xbl:inherits="src=iconURL"/>
<xul:vbox flex="1">
<xul:hbox align="center">
<xul:label class="title" xbl:inherits="value=target" crop="center" flex="1"/>
<xul:label class="normal" xbl:inherits="value=datetime"/>
</xul:hbox>
<xul:hbox align="center">
<xul:progressmeter anonid="progressmeter" mode="normal" value="0" flex="1" xbl:inherits="value=progress,mode=progressmode"/>
<xul:button class="download-resume" label="&downloadResume.label;"
oncommand="DownloadsView.resumeDownload(document.getBindingParent(this));"/>
<xul:button class="download-cancel" label="&downloadCancel.label;"
oncommand="DownloadsView.cancelDownload(document.getBindingParent(this));"/>
</xul:hbox>
<xul:label class="normal" xbl:inherits="value=status" crop="end"/>
</xul:vbox>
</content>
</binding>
<binding id="download-retry" extends="#download-base">
<content orient="horizontal" align="start">
<xul:image validate="always" xbl:inherits="src=iconURL"/>
<xul:vbox flex="1">
<xul:hbox align="center">
<xul:label class="title" xbl:inherits="value=target" crop="center" flex="1"/>
<xul:label class="normal" xbl:inherits="value=datetime"/>
</xul:hbox>
<xul:hbox>
<xul:label class="normal" xbl:inherits="value=status" crop="end" flex="1"/>
<xul:label class="hide-on-select download-retry-failed normal" value="&downloadFailed.label;" xbl:inherits="state" />
<xul:button class="show-on-select download-retry" label="&downloadRetry.label;"
oncommand="DownloadsView.retryDownload(document.getBindingParent(this));"/>
<xul:button class="show-on-select download-remove" label="&downloadDelete.label;"
oncommand="DownloadsView.removeDownload(document.getBindingParent(this));"/>
</xul:hbox>
</xul:vbox>
</content>
</binding>
<binding id="download-done" extends="#download-base">
<content orient="horizontal" align="start">
<xul:image validate="always" xbl:inherits="src=iconURL"/>
<xul:vbox flex="1">
<xul:hbox align="center">
<xul:label class="title" xbl:inherits="value=target" crop="center" flex="1"/>
<xul:label class="normal" xbl:inherits="value=datetime"/>
</xul:hbox>
<xul:hbox>
<xul:label class="normal" xbl:inherits="value=status"/>
</xul:hbox>
<xul:hbox class="show-on-select" align="center">
<xul:button anonid="showpage-button" label="&downloadShowPage.label;"
oncommand="DownloadsView.showPage(document.getBindingParent(this));"/>
<xul:spacer flex="1"/>
<xul:button anonid="open-button" label="&downloadOpen2.label;"
oncommand="DownloadsView.openDownload(document.getBindingParent(this));"/>
<xul:button anonid="remove-button" label="&downloadDelete.label;"
oncommand="DownloadsView.removeDownload(document.getBindingParent(this));"/>
</xul:hbox>
</xul:vbox>
</content>
<implementation>
<constructor>
<![CDATA[
let referrer = this.hasAttribute("referrer");
if (!referrer)
document.getAnonymousElementByAttribute(this, "anonid", "showpage-button").setAttribute("disabled", "true");
let file = DownloadsView._getLocalFile(this.getAttribute("file"));
if (!file.exists())
document.getAnonymousElementByAttribute(this, "anonid", "open-button").setAttribute("disabled", "true");
]]>
</constructor>
</implementation>
</binding>
</bindings>