Bug 1282664 - Redesign the right-menu on a download item in Downloads Panel.; r?paolo
MozReview-Commit-ID: DyTisE3dX1A
--- a/browser/components/downloads/content/allDownloadsViewOverlay.js
+++ b/browser/components/downloads/content/allDownloadsViewOverlay.js
@@ -1290,16 +1290,17 @@ DownloadsPlacesView.prototype = {
return false;
}
// Set the state attribute so that only the appropriate items are displayed.
let contextMenu = document.getElementById("downloadsContextMenu");
let download = element._shell.download;
contextMenu.setAttribute("state",
DownloadsCommon.stateOfDownload(download));
+ contextMenu.setAttribute("exists", "true");
contextMenu.classList.toggle("temporary-block",
!!download.hasBlockedData);
if (!download.stopped) {
// The hasPartialData property of a download may change at any time after
// it has started, so ensure we update the related command now.
goUpdateCommand("downloadsCmd_pauseResume");
}
--- a/browser/components/downloads/content/allDownloadsViewOverlay.xul
+++ b/browser/components/downloads/content/allDownloadsViewOverlay.xul
@@ -85,28 +85,20 @@
<menuitem command="downloadsCmd_pauseResume"
class="downloadPauseMenuItem"
label="&cmd.pause.label;"
accesskey="&cmd.pause.accesskey;"/>
<menuitem command="downloadsCmd_pauseResume"
class="downloadResumeMenuItem"
label="&cmd.resume.label;"
accesskey="&cmd.resume.accesskey;"/>
- <menuitem command="downloadsCmd_cancel"
- class="downloadCancelMenuItem"
- label="&cmd.cancel.label;"
- accesskey="&cmd.cancel.accesskey;"/>
<menuitem command="downloadsCmd_unblock"
class="downloadUnblockMenuItem"
label="&cmd.unblock2.label;"
accesskey="&cmd.unblock2.accesskey;"/>
- <menuitem command="cmd_delete"
- class="downloadRemoveFromHistoryMenuItem"
- label="&cmd.removeFromHistory.label;"
- accesskey="&cmd.removeFromHistory.accesskey;"/>
<menuitem command="downloadsCmd_show"
class="downloadShowMenuItem"
#ifdef XP_MACOSX
label="&cmd.showMac.label;"
accesskey="&cmd.showMac.accesskey;"
#else
label="&cmd.show.label;"
accesskey="&cmd.show.accesskey;"
@@ -119,13 +111,17 @@
label="&cmd.goToDownloadPage.label;"
accesskey="&cmd.goToDownloadPage.accesskey;"/>
<menuitem command="cmd_copy"
label="&cmd.copyDownloadLink.label;"
accesskey="&cmd.copyDownloadLink.accesskey;"/>
<menuseparator/>
+ <menuitem command="cmd_delete"
+ class="downloadRemoveFromHistoryMenuItem"
+ label="&cmd.removeFromHistory.label;"
+ accesskey="&cmd.removeFromHistory.accesskey;"/>
<menuitem command="downloadsCmd_clearDownloads"
label="&cmd.clearDownloads.label;"
accesskey="&cmd.clearDownloads.accesskey;"/>
</menupopup>
</overlay>
--- a/browser/components/downloads/content/downloads.css
+++ b/browser/components/downloads/content/downloads.css
@@ -91,36 +91,44 @@ richlistitem.download button {
/* Blocked (dirty) downloads that have not been confirmed and
have temporary data. */
.download-state:not( [state="8"] /* Blocked (dirty) */)
.downloadUnblockMenuItem,
.download-state[state="8"]:not(.temporary-block)
.downloadUnblockMenuItem,
-.download-state:not(:-moz-any([state="2"], /* Failed */
- [state="4"]) /* Paused */)
- .downloadCancelMenuItem,
-
.download-state:not(:-moz-any([state="1"], /* Finished */
[state="2"], /* Failed */
[state="3"], /* Canceled */
[state="6"], /* Blocked (parental) */
[state="8"], /* Blocked (dirty) */
[state="9"]) /* Blocked (policy) */)
.downloadRemoveFromHistoryMenuItem,
.download-state:not(:-moz-any([state="-1"],/* Starting (initial) */
[state="0"], /* Downloading */
[state="1"], /* Finished */
[state="4"], /* Paused */
[state="5"]) /* Starting (queued) */)
.downloadShowMenuItem,
+.download-state[state="1"]:not([exists])
+ .downloadShowMenuItem,
-.download-state[state="7"] .downloadCommandsSeparator
+.download-state:not(:-moz-any([state="-1"],/* Starting (initial) */
+ [state="0"], /* Downloading */
+ [state="1"], /* Finished */
+ [state="4"], /* Paused */
+ [state="5"], /* Starting (queued) */
+ [state="8"]) /* Blocked (dirty) */)
+ .downloadCommandsSeparator,
+.download-state[state="1"]:not([exists])
+ .downloadCommandsSeparator,
+.download-state[state="8"]:not(.temporary-block)
+ .downloadCommandsSeparator
{
display: none;
}
/*** Visibility of download buttons ***/
.download-state:not(:-moz-any([state="-1"],/* Starting (initial) */
--- a/browser/components/downloads/content/downloads.js
+++ b/browser/components/downloads/content/downloads.js
@@ -1028,16 +1028,21 @@ const DownloadsView = {
return;
}
DownloadsViewController.updateCommands();
// Set the state attribute so that only the appropriate items are displayed.
let contextMenu = document.getElementById("downloadsContextMenu");
contextMenu.setAttribute("state", element.getAttribute("state"));
+ if (element.hasAttribute("exists")) {
+ contextMenu.setAttribute("exists", "true");
+ } else {
+ contextMenu.removeAttribute("exists");
+ }
contextMenu.classList.toggle("temporary-block",
element.classList.contains("temporary-block"));
},
onDownloadDragStart(aEvent) {
let element = this.richListBox.selectedItem;
if (!element) {
return;
--- a/browser/components/downloads/content/downloadsOverlay.xul
+++ b/browser/components/downloads/content/downloadsOverlay.xul
@@ -64,28 +64,20 @@
<menuitem command="downloadsCmd_pauseResume"
class="downloadPauseMenuItem"
label="&cmd.pause.label;"
accesskey="&cmd.pause.accesskey;"/>
<menuitem command="downloadsCmd_pauseResume"
class="downloadResumeMenuItem"
label="&cmd.resume.label;"
accesskey="&cmd.resume.accesskey;"/>
- <menuitem command="downloadsCmd_cancel"
- class="downloadCancelMenuItem"
- label="&cmd.cancel.label;"
- accesskey="&cmd.cancel.accesskey;"/>
<menuitem command="downloadsCmd_unblock"
class="downloadUnblockMenuItem"
label="&cmd.unblock2.label;"
accesskey="&cmd.unblock2.accesskey;"/>
- <menuitem command="cmd_delete"
- class="downloadRemoveFromHistoryMenuItem"
- label="&cmd.removeFromHistory.label;"
- accesskey="&cmd.removeFromHistory.accesskey;"/>
<menuitem command="downloadsCmd_show"
class="downloadShowMenuItem"
#ifdef XP_MACOSX
label="&cmd.showMac.label;"
accesskey="&cmd.showMac.accesskey;"
#else
label="&cmd.show.label;"
accesskey="&cmd.show.accesskey;"
@@ -98,16 +90,20 @@
label="&cmd.goToDownloadPage.label;"
accesskey="&cmd.goToDownloadPage.accesskey;"/>
<menuitem command="downloadsCmd_copyLocation"
label="&cmd.copyDownloadLink.label;"
accesskey="&cmd.copyDownloadLink.accesskey;"/>
<menuseparator/>
+ <menuitem command="cmd_delete"
+ class="downloadRemoveFromHistoryMenuItem"
+ label="&cmd.removeFromHistory.label;"
+ accesskey="&cmd.removeFromHistory.accesskey;"/>
<menuitem command="downloadsCmd_clearList"
label="&cmd.clearList2.label;"
accesskey="&cmd.clearList2.accesskey;"/>
</menupopup>
<panelmultiview id="downloadsPanel-multiView"
mainViewId="downloadsPanel-mainView"
align="stretch">
--- a/browser/locales/en-US/chrome/browser/downloads/downloads.dtd
+++ b/browser/locales/en-US/chrome/browser/downloads/downloads.dtd
@@ -40,17 +40,16 @@
-->
<!ENTITY downloadsSummary.minWidth2 "21ch">
<!ENTITY cmd.pause.label "Pause">
<!ENTITY cmd.pause.accesskey "P">
<!ENTITY cmd.resume.label "Resume">
<!ENTITY cmd.resume.accesskey "R">
<!ENTITY cmd.cancel.label "Cancel">
-<!ENTITY cmd.cancel.accesskey "C">
<!-- LOCALIZATION NOTE (cmd.show.label, cmd.show.accesskey, cmd.showMac.label,
cmd.showMac.accesskey):
The show and showMac commands are never shown together, thus they can share
the same access key (though the two access keys can also be different).
-->
<!ENTITY cmd.show.label "Open Containing Folder">
<!ENTITY cmd.show.accesskey "F">
<!ENTITY cmd.showMac.label "Show In Finder">