mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 405774 - Using the Arrows to navigate 'Back' - folder does not follow along. r=dietrich.
This commit is contained in:
parent
be60a525fc
commit
20e22bb838
@ -64,6 +64,9 @@ var PlacesOrganizer = {
|
||||
leftPaneSelection = window.arguments[0];
|
||||
|
||||
this.selectLeftPaneQuery(leftPaneSelection);
|
||||
// clear the back-stack
|
||||
this._backHistory.splice(0);
|
||||
document.getElementById("OrganizerCommand:Back").setAttribute("disabled", true);
|
||||
|
||||
var view = this._content.treeBoxObject.view;
|
||||
if (view.rowCount > 0)
|
||||
@ -101,15 +104,21 @@ var PlacesOrganizer = {
|
||||
},
|
||||
|
||||
set location(aLocation) {
|
||||
LOG("Node URI: " + aLocation);
|
||||
|
||||
if (!aLocation)
|
||||
if (!aLocation || this._location == aLocation)
|
||||
return aLocation;
|
||||
|
||||
if (this.location)
|
||||
if (this.location) {
|
||||
this._backHistory.unshift(this.location);
|
||||
this._forwardHistory.splice(0);
|
||||
}
|
||||
|
||||
this._content.place = this._location = aLocation;
|
||||
this._location = aLocation;
|
||||
this._places.selectPlaceURI(aLocation);
|
||||
|
||||
if (!this._places.hasSelection) {
|
||||
// If no node was found for the given place: uri, just load it directly
|
||||
this._content.place = aLocation;
|
||||
}
|
||||
this.onContentTreeSelect();
|
||||
|
||||
// update navigation commands
|
||||
@ -127,6 +136,7 @@ var PlacesOrganizer = {
|
||||
|
||||
_backHistory: [],
|
||||
_forwardHistory: [],
|
||||
|
||||
back: function PO_back() {
|
||||
this._forwardHistory.unshift(this.location);
|
||||
var historyEntry = this._backHistory.shift();
|
||||
@ -134,7 +144,9 @@ var PlacesOrganizer = {
|
||||
this.location = historyEntry;
|
||||
},
|
||||
forward: function PO_forward() {
|
||||
this._backHistory.unshift(this.location);
|
||||
var historyEntry = this._forwardHistory.shift();
|
||||
this._location = null;
|
||||
this.location = historyEntry;
|
||||
},
|
||||
|
||||
@ -145,22 +157,24 @@ var PlacesOrganizer = {
|
||||
* be left alone.
|
||||
*/
|
||||
onPlaceSelected: function PO_onPlaceSelected(resetSearchBox) {
|
||||
// Don't change the right-hand pane contents when there's no selection
|
||||
if (!this._places.hasSelection)
|
||||
return;
|
||||
|
||||
var node = asQuery(this._places.selectedNode);
|
||||
|
||||
var queries = node.getQueries({});
|
||||
var node = this._places.selectedNode;
|
||||
var queries = asQuery(node).getQueries({});
|
||||
|
||||
// Items are only excluded on the left pane
|
||||
var options = node.queryOptions.clone();
|
||||
options.excludeItems = false;
|
||||
var placeURI = PlacesUtils.history.queriesToQueryString(queries, queries.length, options);
|
||||
|
||||
// clear forward history
|
||||
this._forwardHistory.splice(0);
|
||||
// update the right-pane contents
|
||||
this._content.place = placeURI;
|
||||
|
||||
// update location
|
||||
this.location = PlacesUtils.history.queriesToQueryString(queries, queries.length, options);
|
||||
// This just updates the back/forward buttons, it doesn't call us back
|
||||
// because node.uri is our current selection.
|
||||
this.location = node.uri;
|
||||
|
||||
// Make sure the search UI is hidden.
|
||||
PlacesSearchBox.hideSearchUI();
|
||||
|
@ -180,6 +180,10 @@
|
||||
<method name="selectPlaceURI">
|
||||
<parameter name="placeURI"/>
|
||||
<body><![CDATA[
|
||||
// Do nothing if a node matching the given uri is already selected
|
||||
if (this.hasSelection && this.selectedNode.uri == placeURI)
|
||||
return;
|
||||
|
||||
function findNode(container, placeURI, nodesURIChecked) {
|
||||
var containerURI = container.uri;
|
||||
if (containerURI == placeURI)
|
||||
@ -190,7 +194,9 @@
|
||||
// never check the contents of the same query
|
||||
nodesURIChecked.push(containerURI);
|
||||
|
||||
container.containerOpen = true;
|
||||
var wasOpen = container.containerOpen;
|
||||
if (!wasOpen)
|
||||
container.containerOpen = true;
|
||||
for (var i = 0; i < container.childCount; ++i) {
|
||||
var child = container.getChild(i);
|
||||
var childURI = child.uri;
|
||||
@ -202,29 +208,29 @@
|
||||
return nested;
|
||||
}
|
||||
}
|
||||
container.containerOpen = false;
|
||||
|
||||
if (!wasOpen)
|
||||
container.containerOpen = false;
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
var container = this._getRootNode();
|
||||
|
||||
var container = this.getResultNode();
|
||||
NS_ASSERT(container, "No result, cannot select place URI!");
|
||||
if (!container)
|
||||
return;
|
||||
|
||||
var child = findNode(container, placeURI, []);
|
||||
container.containerOpen = true;
|
||||
if (child)
|
||||
this.selectNode(child);
|
||||
else {
|
||||
// If the specified child could not be located, just select the first
|
||||
// item in the list.
|
||||
if (this.view.rowCount)
|
||||
this.view.selection.select(0);
|
||||
// If the specified child could not be located, clear the selection
|
||||
var selection = this.view.selection;
|
||||
selection.clearSelection();
|
||||
}
|
||||
]]></body>
|
||||
</method>
|
||||
|
||||
|
||||
<!--
|
||||
Causes a particular node to be selected in the tree, resulting in all
|
||||
containers above the node in the hierarchy to be opened, so that the
|
||||
@ -233,34 +239,36 @@
|
||||
<method name="selectNode">
|
||||
<parameter name="node"/>
|
||||
<body><![CDATA[
|
||||
var view = this.getResultView();
|
||||
|
||||
var parent = node.parent;
|
||||
|
||||
// Build a list of all of the nodes that are the parent of this one
|
||||
// in the result.
|
||||
var parents = [];
|
||||
var root = this._getRootNode();
|
||||
while (parent && parent != root) {
|
||||
parents.push(parent);
|
||||
parent = parent.parent;
|
||||
if (parent && !parent.containerOpen) {
|
||||
// Build a list of all of the nodes that are the parent of this one
|
||||
// in the result.
|
||||
var parents = [];
|
||||
var root = this.getResultNode();
|
||||
while (parent && parent != root) {
|
||||
parents.push(parent);
|
||||
parent = parent.parent;
|
||||
}
|
||||
|
||||
// Walk the list backwards (opening from the root of the hierarchy)
|
||||
// opening each folder as we go.
|
||||
for (var i = parents.length - 1; i >= 0; --i) {
|
||||
var index = view.treeIndexForNode(parents[i]);
|
||||
if (view.isContainer(index) && !view.isContainerOpen(index))
|
||||
view.toggleOpenState(index);
|
||||
}
|
||||
// Select the specified node...
|
||||
}
|
||||
|
||||
// Walk the list backwards (opening from the root of the hierarchy)
|
||||
// opening each folder as we go.
|
||||
var resultview = this.getResultView();
|
||||
var view = this.view;
|
||||
for (var i = parents.length - 1; i >= 0; --i) {
|
||||
var index = resultview.treeIndexForNode(parents[i]);
|
||||
if (view.isContainer(index) && !view.isContainerOpen(index))
|
||||
view.toggleOpenState(index);
|
||||
}
|
||||
// Select the specified node...
|
||||
index = resultview.treeIndexForNode(node);
|
||||
|
||||
var index = view.treeIndexForNode(node);
|
||||
view.selection.select(index);
|
||||
// ... and ensure it's visible, not scrolled off somewhere.
|
||||
this.treeBoxObject.ensureRowIsVisible(index);
|
||||
]]></body>
|
||||
</method>
|
||||
|
||||
|
||||
<!-- nsIPlacesView -->
|
||||
<method name="getResult">
|
||||
<body><![CDATA[
|
||||
|
Loading…
Reference in New Issue
Block a user