mirror of
https://repo.dactyloidae.xyz/Dactyloidae/UXP.git
synced 2026-10-28 01:57:30 +09:00
[PALEMOON] Bug 1116176 - Create DownloadsHistoryDataItem and HistoryDownload objects
This commit is contained in:
parent
23f4f8a235
commit
67f36036d3
3 changed files with 393 additions and 422 deletions
|
|
@ -8,6 +8,7 @@
|
||||||
|
|
||||||
this.EXPORTED_SYMBOLS = [
|
this.EXPORTED_SYMBOLS = [
|
||||||
"DownloadsCommon",
|
"DownloadsCommon",
|
||||||
|
"DownloadsDataItem",
|
||||||
];
|
];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -25,10 +26,9 @@ this.EXPORTED_SYMBOLS = [
|
||||||
* to build a consistent view of the available data.
|
* to build a consistent view of the available data.
|
||||||
*
|
*
|
||||||
* DownloadsDataItem
|
* DownloadsDataItem
|
||||||
* Represents a single item in the list of downloads. This object either wraps
|
* Represents a single item in the list of downloads. This object wraps the
|
||||||
* an existing nsIDownload from the Download Manager, or provides the same
|
* Download object from the JavaScript API for downloads. A specialized version
|
||||||
* information read directly from the downloads database, with the possibility
|
* of this object is implemented in the Places front-end view.
|
||||||
* of querying the nsIDownload lazily, for performance reasons.
|
|
||||||
*
|
*
|
||||||
* DownloadsIndicatorData
|
* DownloadsIndicatorData
|
||||||
* This object registers itself with DownloadsData as a view, and transforms the
|
* This object registers itself with DownloadsData as a view, and transforms the
|
||||||
|
|
|
||||||
File diff suppressed because it is too large
Load diff
|
|
@ -880,10 +880,10 @@ const DownloadsView = {
|
||||||
},
|
},
|
||||||
|
|
||||||
// DownloadsView
|
// DownloadsView
|
||||||
onDataItemStateChanged(aDataItem, aOldState) {
|
onDataItemStateChanged(aDataItem) {
|
||||||
let viewItem = this._visibleViewItems.get(aDataItem);
|
let viewItem = this._visibleViewItems.get(aDataItem);
|
||||||
if (viewItem) {
|
if (viewItem) {
|
||||||
viewItem.onStateChanged(aOldState);
|
viewItem.onStateChanged();
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
@ -1126,16 +1126,14 @@ DownloadsViewItem.prototype = {
|
||||||
* the download might be the same as before, if the data layer received
|
* the download might be the same as before, if the data layer received
|
||||||
* multiple events for the same download.
|
* multiple events for the same download.
|
||||||
*/
|
*/
|
||||||
onStateChanged(aOldState) {
|
onStateChanged() {
|
||||||
{
|
|
||||||
// If a download just finished successfully, it means that the target file
|
// If a download just finished successfully, it means that the target file
|
||||||
// now exists and we can extract its specific icon. To ensure that the icon
|
// now exists and we can extract its specific icon. To ensure that the icon
|
||||||
// is reloaded, we must change the URI used by the XUL image element, for
|
// is reloaded, we must change the URI used by the XUL image element, for
|
||||||
// example by adding a query parameter. Since this URI has a "moz-icon"
|
// example by adding a query parameter. Since this URI has a "moz-icon"
|
||||||
// scheme, this only works if we add one of the parameters explicitly
|
// scheme, this only works if we add one of the parameters explicitly
|
||||||
// supported by the nsIMozIconURI interface.
|
// supported by the nsIMozIconURI interface.
|
||||||
if (aOldState != Ci.nsIDownloadManager.DOWNLOAD_FINISHED &&
|
if (this.dataItem.state == Ci.nsIDownloadManager.DOWNLOAD_FINISHED) {
|
||||||
aOldState != this.dataItem.state) {
|
|
||||||
this._element.setAttribute("image", this.image + "&state=normal");
|
this._element.setAttribute("image", this.image + "&state=normal");
|
||||||
|
|
||||||
// We assume the existence of the target of a download that just completed
|
// We assume the existence of the target of a download that just completed
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue