Bug 518363: download manager: retry button always visible [r=mark.finkle]
authorGavin Sharp <gavin@gavinsharp.com>
Tue, 06 Oct 2009 16:54:58 -0400
changeset 65635 6c47300f3a402e0504aa9eadde8425fabb13cbcb
parent 65634 9004dfcb594e089081917100ac83870e8ab2a6a7
child 65636 0df919064f5c799d6a2c23c9ced06a9a44f8d89b
push id1
push userroot
push dateTue, 26 Apr 2011 22:38:44 +0000
treeherdermozilla-beta@bfdb6e623a36 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmark
bugs518363
Bug 518363: download manager: retry button always visible [r=mark.finkle]
mobile/chrome/content/bindings/downloads.xml
mobile/chrome/content/downloads.js
mobile/locales/en-US/chrome/browser.dtd
mobile/themes/hildon/browser.css
mobile/themes/wince/browser.css
--- a/mobile/chrome/content/bindings/downloads.xml
+++ b/mobile/chrome/content/bindings/downloads.xml
@@ -51,17 +51,17 @@
                  state == this.nsIDLMgr.DOWNLOAD_DIRTY ||
                  state == this.nsIDLMgr.DOWNLOAD_FAILED;
         ]]>
         </getter>
       </property>
     </implementation>
   </binding>
 
-  <binding id="download-downloading" extends="chrome://browser/content/bindings/downloads.xml#download-base">
+  <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">
@@ -71,17 +71,17 @@
           <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="chrome://browser/content/bindings/downloads.xml#download-base">
+  <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">
@@ -91,34 +91,35 @@
           <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="chrome://browser/content/bindings/downloads.xml#download-base">
+  <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:button class="download-retry" label="&downloadRetry.label;"
+          <xul:label class="hide-on-select download-retry-failed normal" value="&downloadFailed.label;"/>
+          <xul:button class="show-on-select download-retry" label="&downloadRetry.label;"
                       oncommand="DownloadsView.retryDownload(document.getBindingParent(this));"/>
         </xul:hbox>
       </xul:vbox>
     </content>
   </binding>
 
-  <binding id="download-done" extends="chrome://browser/content/bindings/downloads.xml#download-base">
+  <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>
--- a/mobile/chrome/content/downloads.js
+++ b/mobile/chrome/content/downloads.js
@@ -270,28 +270,27 @@ var DownloadsView = {
     // Move the item
     this._list.insertBefore(element, next);
   },
 
   _updateStatus: function dv__updateStatus(aItem) {
     let strings = document.getElementById("bundle_browser");
 
     let status = "";
-    let state = Number(aItem.getAttribute("state"));
 
     // Display the file size, but show "Unknown" for negative sizes
     let fileSize = Number(aItem.getAttribute("maxBytes"));
     let sizeText = strings.getString("downloadsUnknownSize");
     if (fileSize >= 0) {
       let [size, unit] = DownloadUtils.convertByteUnits(fileSize);
       sizeText = this._replaceInsert(strings.getString("downloadsKnownSize"), 1, size);
       sizeText = this._replaceInsert(sizeText, 2, unit);
     }
 
-    // Insert 1 is the download size or download state
+    // Insert 1 is the download size
     status = this._replaceInsert(strings.getString("downloadsStatus"), 1, sizeText);
 
     // Insert 2 is the eTLD + 1 or other variations of the host
     let [displayHost, fullHost] = DownloadUtils.getURIHost(this._getReferrerOrSource(aItem));
     status = this._replaceInsert(status, 2, displayHost);
 
     aItem.setAttribute("status", status);
   },
--- a/mobile/locales/en-US/chrome/browser.dtd
+++ b/mobile/locales/en-US/chrome/browser.dtd
@@ -61,16 +61,17 @@
 <!ENTITY downloadShowPage.label    "Go to Page">
 <!ENTITY downloadShow2.label       "Find">
 <!ENTITY downloadOpen2.label       "Open">
 <!ENTITY downloadCancel.label      "Cancel">
 <!ENTITY downloadPause.label       "Pause">
 <!ENTITY downloadResume.label      "Resume">
 <!ENTITY downloadRetry.label       "Retry">
 <!ENTITY downloadRemove.label      "Remove">
+<!ENTITY downloadFailed.label      "Failed">
 
 <!ENTITY noResults.label           "No results">
 <!ENTITY allBookmarks.label        "See all bookmarks">
 
 <!ENTITY searchEngine.addSearch    "Add Search:">
 
 <!ENTITY bookmarkPopup.label       "Page Bookmarked">
 <!ENTITY bookmarkRemove.label      "Remove">
--- a/mobile/themes/hildon/browser.css
+++ b/mobile/themes/hildon/browser.css
@@ -399,16 +399,21 @@ toolbarbutton.page-button {
 .addon-rating[rating="4"] {
   -moz-image-region: rect(72px 78px 90px 0px);
 }
 
 .addon-rating[rating="5"] {
   -moz-image-region: rect(90px 78px 108px 0px);
 }
 
+/* downloads panel UI   ---------------------------------------------------- */
+.download-retry-failed {
+  color: red !important;
+}
+
 /* console panel UI   ------------------------------------------------------ */
 @media (orientation: landscape) {
   #console-filter-warnings,
   #console-filter-messages {
     visibility: visible;
   }
 }
 
--- a/mobile/themes/wince/browser.css
+++ b/mobile/themes/wince/browser.css
@@ -187,16 +187,21 @@ toolbarbutton.page-button {
 #addons-update-all {
   color: #000 !important;
 }
 
 #addons-update-all[disabled="true"] {
   color: #aaa !important;
 }
 
+/* downloads panel UI   ---------------------------------------------------- */
+.download-retry-failed {
+  color: red !important;
+}
+
 /* console panel UI   ------------------------------------------------------ */
 @media (orientation: landscape) {
   #console-filter-warnings,
   #console-filter-messages {
     visibility: visible;
   }
 }