summaryrefslogtreecommitdiffstats
path: root/application/palemoon/components
diff options
context:
space:
mode:
authorJustOff <Off.Just.Off@gmail.com>2018-11-16 21:57:07 +0200
committerJustOff <Off.Just.Off@gmail.com>2018-11-16 21:57:07 +0200
commitb32323fae434bad270dd22f5a5d4da61101703ed (patch)
tree8b6e8053f3fe1412c15bdae9ff8488bbe7c84ba0 /application/palemoon/components
parentc94825c861795cc2bb0b98483143f277eb3f5060 (diff)
downloadUXP-b32323fae434bad270dd22f5a5d4da61101703ed.tar
UXP-b32323fae434bad270dd22f5a5d4da61101703ed.tar.gz
UXP-b32323fae434bad270dd22f5a5d4da61101703ed.tar.lz
UXP-b32323fae434bad270dd22f5a5d4da61101703ed.tar.xz
UXP-b32323fae434bad270dd22f5a5d4da61101703ed.zip
[PALEMOON] Align the places component with the updated PlacesUtils API
Diffstat (limited to 'application/palemoon/components')
-rw-r--r--application/palemoon/components/places/PlacesUIUtils.jsm40
-rw-r--r--application/palemoon/components/places/content/controller.js17
2 files changed, 34 insertions, 23 deletions
diff --git a/application/palemoon/components/places/PlacesUIUtils.jsm b/application/palemoon/components/places/PlacesUIUtils.jsm
index f62535613..05d79241c 100644
--- a/application/palemoon/components/places/PlacesUIUtils.jsm
+++ b/application/palemoon/components/places/PlacesUIUtils.jsm
@@ -146,14 +146,21 @@ this.PlacesUIUtils = {
* annotations are synced from the old one.
* @see this._copyableAnnotations for the list of copyable annotations.
*/
- _getFolderCopyTransaction:
- function PUIU__getFolderCopyTransaction(aData, aContainer, aIndex)
- {
- function getChildItemsTransactions(aChildren)
- {
+ _getFolderCopyTransaction(aData, aContainer, aIndex) {
+ function getChildItemsTransactions(aRoot) {
let transactions = [];
let index = aIndex;
- aChildren.forEach(function (node, i) {
+ for (let i = 0; i < aRoot.childCount; ++i) {
+ let child = aRoot.getChild(i);
+ // Temporary hacks until we switch to PlacesTransactions.jsm.
+ let isLivemark =
+ PlacesUtils.annotations.itemHasAnnotation(child.itemId,
+ PlacesUtils.LMANNO_FEEDURI);
+ let [node] = PlacesUtils.unwrapNodes(
+ PlacesUtils.wrapNode(child, PlacesUtils.TYPE_X_MOZ_PLACE, isLivemark),
+ PlacesUtils.TYPE_X_MOZ_PLACE
+ );
+
// Make sure that items are given the correct index, this will be
// passed by the transaction manager to the backend for the insertion.
// Insertion behaves differently for DEFAULT_INDEX (append).
@@ -184,19 +191,21 @@ this.PlacesUIUtils = {
else {
throw new Error("Unexpected item under a bookmarks folder");
}
- });
+ }
return transactions;
}
- if (aContainer == PlacesUtils.tagsFolderId) { // Copying a tag folder.
+ if (aContainer == PlacesUtils.tagsFolderId) { // Copying into a tag folder.
let transactions = [];
- if (aData.children) {
- aData.children.forEach(function(aChild) {
+ if (!aData.livemark && aData.type == PlacesUtils.TYPE_X_MOZ_PLACE_CONTAINER) {
+ let {root} = PlacesUtils.getFolderContents(aData.id, false, false);
+ let urls = PlacesUtils.getURLsForContainerNode(root);
+ root.containerOpen = false;
+ for (let { uri } of urls) {
transactions.push(
- new PlacesTagURITransaction(PlacesUtils._uri(aChild.uri),
- [aData.title])
+ new PlacesTagURITransaction(NetUtil.newURI(uri), [aData.title])
);
- });
+ }
}
return new PlacesAggregatedTransaction("addTags", transactions);
}
@@ -205,7 +214,10 @@ this.PlacesUIUtils = {
return this._getLivemarkCopyTransaction(aData, aContainer, aIndex);
}
- let transactions = getChildItemsTransactions(aData.children);
+ let {root} = PlacesUtils.getFolderContents(aData.id, false, false);
+ let transactions = getChildItemsTransactions(root);
+ root.containerOpen = false;
+
if (aData.dateAdded) {
transactions.push(
new PlacesEditItemDateAddedTransaction(null, aData.dateAdded)
diff --git a/application/palemoon/components/places/content/controller.js b/application/palemoon/components/places/content/controller.js
index 7f27e8347..7f5f7f652 100644
--- a/application/palemoon/components/places/content/controller.js
+++ b/application/palemoon/components/places/content/controller.js
@@ -1287,15 +1287,15 @@ PlacesController.prototype = {
if (!didSuppressNotifications)
result.suppressNotifications = true;
- function addData(type, index, overrideURI) {
- let wrapNode = PlacesUtils.wrapNode(node, type, overrideURI, doCopy);
+ function addData(type, index, feedURI) {
+ let wrapNode = PlacesUtils.wrapNode(node, type, feedURI);
dt.mozSetDataAt(type, wrapNode, index);
}
- function addURIData(index, overrideURI) {
- addData(PlacesUtils.TYPE_X_MOZ_URL, index, overrideURI);
- addData(PlacesUtils.TYPE_UNICODE, index, overrideURI);
- addData(PlacesUtils.TYPE_HTML, index, overrideURI);
+ function addURIData(index, feedURI) {
+ addData(PlacesUtils.TYPE_X_MOZ_URL, index, feedURI);
+ addData(PlacesUtils.TYPE_UNICODE, index, feedURI);
+ addData(PlacesUtils.TYPE_HTML, index, feedURI);
}
try {
@@ -1387,12 +1387,11 @@ PlacesController.prototype = {
copiedFolders.push(node);
let livemarkInfo = this.getCachedLivemarkInfo(node);
- let overrideURI = livemarkInfo ? livemarkInfo.feedURI.spec : null;
- let resolveShortcuts = !PlacesControllerDragHelper.canMoveNode(node);
+ let feedURI = livemarkInfo && livemarkInfo.feedURI.spec;
contents.forEach(function (content) {
content.entries.push(
- PlacesUtils.wrapNode(node, content.type, overrideURI, resolveShortcuts)
+ PlacesUtils.wrapNode(node, content.type, feedURI)
);
});
}, this);