mirror of
https://repo.dactyloidae.xyz/Dactyloidae/UXP.git
synced 2026-10-19 13:47:31 +09:00
Revert "[PALEMOON] Use Components.interfaces directly in controller.js, history-panel.js, and treeView.js"
This reverts commit 8e9e05da3d770daab326621b0ce42eb15d1cb740.
This commit is contained in:
parent
b36083b4ec
commit
de8779303a
3 changed files with 91 additions and 91 deletions
|
|
@ -64,7 +64,7 @@ InsertionPoint.prototype = {
|
||||||
// If dropNearItemId is set up we must calculate the real index of
|
// If dropNearItemId is set up we must calculate the real index of
|
||||||
// the item near which we will drop.
|
// the item near which we will drop.
|
||||||
var index = PlacesUtils.bookmarks.getItemIndex(this.dropNearItemId);
|
var index = PlacesUtils.bookmarks.getItemIndex(this.dropNearItemId);
|
||||||
return this.orientation == Components.interfaces.nsITreeView.DROP_BEFORE ? index : index + 1;
|
return this.orientation == Ci.nsITreeView.DROP_BEFORE ? index : index + 1;
|
||||||
}
|
}
|
||||||
return this._index;
|
return this._index;
|
||||||
}
|
}
|
||||||
|
|
@ -80,7 +80,7 @@ function PlacesController(aView) {
|
||||||
"@mozilla.org/widget/clipboard;1",
|
"@mozilla.org/widget/clipboard;1",
|
||||||
"nsIClipboard");
|
"nsIClipboard");
|
||||||
XPCOMUtils.defineLazyGetter(this, "profileName", function () {
|
XPCOMUtils.defineLazyGetter(this, "profileName", function () {
|
||||||
return Services.dirsvc.get("ProfD", Components.interfaces.nsIFile).leafName;
|
return Services.dirsvc.get("ProfD", Ci.nsIFile).leafName;
|
||||||
});
|
});
|
||||||
|
|
||||||
this._cachedLivemarkInfoObjects = new Map();
|
this._cachedLivemarkInfoObjects = new Map();
|
||||||
|
|
@ -93,7 +93,7 @@ PlacesController.prototype = {
|
||||||
_view: null,
|
_view: null,
|
||||||
|
|
||||||
QueryInterface: XPCOMUtils.generateQI([
|
QueryInterface: XPCOMUtils.generateQI([
|
||||||
Components.interfaces.nsIClipboardOwner
|
Ci.nsIClipboardOwner
|
||||||
]),
|
]),
|
||||||
|
|
||||||
// nsIClipboardOwner
|
// nsIClipboardOwner
|
||||||
|
|
@ -174,7 +174,7 @@ PlacesController.prototype = {
|
||||||
return this._canInsert() &&
|
return this._canInsert() &&
|
||||||
!PlacesUtils.asQuery(this._view.result.root).queryOptions.excludeItems &&
|
!PlacesUtils.asQuery(this._view.result.root).queryOptions.excludeItems &&
|
||||||
this._view.result.sortingMode ==
|
this._view.result.sortingMode ==
|
||||||
Components.interfaces.nsINavHistoryQueryOptions.SORT_BY_NONE;
|
Ci.nsINavHistoryQueryOptions.SORT_BY_NONE;
|
||||||
case "placesCmd_show:info":
|
case "placesCmd_show:info":
|
||||||
var selectedNode = this._view.selectedNode;
|
var selectedNode = this._view.selectedNode;
|
||||||
return selectedNode && PlacesUtils.getConcreteItemId(selectedNode) != -1
|
return selectedNode && PlacesUtils.getConcreteItemId(selectedNode) != -1
|
||||||
|
|
@ -188,7 +188,7 @@ PlacesController.prototype = {
|
||||||
PlacesUtils.nodeIsFolder(selectedNode) &&
|
PlacesUtils.nodeIsFolder(selectedNode) &&
|
||||||
!PlacesUIUtils.isContentsReadOnly(selectedNode) &&
|
!PlacesUIUtils.isContentsReadOnly(selectedNode) &&
|
||||||
this._view.result.sortingMode ==
|
this._view.result.sortingMode ==
|
||||||
Components.interfaces.nsINavHistoryQueryOptions.SORT_BY_NONE;
|
Ci.nsINavHistoryQueryOptions.SORT_BY_NONE;
|
||||||
case "placesCmd_createBookmark":
|
case "placesCmd_createBookmark":
|
||||||
var node = this._view.selectedNode;
|
var node = this._view.selectedNode;
|
||||||
return node && PlacesUtils.nodeIsURI(node) && node.itemId == -1;
|
return node && PlacesUtils.nodeIsURI(node) && node.itemId == -1;
|
||||||
|
|
@ -366,25 +366,25 @@ PlacesController.prototype = {
|
||||||
var clipboard = this.clipboard;
|
var clipboard = this.clipboard;
|
||||||
var hasPlacesData =
|
var hasPlacesData =
|
||||||
clipboard.hasDataMatchingFlavors(flavors, flavors.length,
|
clipboard.hasDataMatchingFlavors(flavors, flavors.length,
|
||||||
Components.interfaces.nsIClipboard.kGlobalClipboard);
|
Ci.nsIClipboard.kGlobalClipboard);
|
||||||
if (hasPlacesData)
|
if (hasPlacesData)
|
||||||
return this._view.insertionPoint != null;
|
return this._view.insertionPoint != null;
|
||||||
|
|
||||||
// if the clipboard doesn't have TYPE_X_MOZ_PLACE_* data, we also allow
|
// if the clipboard doesn't have TYPE_X_MOZ_PLACE_* data, we also allow
|
||||||
// pasting of valid "text/unicode" and "text/x-moz-url" data
|
// pasting of valid "text/unicode" and "text/x-moz-url" data
|
||||||
var xferable = Cc["@mozilla.org/widget/transferable;1"].
|
var xferable = Cc["@mozilla.org/widget/transferable;1"].
|
||||||
createInstance(Components.interfaces.nsITransferable);
|
createInstance(Ci.nsITransferable);
|
||||||
xferable.init(null);
|
xferable.init(null);
|
||||||
|
|
||||||
xferable.addDataFlavor(PlacesUtils.TYPE_X_MOZ_URL);
|
xferable.addDataFlavor(PlacesUtils.TYPE_X_MOZ_URL);
|
||||||
xferable.addDataFlavor(PlacesUtils.TYPE_UNICODE);
|
xferable.addDataFlavor(PlacesUtils.TYPE_UNICODE);
|
||||||
clipboard.getData(xferable, Components.interfaces.nsIClipboard.kGlobalClipboard);
|
clipboard.getData(xferable, Ci.nsIClipboard.kGlobalClipboard);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
// getAnyTransferData will throw if no data is available.
|
// getAnyTransferData will throw if no data is available.
|
||||||
var data = { }, type = { };
|
var data = { }, type = { };
|
||||||
xferable.getAnyTransferData(type, data, { });
|
xferable.getAnyTransferData(type, data, { });
|
||||||
data = data.value.QueryInterface(Components.interfaces.nsISupportsString).data;
|
data = data.value.QueryInterface(Ci.nsISupportsString).data;
|
||||||
if (type.value != PlacesUtils.TYPE_X_MOZ_URL &&
|
if (type.value != PlacesUtils.TYPE_X_MOZ_URL &&
|
||||||
type.value != PlacesUtils.TYPE_UNICODE)
|
type.value != PlacesUtils.TYPE_UNICODE)
|
||||||
return false;
|
return false;
|
||||||
|
|
@ -436,28 +436,28 @@ PlacesController.prototype = {
|
||||||
// We don't use the nodeIs* methods here to avoid going through the type
|
// We don't use the nodeIs* methods here to avoid going through the type
|
||||||
// property way too often
|
// property way too often
|
||||||
switch (nodeType) {
|
switch (nodeType) {
|
||||||
case Components.interfaces.nsINavHistoryResultNode.RESULT_TYPE_QUERY:
|
case Ci.nsINavHistoryResultNode.RESULT_TYPE_QUERY:
|
||||||
nodeData["query"] = true;
|
nodeData["query"] = true;
|
||||||
if (node.parent) {
|
if (node.parent) {
|
||||||
switch (PlacesUtils.asQuery(node.parent).queryOptions.resultType) {
|
switch (PlacesUtils.asQuery(node.parent).queryOptions.resultType) {
|
||||||
case Components.interfaces.nsINavHistoryQueryOptions.RESULTS_AS_SITE_QUERY:
|
case Ci.nsINavHistoryQueryOptions.RESULTS_AS_SITE_QUERY:
|
||||||
nodeData["host"] = true;
|
nodeData["host"] = true;
|
||||||
break;
|
break;
|
||||||
case Components.interfaces.nsINavHistoryQueryOptions.RESULTS_AS_DATE_SITE_QUERY:
|
case Ci.nsINavHistoryQueryOptions.RESULTS_AS_DATE_SITE_QUERY:
|
||||||
case Components.interfaces.nsINavHistoryQueryOptions.RESULTS_AS_DATE_QUERY:
|
case Ci.nsINavHistoryQueryOptions.RESULTS_AS_DATE_QUERY:
|
||||||
nodeData["day"] = true;
|
nodeData["day"] = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case Components.interfaces.nsINavHistoryResultNode.RESULT_TYPE_FOLDER:
|
case Ci.nsINavHistoryResultNode.RESULT_TYPE_FOLDER:
|
||||||
case Components.interfaces.nsINavHistoryResultNode.RESULT_TYPE_FOLDER_SHORTCUT:
|
case Ci.nsINavHistoryResultNode.RESULT_TYPE_FOLDER_SHORTCUT:
|
||||||
nodeData["folder"] = true;
|
nodeData["folder"] = true;
|
||||||
break;
|
break;
|
||||||
case Components.interfaces.nsINavHistoryResultNode.RESULT_TYPE_SEPARATOR:
|
case Ci.nsINavHistoryResultNode.RESULT_TYPE_SEPARATOR:
|
||||||
nodeData["separator"] = true;
|
nodeData["separator"] = true;
|
||||||
break;
|
break;
|
||||||
case Components.interfaces.nsINavHistoryResultNode.RESULT_TYPE_URI:
|
case Ci.nsINavHistoryResultNode.RESULT_TYPE_URI:
|
||||||
nodeData["link"] = true;
|
nodeData["link"] = true;
|
||||||
uri = NetUtil.newURI(node.uri);
|
uri = NetUtil.newURI(node.uri);
|
||||||
if (PlacesUtils.nodeIsBookmark(node)) {
|
if (PlacesUtils.nodeIsBookmark(node)) {
|
||||||
|
|
@ -1118,7 +1118,7 @@ PlacesController.prototype = {
|
||||||
else if (PlacesUtils.nodeIsTagQuery(node) && node.parent &&
|
else if (PlacesUtils.nodeIsTagQuery(node) && node.parent &&
|
||||||
PlacesUtils.nodeIsQuery(node.parent) &&
|
PlacesUtils.nodeIsQuery(node.parent) &&
|
||||||
PlacesUtils.asQuery(node.parent).queryOptions.resultType ==
|
PlacesUtils.asQuery(node.parent).queryOptions.resultType ==
|
||||||
Components.interfaces.nsINavHistoryQueryOptions.RESULTS_AS_TAG_QUERY) {
|
Ci.nsINavHistoryQueryOptions.RESULTS_AS_TAG_QUERY) {
|
||||||
// This is a tag container.
|
// This is a tag container.
|
||||||
// Untag all URIs tagged with this tag only if the tag container is
|
// Untag all URIs tagged with this tag only if the tag container is
|
||||||
// child of the "Tags" query in the library, in all other places we
|
// child of the "Tags" query in the library, in all other places we
|
||||||
|
|
@ -1133,7 +1133,7 @@ PlacesController.prototype = {
|
||||||
else if (PlacesUtils.nodeIsURI(node) &&
|
else if (PlacesUtils.nodeIsURI(node) &&
|
||||||
PlacesUtils.nodeIsQuery(node.parent) &&
|
PlacesUtils.nodeIsQuery(node.parent) &&
|
||||||
PlacesUtils.asQuery(node.parent).queryOptions.queryType ==
|
PlacesUtils.asQuery(node.parent).queryOptions.queryType ==
|
||||||
Components.interfaces.nsINavHistoryQueryOptions.QUERY_TYPE_HISTORY) {
|
Ci.nsINavHistoryQueryOptions.QUERY_TYPE_HISTORY) {
|
||||||
// This is a uri node inside an history query.
|
// This is a uri node inside an history query.
|
||||||
PlacesUtils.bhistory.removePage(NetUtil.newURI(node.uri));
|
PlacesUtils.bhistory.removePage(NetUtil.newURI(node.uri));
|
||||||
// History deletes are not undoable, so we don't have a transaction.
|
// History deletes are not undoable, so we don't have a transaction.
|
||||||
|
|
@ -1141,7 +1141,7 @@ PlacesController.prototype = {
|
||||||
else if (node.itemId == -1 &&
|
else if (node.itemId == -1 &&
|
||||||
PlacesUtils.nodeIsQuery(node) &&
|
PlacesUtils.nodeIsQuery(node) &&
|
||||||
PlacesUtils.asQuery(node).queryOptions.queryType ==
|
PlacesUtils.asQuery(node).queryOptions.queryType ==
|
||||||
Components.interfaces.nsINavHistoryQueryOptions.QUERY_TYPE_HISTORY) {
|
Ci.nsINavHistoryQueryOptions.QUERY_TYPE_HISTORY) {
|
||||||
// This is a dynamically generated history query, like queries
|
// This is a dynamically generated history query, like queries
|
||||||
// grouped by site, time or both. Dynamically generated queries don't
|
// grouped by site, time or both. Dynamically generated queries don't
|
||||||
// have an itemId even if they are descendants of a bookmark.
|
// have an itemId even if they are descendants of a bookmark.
|
||||||
|
|
@ -1199,7 +1199,7 @@ PlacesController.prototype = {
|
||||||
}
|
}
|
||||||
else if (PlacesUtils.nodeIsQuery(node) &&
|
else if (PlacesUtils.nodeIsQuery(node) &&
|
||||||
PlacesUtils.asQuery(node).queryOptions.queryType ==
|
PlacesUtils.asQuery(node).queryOptions.queryType ==
|
||||||
Components.interfaces.nsINavHistoryQueryOptions.QUERY_TYPE_HISTORY) {
|
Ci.nsINavHistoryQueryOptions.QUERY_TYPE_HISTORY) {
|
||||||
this._removeHistoryContainer(node);
|
this._removeHistoryContainer(node);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -1213,7 +1213,7 @@ PlacesController.prototype = {
|
||||||
try {
|
try {
|
||||||
gen.next();
|
gen.next();
|
||||||
} catch (ex if ex instanceof StopIteration) {}
|
} catch (ex if ex instanceof StopIteration) {}
|
||||||
}, Components.interfaces.nsIThread.DISPATCH_NORMAL);
|
}, Ci.nsIThread.DISPATCH_NORMAL);
|
||||||
yield;
|
yield;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -1266,9 +1266,9 @@ PlacesController.prototype = {
|
||||||
this._removeRowsFromBookmarks(aTxnName);
|
this._removeRowsFromBookmarks(aTxnName);
|
||||||
else if (PlacesUtils.nodeIsQuery(root)) {
|
else if (PlacesUtils.nodeIsQuery(root)) {
|
||||||
var queryType = PlacesUtils.asQuery(root).queryOptions.queryType;
|
var queryType = PlacesUtils.asQuery(root).queryOptions.queryType;
|
||||||
if (queryType == Components.interfaces.nsINavHistoryQueryOptions.QUERY_TYPE_BOOKMARKS)
|
if (queryType == Ci.nsINavHistoryQueryOptions.QUERY_TYPE_BOOKMARKS)
|
||||||
this._removeRowsFromBookmarks(aTxnName);
|
this._removeRowsFromBookmarks(aTxnName);
|
||||||
else if (queryType == Components.interfaces.nsINavHistoryQueryOptions.QUERY_TYPE_HISTORY)
|
else if (queryType == Ci.nsINavHistoryQueryOptions.QUERY_TYPE_HISTORY)
|
||||||
this._removeRowsFromHistory();
|
this._removeRowsFromHistory();
|
||||||
else
|
else
|
||||||
NS_ASSERT(false, "implement support for QUERY_TYPE_UNIFIED");
|
NS_ASSERT(false, "implement support for QUERY_TYPE_UNIFIED");
|
||||||
|
|
@ -1333,13 +1333,13 @@ PlacesController.prototype = {
|
||||||
let actionOwner;
|
let actionOwner;
|
||||||
try {
|
try {
|
||||||
let xferable = Cc["@mozilla.org/widget/transferable;1"].
|
let xferable = Cc["@mozilla.org/widget/transferable;1"].
|
||||||
createInstance(Components.interfaces.nsITransferable);
|
createInstance(Ci.nsITransferable);
|
||||||
xferable.init(null);
|
xferable.init(null);
|
||||||
xferable.addDataFlavor(PlacesUtils.TYPE_X_MOZ_PLACE_ACTION)
|
xferable.addDataFlavor(PlacesUtils.TYPE_X_MOZ_PLACE_ACTION)
|
||||||
this.clipboard.getData(xferable, Components.interfaces.nsIClipboard.kGlobalClipboard);
|
this.clipboard.getData(xferable, Ci.nsIClipboard.kGlobalClipboard);
|
||||||
xferable.getTransferData(PlacesUtils.TYPE_X_MOZ_PLACE_ACTION, action, {});
|
xferable.getTransferData(PlacesUtils.TYPE_X_MOZ_PLACE_ACTION, action, {});
|
||||||
[action, actionOwner] =
|
[action, actionOwner] =
|
||||||
action.value.QueryInterface(Components.interfaces.nsISupportsString).data.split(",");
|
action.value.QueryInterface(Ci.nsISupportsString).data.split(",");
|
||||||
} catch(ex) {
|
} catch(ex) {
|
||||||
// Paste from external sources don't have any associated action, just
|
// Paste from external sources don't have any associated action, just
|
||||||
// fallback to a copy action.
|
// fallback to a copy action.
|
||||||
|
|
@ -1357,19 +1357,19 @@ PlacesController.prototype = {
|
||||||
_releaseClipboardOwnership: function PC__releaseClipboardOwnership() {
|
_releaseClipboardOwnership: function PC__releaseClipboardOwnership() {
|
||||||
if (this.cutNodes.length > 0) {
|
if (this.cutNodes.length > 0) {
|
||||||
// This clears the logical clipboard, doesn't remove data.
|
// This clears the logical clipboard, doesn't remove data.
|
||||||
this.clipboard.emptyClipboard(Components.interfaces.nsIClipboard.kGlobalClipboard);
|
this.clipboard.emptyClipboard(Ci.nsIClipboard.kGlobalClipboard);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
_clearClipboard: function PC__clearClipboard() {
|
_clearClipboard: function PC__clearClipboard() {
|
||||||
let xferable = Cc["@mozilla.org/widget/transferable;1"].
|
let xferable = Cc["@mozilla.org/widget/transferable;1"].
|
||||||
createInstance(Components.interfaces.nsITransferable);
|
createInstance(Ci.nsITransferable);
|
||||||
xferable.init(null);
|
xferable.init(null);
|
||||||
// Empty transferables may cause crashes, so just add an unknown type.
|
// Empty transferables may cause crashes, so just add an unknown type.
|
||||||
const TYPE = "text/x-moz-place-empty";
|
const TYPE = "text/x-moz-place-empty";
|
||||||
xferable.addDataFlavor(TYPE);
|
xferable.addDataFlavor(TYPE);
|
||||||
xferable.setTransferData(TYPE, PlacesUtils.toISupportsString(""), 0);
|
xferable.setTransferData(TYPE, PlacesUtils.toISupportsString(""), 0);
|
||||||
this.clipboard.setData(xferable, null, Components.interfaces.nsIClipboard.kGlobalClipboard);
|
this.clipboard.setData(xferable, null, Ci.nsIClipboard.kGlobalClipboard);
|
||||||
},
|
},
|
||||||
|
|
||||||
_populateClipboard: function PC__populateClipboard(aNodes, aAction) {
|
_populateClipboard: function PC__populateClipboard(aNodes, aAction) {
|
||||||
|
|
@ -1409,7 +1409,7 @@ PlacesController.prototype = {
|
||||||
}
|
}
|
||||||
|
|
||||||
let xferable = Cc["@mozilla.org/widget/transferable;1"].
|
let xferable = Cc["@mozilla.org/widget/transferable;1"].
|
||||||
createInstance(Components.interfaces.nsITransferable);
|
createInstance(Ci.nsITransferable);
|
||||||
xferable.init(null);
|
xferable.init(null);
|
||||||
let hasData = false;
|
let hasData = false;
|
||||||
// This order matters here! It controls how this and other applications
|
// This order matters here! It controls how this and other applications
|
||||||
|
|
@ -1432,7 +1432,7 @@ PlacesController.prototype = {
|
||||||
if (hasData) {
|
if (hasData) {
|
||||||
this.clipboard.setData(xferable,
|
this.clipboard.setData(xferable,
|
||||||
this.cutNodes.length > 0 ? this : null,
|
this.cutNodes.length > 0 ? this : null,
|
||||||
Components.interfaces.nsIClipboard.kGlobalClipboard);
|
Ci.nsIClipboard.kGlobalClipboard);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
@ -1499,7 +1499,7 @@ PlacesController.prototype = {
|
||||||
let action = this.clipboardAction;
|
let action = this.clipboardAction;
|
||||||
|
|
||||||
let xferable = Cc["@mozilla.org/widget/transferable;1"].
|
let xferable = Cc["@mozilla.org/widget/transferable;1"].
|
||||||
createInstance(Components.interfaces.nsITransferable);
|
createInstance(Ci.nsITransferable);
|
||||||
xferable.init(null);
|
xferable.init(null);
|
||||||
// This order matters here! It controls the preferred flavors for this
|
// This order matters here! It controls the preferred flavors for this
|
||||||
// paste operation.
|
// paste operation.
|
||||||
|
|
@ -1508,13 +1508,13 @@ PlacesController.prototype = {
|
||||||
PlacesUtils.TYPE_UNICODE,
|
PlacesUtils.TYPE_UNICODE,
|
||||||
].forEach(function (type) xferable.addDataFlavor(type));
|
].forEach(function (type) xferable.addDataFlavor(type));
|
||||||
|
|
||||||
this.clipboard.getData(xferable, Components.interfaces.nsIClipboard.kGlobalClipboard);
|
this.clipboard.getData(xferable, Ci.nsIClipboard.kGlobalClipboard);
|
||||||
|
|
||||||
// Now get the clipboard contents, in the best available flavor.
|
// Now get the clipboard contents, in the best available flavor.
|
||||||
let data = {}, type = {}, items = [];
|
let data = {}, type = {}, items = [];
|
||||||
try {
|
try {
|
||||||
xferable.getAnyTransferData(type, data, {});
|
xferable.getAnyTransferData(type, data, {});
|
||||||
data = data.value.QueryInterface(Components.interfaces.nsISupportsString).data;
|
data = data.value.QueryInterface(Ci.nsISupportsString).data;
|
||||||
type = type.value;
|
type = type.value;
|
||||||
items = PlacesUtils.unwrapNodes(data, type);
|
items = PlacesUtils.unwrapNodes(data, type);
|
||||||
} catch(ex) {
|
} catch(ex) {
|
||||||
|
|
@ -1694,7 +1694,7 @@ let PlacesControllerDragHelper = {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Only bookmarks and urls can be dropped into tag containers.
|
// Only bookmarks and urls can be dropped into tag containers.
|
||||||
if (ip.isTag && ip.orientation == Components.interfaces.nsITreeView.DROP_ON &&
|
if (ip.isTag && ip.orientation == Ci.nsITreeView.DROP_ON &&
|
||||||
dragged.type != PlacesUtils.TYPE_X_MOZ_URL &&
|
dragged.type != PlacesUtils.TYPE_X_MOZ_URL &&
|
||||||
(dragged.type != PlacesUtils.TYPE_X_MOZ_PLACE ||
|
(dragged.type != PlacesUtils.TYPE_X_MOZ_PLACE ||
|
||||||
(dragged.uri && dragged.uri.startsWith("place:")) ))
|
(dragged.uri && dragged.uri.startsWith("place:")) ))
|
||||||
|
|
@ -1784,7 +1784,7 @@ let PlacesControllerDragHelper = {
|
||||||
|
|
||||||
// If dragging over a tag container we should tag the item.
|
// If dragging over a tag container we should tag the item.
|
||||||
if (insertionPoint.isTag &&
|
if (insertionPoint.isTag &&
|
||||||
insertionPoint.orientation == Components.interfaces.nsITreeView.DROP_ON) {
|
insertionPoint.orientation == Ci.nsITreeView.DROP_ON) {
|
||||||
let uri = NetUtil.newURI(unwrapped.uri);
|
let uri = NetUtil.newURI(unwrapped.uri);
|
||||||
let tagItemId = insertionPoint.itemId;
|
let tagItemId = insertionPoint.itemId;
|
||||||
let tagTxn = new PlacesTagURITransaction(uri, [tagItemId]);
|
let tagTxn = new PlacesTagURITransaction(uri, [tagItemId]);
|
||||||
|
|
|
||||||
|
|
@ -41,7 +41,7 @@ function searchHistory(aInput)
|
||||||
var query = PlacesUtils.history.getNewQuery();
|
var query = PlacesUtils.history.getNewQuery();
|
||||||
var options = PlacesUtils.history.getNewQueryOptions();
|
var options = PlacesUtils.history.getNewQueryOptions();
|
||||||
|
|
||||||
const NHQO = Components.interfaces.nsINavHistoryQueryOptions;
|
const NHQO = Ci.nsINavHistoryQueryOptions;
|
||||||
var sortingMode;
|
var sortingMode;
|
||||||
var resultType;
|
var resultType;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -2,12 +2,12 @@
|
||||||
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
|
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
|
||||||
* You can obtain one at http://mozilla.org/MPL/2.0/. */
|
* You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||||
|
|
||||||
Components.utils.import('resource://gre/modules/XPCOMUtils.jsm');
|
Components.utils.import('resource://gre/modules/XPCOMUtils.jsm');
|
||||||
|
|
||||||
const PTV_interfaces = [Components.interfaces.nsITreeView,
|
const PTV_interfaces = [Ci.nsITreeView,
|
||||||
Components.interfaces.nsINavHistoryResultObserver,
|
Ci.nsINavHistoryResultObserver,
|
||||||
Components.interfaces.nsINavHistoryResultTreeViewer,
|
Ci.nsINavHistoryResultTreeViewer,
|
||||||
Components.interfaces.nsISupportsWeakReference];
|
Ci.nsISupportsWeakReference];
|
||||||
|
|
||||||
function PlacesTreeView(aFlatList, aOnOpenFlatContainer, aController) {
|
function PlacesTreeView(aFlatList, aOnOpenFlatContainer, aController) {
|
||||||
this._tree = null;
|
this._tree = null;
|
||||||
|
|
@ -27,7 +27,7 @@ PlacesTreeView.prototype = {
|
||||||
get _dateService() {
|
get _dateService() {
|
||||||
if (!this.__dateService) {
|
if (!this.__dateService) {
|
||||||
this.__dateService = Cc["@mozilla.org/intl/scriptabledateformat;1"].
|
this.__dateService = Cc["@mozilla.org/intl/scriptabledateformat;1"].
|
||||||
getService(Components.interfaces.nsIScriptableDateFormat);
|
getService(Ci.nsIScriptableDateFormat);
|
||||||
}
|
}
|
||||||
return this.__dateService;
|
return this.__dateService;
|
||||||
},
|
},
|
||||||
|
|
@ -94,21 +94,21 @@ PlacesTreeView.prototype = {
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
// We don't know enough about non-query containers.
|
// We don't know enough about non-query containers.
|
||||||
if (!(aContainer instanceof Components.interfaces.nsINavHistoryQueryResultNode))
|
if (!(aContainer instanceof Ci.nsINavHistoryQueryResultNode))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
switch (aContainer.queryOptions.resultType) {
|
switch (aContainer.queryOptions.resultType) {
|
||||||
case Components.interfaces.nsINavHistoryQueryOptions.RESULTS_AS_DATE_QUERY:
|
case Ci.nsINavHistoryQueryOptions.RESULTS_AS_DATE_QUERY:
|
||||||
case Components.interfaces.nsINavHistoryQueryOptions.RESULTS_AS_SITE_QUERY:
|
case Ci.nsINavHistoryQueryOptions.RESULTS_AS_SITE_QUERY:
|
||||||
case Components.interfaces.nsINavHistoryQueryOptions.RESULTS_AS_DATE_SITE_QUERY:
|
case Ci.nsINavHistoryQueryOptions.RESULTS_AS_DATE_SITE_QUERY:
|
||||||
case Components.interfaces.nsINavHistoryQueryOptions.RESULTS_AS_TAG_QUERY:
|
case Ci.nsINavHistoryQueryOptions.RESULTS_AS_TAG_QUERY:
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// If it's a folder, it's not a plain container.
|
// If it's a folder, it's not a plain container.
|
||||||
let nodeType = aContainer.type;
|
let nodeType = aContainer.type;
|
||||||
return nodeType != Components.interfaces.nsINavHistoryResultNode.RESULT_TYPE_FOLDER &&
|
return nodeType != Ci.nsINavHistoryResultNode.RESULT_TYPE_FOLDER &&
|
||||||
nodeType != Components.interfaces.nsINavHistoryResultNode.RESULT_TYPE_FOLDER_SHORTCUT;
|
nodeType != Ci.nsINavHistoryResultNode.RESULT_TYPE_FOLDER_SHORTCUT;
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -174,7 +174,7 @@ PlacesTreeView.prototype = {
|
||||||
let row = -1;
|
let row = -1;
|
||||||
let useNodeIndex = typeof(aNodeIndex) == "number";
|
let useNodeIndex = typeof(aNodeIndex) == "number";
|
||||||
if (parent == this._rootNode) {
|
if (parent == this._rootNode) {
|
||||||
if (aNode instanceof Components.interfaces.nsINavHistoryResultNode) {
|
if (aNode instanceof Ci.nsINavHistoryResultNode) {
|
||||||
row = useNodeIndex ? aNodeIndex : this._rootNode.getChildIndex(aNode);
|
row = useNodeIndex ? aNodeIndex : this._rootNode.getChildIndex(aNode);
|
||||||
}
|
}
|
||||||
} else if (useNodeIndex && typeof(aParentRow) == "number") {
|
} else if (useNodeIndex && typeof(aParentRow) == "number") {
|
||||||
|
|
@ -244,7 +244,7 @@ PlacesTreeView.prototype = {
|
||||||
|
|
||||||
// Unset elements may exist only in plain containers. Thus, if the nearest
|
// Unset elements may exist only in plain containers. Thus, if the nearest
|
||||||
// node is a container, it's the row's parent, otherwise, it's a sibling.
|
// node is a container, it's the row's parent, otherwise, it's a sibling.
|
||||||
if (rowNode instanceof Components.interfaces.nsINavHistoryContainerResultNode)
|
if (rowNode instanceof Ci.nsINavHistoryContainerResultNode)
|
||||||
return this._rows[aRow] = rowNode.getChild(aRow - row - 1);
|
return this._rows[aRow] = rowNode.getChild(aRow - row - 1);
|
||||||
|
|
||||||
let [parent, parentRow] = this._getParentByChildRow(row);
|
let [parent, parentRow] = this._getParentByChildRow(row);
|
||||||
|
|
@ -296,8 +296,8 @@ PlacesTreeView.prototype = {
|
||||||
let row = aFirstChildRow + rowsInserted;
|
let row = aFirstChildRow + rowsInserted;
|
||||||
|
|
||||||
// Don't display separators when sorted.
|
// Don't display separators when sorted.
|
||||||
if (curChildType == Components.interfaces.nsINavHistoryResultNode.RESULT_TYPE_SEPARATOR) {
|
if (curChildType == Ci.nsINavHistoryResultNode.RESULT_TYPE_SEPARATOR) {
|
||||||
if (sortingMode != Components.interfaces.nsINavHistoryQueryOptions.SORT_BY_NONE) {
|
if (sortingMode != Ci.nsINavHistoryQueryOptions.SORT_BY_NONE) {
|
||||||
// Remove the element for the filtered separator.
|
// Remove the element for the filtered separator.
|
||||||
// Notice that the rows array was initially resized to include all
|
// Notice that the rows array was initially resized to include all
|
||||||
// children.
|
// children.
|
||||||
|
|
@ -311,7 +311,7 @@ PlacesTreeView.prototype = {
|
||||||
|
|
||||||
// Recursively do containers.
|
// Recursively do containers.
|
||||||
if (!this._flatList &&
|
if (!this._flatList &&
|
||||||
curChild instanceof Components.interfaces.nsINavHistoryContainerResultNode &&
|
curChild instanceof Ci.nsINavHistoryContainerResultNode &&
|
||||||
!this._controller.hasCachedLivemarkInfo(curChild)) {
|
!this._controller.hasCachedLivemarkInfo(curChild)) {
|
||||||
let resource = this._getResourceForNode(curChild);
|
let resource = this._getResourceForNode(curChild);
|
||||||
let isopen = resource != null &&
|
let isopen = resource != null &&
|
||||||
|
|
@ -338,7 +338,7 @@ PlacesTreeView.prototype = {
|
||||||
|
|
||||||
// If it's not listed yet, we know that it's a leaf node (instanceof also
|
// If it's not listed yet, we know that it's a leaf node (instanceof also
|
||||||
// null-checks).
|
// null-checks).
|
||||||
if (!(node instanceof Components.interfaces.nsINavHistoryContainerResultNode))
|
if (!(node instanceof Ci.nsINavHistoryContainerResultNode))
|
||||||
return 1;
|
return 1;
|
||||||
|
|
||||||
let outerLevel = node.indentLevel;
|
let outerLevel = node.indentLevel;
|
||||||
|
|
@ -500,12 +500,12 @@ PlacesTreeView.prototype = {
|
||||||
midnight += new Date(midnight).getTimezoneOffset() * MS_PER_MINUTE;
|
midnight += new Date(midnight).getTimezoneOffset() * MS_PER_MINUTE;
|
||||||
|
|
||||||
let dateFormat = timeMs >= midnight ?
|
let dateFormat = timeMs >= midnight ?
|
||||||
Components.interfaces.nsIScriptableDateFormat.dateFormatNone :
|
Ci.nsIScriptableDateFormat.dateFormatNone :
|
||||||
Components.interfaces.nsIScriptableDateFormat.dateFormatShort;
|
Ci.nsIScriptableDateFormat.dateFormatShort;
|
||||||
|
|
||||||
let timeObj = new Date(timeMs);
|
let timeObj = new Date(timeMs);
|
||||||
return (this._dateService.FormatDateTime("", dateFormat,
|
return (this._dateService.FormatDateTime("", dateFormat,
|
||||||
Components.interfaces.nsIScriptableDateFormat.timeFormatNoSeconds,
|
Ci.nsIScriptableDateFormat.timeFormatNoSeconds,
|
||||||
timeObj.getFullYear(), timeObj.getMonth() + 1,
|
timeObj.getFullYear(), timeObj.getMonth() + 1,
|
||||||
timeObj.getDate(), timeObj.getHours(),
|
timeObj.getDate(), timeObj.getHours(),
|
||||||
timeObj.getMinutes(), timeObj.getSeconds()));
|
timeObj.getMinutes(), timeObj.getSeconds()));
|
||||||
|
|
@ -556,44 +556,44 @@ PlacesTreeView.prototype = {
|
||||||
|
|
||||||
_sortTypeToColumnType: function PTV__sortTypeToColumnType(aSortType) {
|
_sortTypeToColumnType: function PTV__sortTypeToColumnType(aSortType) {
|
||||||
switch (aSortType) {
|
switch (aSortType) {
|
||||||
case Components.interfaces.nsINavHistoryQueryOptions.SORT_BY_TITLE_ASCENDING:
|
case Ci.nsINavHistoryQueryOptions.SORT_BY_TITLE_ASCENDING:
|
||||||
return [this.COLUMN_TYPE_TITLE, false];
|
return [this.COLUMN_TYPE_TITLE, false];
|
||||||
case Components.interfaces.nsINavHistoryQueryOptions.SORT_BY_TITLE_DESCENDING:
|
case Ci.nsINavHistoryQueryOptions.SORT_BY_TITLE_DESCENDING:
|
||||||
return [this.COLUMN_TYPE_TITLE, true];
|
return [this.COLUMN_TYPE_TITLE, true];
|
||||||
case Components.interfaces.nsINavHistoryQueryOptions.SORT_BY_DATE_ASCENDING:
|
case Ci.nsINavHistoryQueryOptions.SORT_BY_DATE_ASCENDING:
|
||||||
return [this.COLUMN_TYPE_DATE, false];
|
return [this.COLUMN_TYPE_DATE, false];
|
||||||
case Components.interfaces.nsINavHistoryQueryOptions.SORT_BY_DATE_DESCENDING:
|
case Ci.nsINavHistoryQueryOptions.SORT_BY_DATE_DESCENDING:
|
||||||
return [this.COLUMN_TYPE_DATE, true];
|
return [this.COLUMN_TYPE_DATE, true];
|
||||||
case Components.interfaces.nsINavHistoryQueryOptions.SORT_BY_URI_ASCENDING:
|
case Ci.nsINavHistoryQueryOptions.SORT_BY_URI_ASCENDING:
|
||||||
return [this.COLUMN_TYPE_URI, false];
|
return [this.COLUMN_TYPE_URI, false];
|
||||||
case Components.interfaces.nsINavHistoryQueryOptions.SORT_BY_URI_DESCENDING:
|
case Ci.nsINavHistoryQueryOptions.SORT_BY_URI_DESCENDING:
|
||||||
return [this.COLUMN_TYPE_URI, true];
|
return [this.COLUMN_TYPE_URI, true];
|
||||||
case Components.interfaces.nsINavHistoryQueryOptions.SORT_BY_VISITCOUNT_ASCENDING:
|
case Ci.nsINavHistoryQueryOptions.SORT_BY_VISITCOUNT_ASCENDING:
|
||||||
return [this.COLUMN_TYPE_VISITCOUNT, false];
|
return [this.COLUMN_TYPE_VISITCOUNT, false];
|
||||||
case Components.interfaces.nsINavHistoryQueryOptions.SORT_BY_VISITCOUNT_DESCENDING:
|
case Ci.nsINavHistoryQueryOptions.SORT_BY_VISITCOUNT_DESCENDING:
|
||||||
return [this.COLUMN_TYPE_VISITCOUNT, true];
|
return [this.COLUMN_TYPE_VISITCOUNT, true];
|
||||||
case Components.interfaces.nsINavHistoryQueryOptions.SORT_BY_KEYWORD_ASCENDING:
|
case Ci.nsINavHistoryQueryOptions.SORT_BY_KEYWORD_ASCENDING:
|
||||||
return [this.COLUMN_TYPE_KEYWORD, false];
|
return [this.COLUMN_TYPE_KEYWORD, false];
|
||||||
case Components.interfaces.nsINavHistoryQueryOptions.SORT_BY_KEYWORD_DESCENDING:
|
case Ci.nsINavHistoryQueryOptions.SORT_BY_KEYWORD_DESCENDING:
|
||||||
return [this.COLUMN_TYPE_KEYWORD, true];
|
return [this.COLUMN_TYPE_KEYWORD, true];
|
||||||
case Components.interfaces.nsINavHistoryQueryOptions.SORT_BY_ANNOTATION_ASCENDING:
|
case Ci.nsINavHistoryQueryOptions.SORT_BY_ANNOTATION_ASCENDING:
|
||||||
if (this._result.sortingAnnotation == PlacesUIUtils.DESCRIPTION_ANNO)
|
if (this._result.sortingAnnotation == PlacesUIUtils.DESCRIPTION_ANNO)
|
||||||
return [this.COLUMN_TYPE_DESCRIPTION, false];
|
return [this.COLUMN_TYPE_DESCRIPTION, false];
|
||||||
break;
|
break;
|
||||||
case Components.interfaces.nsINavHistoryQueryOptions.SORT_BY_ANNOTATION_DESCENDING:
|
case Ci.nsINavHistoryQueryOptions.SORT_BY_ANNOTATION_DESCENDING:
|
||||||
if (this._result.sortingAnnotation == PlacesUIUtils.DESCRIPTION_ANNO)
|
if (this._result.sortingAnnotation == PlacesUIUtils.DESCRIPTION_ANNO)
|
||||||
return [this.COLUMN_TYPE_DESCRIPTION, true];
|
return [this.COLUMN_TYPE_DESCRIPTION, true];
|
||||||
case Components.interfaces.nsINavHistoryQueryOptions.SORT_BY_DATEADDED_ASCENDING:
|
case Ci.nsINavHistoryQueryOptions.SORT_BY_DATEADDED_ASCENDING:
|
||||||
return [this.COLUMN_TYPE_DATEADDED, false];
|
return [this.COLUMN_TYPE_DATEADDED, false];
|
||||||
case Components.interfaces.nsINavHistoryQueryOptions.SORT_BY_DATEADDED_DESCENDING:
|
case Ci.nsINavHistoryQueryOptions.SORT_BY_DATEADDED_DESCENDING:
|
||||||
return [this.COLUMN_TYPE_DATEADDED, true];
|
return [this.COLUMN_TYPE_DATEADDED, true];
|
||||||
case Components.interfaces.nsINavHistoryQueryOptions.SORT_BY_LASTMODIFIED_ASCENDING:
|
case Ci.nsINavHistoryQueryOptions.SORT_BY_LASTMODIFIED_ASCENDING:
|
||||||
return [this.COLUMN_TYPE_LASTMODIFIED, false];
|
return [this.COLUMN_TYPE_LASTMODIFIED, false];
|
||||||
case Components.interfaces.nsINavHistoryQueryOptions.SORT_BY_LASTMODIFIED_DESCENDING:
|
case Ci.nsINavHistoryQueryOptions.SORT_BY_LASTMODIFIED_DESCENDING:
|
||||||
return [this.COLUMN_TYPE_LASTMODIFIED, true];
|
return [this.COLUMN_TYPE_LASTMODIFIED, true];
|
||||||
case Components.interfaces.nsINavHistoryQueryOptions.SORT_BY_TAGS_ASCENDING:
|
case Ci.nsINavHistoryQueryOptions.SORT_BY_TAGS_ASCENDING:
|
||||||
return [this.COLUMN_TYPE_TAGS, false];
|
return [this.COLUMN_TYPE_TAGS, false];
|
||||||
case Components.interfaces.nsINavHistoryQueryOptions.SORT_BY_TAGS_DESCENDING:
|
case Ci.nsINavHistoryQueryOptions.SORT_BY_TAGS_DESCENDING:
|
||||||
return [this.COLUMN_TYPE_TAGS, true];
|
return [this.COLUMN_TYPE_TAGS, true];
|
||||||
}
|
}
|
||||||
return [this.COLUMN_TYPE_UNKNOWN, false];
|
return [this.COLUMN_TYPE_UNKNOWN, false];
|
||||||
|
|
@ -1054,7 +1054,7 @@ PlacesTreeView.prototype = {
|
||||||
sortedColumn.element.removeAttribute("sortDirection");
|
sortedColumn.element.removeAttribute("sortDirection");
|
||||||
|
|
||||||
// Set new sorting indicator by looking through all columns for ours.
|
// Set new sorting indicator by looking through all columns for ours.
|
||||||
if (aSortingMode == Components.interfaces.nsINavHistoryQueryOptions.SORT_BY_NONE)
|
if (aSortingMode == Ci.nsINavHistoryQueryOptions.SORT_BY_NONE)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
let [desiredColumn, desiredIsDescending] =
|
let [desiredColumn, desiredIsDescending] =
|
||||||
|
|
@ -1121,7 +1121,7 @@ PlacesTreeView.prototype = {
|
||||||
}
|
}
|
||||||
catch(ex) { }
|
catch(ex) { }
|
||||||
|
|
||||||
return Components.interfaces.nsINavHistoryResultTreeViewer.INDEX_INVISIBLE;
|
return Ci.nsINavHistoryResultTreeViewer.INDEX_INVISIBLE;
|
||||||
},
|
},
|
||||||
|
|
||||||
_getResourceForNode: function PTV_getResourceForNode(aNode)
|
_getResourceForNode: function PTV_getResourceForNode(aNode)
|
||||||
|
|
@ -1167,7 +1167,7 @@ PlacesTreeView.prototype = {
|
||||||
let itemId = node.itemId;
|
let itemId = node.itemId;
|
||||||
let nodeType = node.type;
|
let nodeType = node.type;
|
||||||
if (PlacesUtils.containerTypes.indexOf(nodeType) != -1) {
|
if (PlacesUtils.containerTypes.indexOf(nodeType) != -1) {
|
||||||
if (nodeType == Components.interfaces.nsINavHistoryResultNode.RESULT_TYPE_QUERY) {
|
if (nodeType == Ci.nsINavHistoryResultNode.RESULT_TYPE_QUERY) {
|
||||||
properties += " query";
|
properties += " query";
|
||||||
if (PlacesUtils.nodeIsTagQuery(node))
|
if (PlacesUtils.nodeIsTagQuery(node))
|
||||||
properties += " tagContainer";
|
properties += " tagContainer";
|
||||||
|
|
@ -1176,8 +1176,8 @@ PlacesTreeView.prototype = {
|
||||||
else if (PlacesUtils.nodeIsHost(node))
|
else if (PlacesUtils.nodeIsHost(node))
|
||||||
properties += " hostContainer";
|
properties += " hostContainer";
|
||||||
}
|
}
|
||||||
else if (nodeType == Components.interfaces.nsINavHistoryResultNode.RESULT_TYPE_FOLDER ||
|
else if (nodeType == Ci.nsINavHistoryResultNode.RESULT_TYPE_FOLDER ||
|
||||||
nodeType == Components.interfaces.nsINavHistoryResultNode.RESULT_TYPE_FOLDER_SHORTCUT) {
|
nodeType == Ci.nsINavHistoryResultNode.RESULT_TYPE_FOLDER_SHORTCUT) {
|
||||||
if (this._controller.hasCachedLivemarkInfo(node)) {
|
if (this._controller.hasCachedLivemarkInfo(node)) {
|
||||||
properties += " livemark";
|
properties += " livemark";
|
||||||
}
|
}
|
||||||
|
|
@ -1199,7 +1199,7 @@ PlacesTreeView.prototype = {
|
||||||
properties += " OrganizerQuery_" + queryName;
|
properties += " OrganizerQuery_" + queryName;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (nodeType == Components.interfaces.nsINavHistoryResultNode.RESULT_TYPE_SEPARATOR)
|
else if (nodeType == Ci.nsINavHistoryResultNode.RESULT_TYPE_SEPARATOR)
|
||||||
properties += " separator";
|
properties += " separator";
|
||||||
else if (PlacesUtils.nodeIsURI(node)) {
|
else if (PlacesUtils.nodeIsURI(node)) {
|
||||||
properties += " " + PlacesUIUtils.guessUrlSchemeForUI(node.uri);
|
properties += " " + PlacesUIUtils.guessUrlSchemeForUI(node.uri);
|
||||||
|
|
@ -1275,7 +1275,7 @@ PlacesTreeView.prototype = {
|
||||||
|
|
||||||
isSorted: function PTV_isSorted() {
|
isSorted: function PTV_isSorted() {
|
||||||
return this._result.sortingMode !=
|
return this._result.sortingMode !=
|
||||||
Components.interfaces.nsINavHistoryQueryOptions.SORT_BY_NONE;
|
Ci.nsINavHistoryQueryOptions.SORT_BY_NONE;
|
||||||
},
|
},
|
||||||
|
|
||||||
canDrop: function PTV_canDrop(aRow, aOrientation, aDataTransfer) {
|
canDrop: function PTV_canDrop(aRow, aOrientation, aDataTransfer) {
|
||||||
|
|
@ -1297,19 +1297,19 @@ PlacesTreeView.prototype = {
|
||||||
// the view is populated from (i.e. the result's itemId).
|
// the view is populated from (i.e. the result's itemId).
|
||||||
if (index != -1) {
|
if (index != -1) {
|
||||||
let lastSelected = this.nodeForTreeIndex(index);
|
let lastSelected = this.nodeForTreeIndex(index);
|
||||||
if (this.isContainer(index) && orientation == Components.interfaces.nsITreeView.DROP_ON) {
|
if (this.isContainer(index) && orientation == Ci.nsITreeView.DROP_ON) {
|
||||||
// If the last selected item is an open container, append _into_
|
// If the last selected item is an open container, append _into_
|
||||||
// it, rather than insert adjacent to it.
|
// it, rather than insert adjacent to it.
|
||||||
container = lastSelected;
|
container = lastSelected;
|
||||||
index = -1;
|
index = -1;
|
||||||
}
|
}
|
||||||
else if (lastSelected.containerOpen &&
|
else if (lastSelected.containerOpen &&
|
||||||
orientation == Components.interfaces.nsITreeView.DROP_AFTER &&
|
orientation == Ci.nsITreeView.DROP_AFTER &&
|
||||||
lastSelected.hasChildren) {
|
lastSelected.hasChildren) {
|
||||||
// If the last selected node is an open container and the user is
|
// If the last selected node is an open container and the user is
|
||||||
// trying to drag into it as a first node, really insert into it.
|
// trying to drag into it as a first node, really insert into it.
|
||||||
container = lastSelected;
|
container = lastSelected;
|
||||||
orientation = Components.interfaces.nsITreeView.DROP_ON;
|
orientation = Ci.nsITreeView.DROP_ON;
|
||||||
index = 0;
|
index = 0;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
|
@ -1332,7 +1332,7 @@ PlacesTreeView.prototype = {
|
||||||
|
|
||||||
let queryOptions = PlacesUtils.asQuery(this._result.root).queryOptions;
|
let queryOptions = PlacesUtils.asQuery(this._result.root).queryOptions;
|
||||||
if (queryOptions.sortingMode !=
|
if (queryOptions.sortingMode !=
|
||||||
Components.interfaces.nsINavHistoryQueryOptions.SORT_BY_NONE) {
|
Ci.nsINavHistoryQueryOptions.SORT_BY_NONE) {
|
||||||
// If we are within a sorted view, insert at the end.
|
// If we are within a sorted view, insert at the end.
|
||||||
index = -1;
|
index = -1;
|
||||||
}
|
}
|
||||||
|
|
@ -1347,7 +1347,7 @@ PlacesTreeView.prototype = {
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
let lsi = container.getChildIndex(lastSelected);
|
let lsi = container.getChildIndex(lastSelected);
|
||||||
index = orientation == Components.interfaces.nsITreeView.DROP_BEFORE ? lsi : lsi + 1;
|
index = orientation == Ci.nsITreeView.DROP_BEFORE ? lsi : lsi + 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -1586,7 +1586,7 @@ PlacesTreeView.prototype = {
|
||||||
let oldSortingAnnotation = this._result.sortingAnnotation;
|
let oldSortingAnnotation = this._result.sortingAnnotation;
|
||||||
let newSort;
|
let newSort;
|
||||||
let newSortingAnnotation = "";
|
let newSortingAnnotation = "";
|
||||||
const NHQO = Components.interfaces.nsINavHistoryQueryOptions;
|
const NHQO = Ci.nsINavHistoryQueryOptions;
|
||||||
switch (this._getColumnType(aColumn)) {
|
switch (this._getColumnType(aColumn)) {
|
||||||
case this.COLUMN_TYPE_TITLE:
|
case this.COLUMN_TYPE_TITLE:
|
||||||
if (oldSort == NHQO.SORT_BY_TITLE_ASCENDING)
|
if (oldSort == NHQO.SORT_BY_TITLE_ASCENDING)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue