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 placesNodes = [];
let selectedElements = this._richlistbox.selectedItems; let selectedElements = this._richlistbox.selectedItems;
for (let elt of selectedElements) { for (let elt of selectedElements) {
if (elt.placesNode) if (elt._shell.placesNode)
placesNodes.push(elt.placesNode); placesNodes.push(elt._shell.placesNode);
} }
return placesNodes; return placesNodes;
}, },

View File

@ -14,7 +14,8 @@
Components.interfaces.nsINavHistoryQueryOptions.SORT_BY_DATE_DESCENDING; Components.interfaces.nsINavHistoryQueryOptions.SORT_BY_DATE_DESCENDING;
ContentArea.setContentViewForQueryString(DOWNLOADS_QUERY, ContentArea.setContentViewForQueryString(DOWNLOADS_QUERY,
function() new DownloadsPlacesView(document.getElementById("downloadsRichListBox"))); function() new DownloadsPlacesView(document.getElementById("downloadsRichListBox")),
{ showDetailsPane: false });
]]></script> ]]></script>
<window id="places"> <window id="places">

View File

@ -274,6 +274,13 @@ var PlacesOrganizer = {
* Handle focus changes on the places list and the current content view. * Handle focus changes on the places list and the current content view.
*/ */
updateDetailsPane: function PO_updateDetailsPane() { 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); let view = PlacesUIUtils.getViewForNode(document.activeElement);
if (view) { if (view) {
let selectedNodes = view.selectedNode ? let selectedNodes = view.selectedNode ?
@ -1261,10 +1268,10 @@ let ContentArea = {
function CA_getContentViewForQueryString(aQueryString) { function CA_getContentViewForQueryString(aQueryString) {
try { try {
if (this._specialViews.has(aQueryString)) { if (this._specialViews.has(aQueryString)) {
let view = this._specialViews.get(aQueryString); let { view, options } = this._specialViews.get(aQueryString);
if (typeof view == "function") { if (typeof view == "function") {
view = view(); view = view();
this._specialViews.set(aQueryString, view); this._specialViews.set(aQueryString, { view: view, options: options });
} }
return view; return view;
} }
@ -1283,14 +1290,18 @@ let ContentArea = {
* @param aView * @param aView
* Either the custom view or a function that will return the view * Either the custom view or a function that will return the view
* the first (and only) time it's called. * 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: setContentViewForQueryString:
function CA_setContentViewForQueryString(aQueryString, aView) { function CA_setContentViewForQueryString(aQueryString, aView, aOptions) {
if (!aQueryString || if (!aQueryString ||
typeof aView != "object" && typeof aView != "function") typeof aView != "object" && typeof aView != "function")
throw new Error("Invalid arguments"); 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), get currentView() PlacesUIUtils.getViewForNode(this._deck.selectedPanel),
@ -1307,6 +1318,23 @@ let ContentArea = {
return aQueryString; 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() { focus: function() {
this._deck.selectedPanel.focus(); this._deck.selectedPanel.focus();
} }
@ -1319,6 +1347,8 @@ let ContentTree = {
get view() this._view, get view() this._view,
get viewOptions() Object.seal({ showDetailsPane: true }),
openSelectedNode: function CT_openSelectedNode(aEvent) { openSelectedNode: function CT_openSelectedNode(aEvent) {
let view = this.view; let view = this.view;
PlacesUIUtils.openNodeWithEvent(view.selectedNode, aEvent, view); PlacesUIUtils.openNodeWithEvent(view.selectedNode, aEvent, view);