Bug 822848 - hide the detailsPane for the new downloads view.

r=Mano
This commit is contained in:
Marco Bonardo 2012-12-28 00:54:51 +01:00
parent 427c86fcc4
commit 62fdcab789
3 changed files with 38 additions and 7 deletions

View File

@ -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;
},

View File

@ -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 });
]]></script>
<window id="places">

View File

@ -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);