diff --git a/mozilla/browser/components/downloads/content/downloadPanel.js b/mozilla/browser/components/downloads/content/downloadPanel.js index 0e58f515e2a..39315a5b382 100644 --- a/mozilla/browser/components/downloads/content/downloadPanel.js +++ b/mozilla/browser/components/downloads/content/downloadPanel.js @@ -122,8 +122,8 @@ var downloadViewController = { var selectedItem = gDownloadHistoryView.selectedItem; switch (aCommand) { case "cmd_openfile": - return selectionCount == 1; case "cmd_showinshell": + case "cmd_properties": return selectionCount == 1; case "cmd_remove": return selectionCount; @@ -163,6 +163,11 @@ var downloadViewController = { file.reveal(); } break; + case "cmd_properties": + selectedItem = gDownloadHistoryView.selectedItem; + window.openDialog("chrome://browser/content/downloads/downloadProperties.xul", + "_blank", "modal,centerscreen,chrome,resizable=no", selectedItem.id); + break; case "cmd_remove": selectedItems = gDownloadHistoryView.selectedItems; var selectedIndex = gDownloadHistoryView.selectedIndex; @@ -240,9 +245,13 @@ function buildContextMenu() var launchSep = document.getElementById("menuseparator_launch"); var removeItem = document.getElementById("menuitem_remove"); var showItem = document.getElementById("menuitem_show"); + var propsItem = document.getElementByid("menuitem_properties"); + var propsSep = document.getElementById("menuseparator_properties"); showItem.hidden = selectionCount != 1; launchItem.hidden = selectionCount != 1; launchSep.hidden = selectionCount != 1; + propsItem.hidden = selectionCount != 1; + propsSep.hidden = selectionCoun != 1; return true; } diff --git a/mozilla/browser/components/downloads/content/downloadPanel.xul b/mozilla/browser/components/downloads/content/downloadPanel.xul index e21666fa6a4..9f470b30eae 100644 --- a/mozilla/browser/components/downloads/content/downloadPanel.xul +++ b/mozilla/browser/components/downloads/content/downloadPanel.xul @@ -44,6 +44,9 @@ + + diff --git a/mozilla/browser/components/downloads/content/downloadProperties.js b/mozilla/browser/components/downloads/content/downloadProperties.js new file mode 100644 index 00000000000..6e42322f254 --- /dev/null +++ b/mozilla/browser/components/downloads/content/downloadProperties.js @@ -0,0 +1,34 @@ +function Startup() +{ + const NC_NS = "http://home.netscape.com/NC-rdf#"; + const rdfSvcContractID = "@mozilla.org/rdf/rdf-service;1"; + const rdfSvcIID = Components.interfaces.nsIRDFService; + var rdfService = Components.classes[rdfSvcContractID].getService(rdfSvcIID); + + const dlmgrContractID = "@mozilla.org/download-manager;1"; + const dlmgrIID = Components.interfaces.nsIDownloadManager; + var downloadMgr = Components.classes[dlmgrContractID].getService(dlmgrIID); + var ds = downloadMgr.datasource; + + const dateTimeContractID = "@mozilla.org/intl/scriptabledateformat;1"; + const dateTimeIID = Components.interfaces.nsIScriptableDateFormat; + var dateTimeService = Components.classes[dateTimeContractID].getService(dateTimeIID); + + var resource = rdfService.GetResource(window.arguments[0]); + var dateStartedRes = rdfService.GetResource(NC_NS + "DateStarted"); + var dateEndedRes = rdfService.GetResource(NC_NS + "DateEnded"); + + var dateStartedField = document.getElementById("dateStarted"); + var dateEndedField = document.getElementById("dateEnded"); + + var dateStarted = ds.GetTarget(resource, dateStartedRes, true).QueryInterface(Components.interfaces.nsIRDFDate).Value; + var dateEnded = ds.GetTarget(resource, dateStartedRes, true).QueryInterface(Components.interfaces.nsIRDFDate).Value; + dateStarted = new Date(dateStarted/1000); + dateStarted = dateTimeService.FormatDateTime("", dateTimeService.dateFormatShort, dateTimeService.timeFormatSeconds, dateStarted.getFullYear(), dateStarted.getMonth()+1, dateStarted.getDate(), dateStarted.getHours(), dateStarted.getMinutes(), dateStarted.getSeconds()); + dateEnded = new Date(dateEnded/1000); + dateEnded = dateTimeService.FormatDateTime("", dateTimeService.dateFormatShort, dateTimeService.timeFormatSeconds, dateEnded.getFullYear(), dateEnded.getMonth()+1, dateEnded.getDate(), dateEnded.getHours(), dateEnded.getMinutes(), dateEnded.getSeconds()); + + dateStartedField.setAttribute("value", dateStarted); + dateEndedField.setAttribute("value", dateEnded); +} + \ No newline at end of file diff --git a/mozilla/browser/components/downloads/content/downloadProperties.xul b/mozilla/browser/components/downloads/content/downloadProperties.xul new file mode 100644 index 00000000000..18c907c5857 --- /dev/null +++ b/mozilla/browser/components/downloads/content/downloadProperties.xul @@ -0,0 +1,41 @@ + + + + +%downloadPropertiesDTD; +]> + + + +