From 62fdcab789a90c0d938336dd83c4965721af77be Mon Sep 17 00:00:00 2001 From: Marco Bonardo Date: Fri, 28 Dec 2012 00:54:51 +0100 Subject: [PATCH] Bug 822848 - hide the detailsPane for the new downloads view. r=Mano --- .../content/allDownloadsViewOverlay.js | 4 +- .../places/content/downloadsViewOverlay.xul | 3 +- browser/components/places/content/places.js | 38 +++++++++++++++++-- 3 files changed, 38 insertions(+), 7 deletions(-) diff --git a/browser/components/downloads/content/allDownloadsViewOverlay.js b/browser/components/downloads/content/allDownloadsViewOverlay.js index b6a78618f51..63cfdd7f9d8 100644 --- a/browser/components/downloads/content/allDownloadsViewOverlay.js +++ b/browser/components/downloads/content/allDownloadsViewOverlay.js @@ -884,8 +884,8 @@ DownloadsPlacesView.prototype = { let placesNodes = []; let selectedElements = this._richlistbox.selectedItems; for (let elt of selectedElements) { - if (elt.placesNode) - placesNodes.push(elt.placesNode); + if (elt._shell.placesNode) + placesNodes.push(elt._shell.placesNode); } return placesNodes; }, diff --git a/browser/components/places/content/downloadsViewOverlay.xul b/browser/components/places/content/downloadsViewOverlay.xul index a81827cfcc1..55e0af08019 100644 --- a/browser/components/places/content/downloadsViewOverlay.xul +++ b/browser/components/places/content/downloadsViewOverlay.xul @@ -14,7 +14,8 @@ Components.interfaces.nsINavHistoryQueryOptions.SORT_BY_DATE_DESCENDING; ContentArea.setContentViewForQueryString(DOWNLOADS_QUERY, - function() new DownloadsPlacesView(document.getElementById("downloadsRichListBox"))); + function() new DownloadsPlacesView(document.getElementById("downloadsRichListBox")), + { showDetailsPane: false }); ]]> diff --git a/browser/components/places/content/places.js b/browser/components/places/content/places.js index c70f04bccb8..835568c398c 100644 --- a/browser/components/places/content/places.js +++ b/browser/components/places/content/places.js @@ -274,6 +274,13 @@ var PlacesOrganizer = { * Handle focus changes on the places list and the current content view. */ updateDetailsPane: function PO_updateDetailsPane() { + let detailsDeck = document.getElementById("detailsDeck"); + let detailsPaneDisabled = detailsDeck.hidden = + !ContentArea.currentViewOptions.showDetailsPane; + if (detailsPaneDisabled) { + return; + } + let view = PlacesUIUtils.getViewForNode(document.activeElement); if (view) { let selectedNodes = view.selectedNode ? @@ -1261,10 +1268,10 @@ let ContentArea = { function CA_getContentViewForQueryString(aQueryString) { try { if (this._specialViews.has(aQueryString)) { - let view = this._specialViews.get(aQueryString); + let { view, options } = this._specialViews.get(aQueryString); if (typeof view == "function") { view = view(); - this._specialViews.set(aQueryString, view); + this._specialViews.set(aQueryString, { view: view, options: options }); } return view; } @@ -1283,14 +1290,18 @@ let ContentArea = { * @param aView * Either the custom view or a function that will return the view * the first (and only) time it's called. + * @param [optional] aOptions + * Object defining special options for the view. + * @see ContentTree.viewOptions for supported options and default values. */ setContentViewForQueryString: - function CA_setContentViewForQueryString(aQueryString, aView) { + function CA_setContentViewForQueryString(aQueryString, aView, aOptions) { if (!aQueryString || typeof aView != "object" && typeof aView != "function") throw new Error("Invalid arguments"); - this._specialViews.set(aQueryString, aView); + this._specialViews.set(aQueryString, { view: aView, + options: aOptions || new Object() }); }, get currentView() PlacesUIUtils.getViewForNode(this._deck.selectedPanel), @@ -1307,6 +1318,23 @@ let ContentArea = { return aQueryString; }, + /** + * Options for the current view. + * + * @see ContentTree.viewOptions for supported options and default values. + */ + get currentViewOptions() { + // Use ContentTree options as default. + let viewOptions = ContentTree.viewOptions; + if (this._specialViews.has(this.currentPlace)) { + let { view, options } = this._specialViews.get(this.currentPlace); + for (let option in options) { + viewOptions[option] = options[option]; + } + } + return viewOptions; + }, + focus: function() { this._deck.selectedPanel.focus(); } @@ -1319,6 +1347,8 @@ let ContentTree = { get view() this._view, + get viewOptions() Object.seal({ showDetailsPane: true }), + openSelectedNode: function CT_openSelectedNode(aEvent) { let view = this.view; PlacesUIUtils.openNodeWithEvent(view.selectedNode, aEvent, view);