Bug 459438 - Support bulk tagging for multiple history items (r=dietrich)
authorhighmind63@gmail.com
Sat, 01 Nov 2008 19:57:07 -0700
changeset 21183 5cc686a77232ed06be4bc6c45b31ec720427165f
parent 21182 d0132a133f2db4cb8157f286688ff122d63ee944
child 21185 da70b531d41cfd38c63e6b60902cb0219e9a9a25
push id3386
push userdietrich@mozilla.com
push dateSun, 02 Nov 2008 02:57:28 +0000
treeherdermozilla-central@5cc686a77232 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersdietrich
bugs459438
milestone1.9.1b2pre
Bug 459438 - Support bulk tagging for multiple history items (r=dietrich)
browser/components/places/content/editBookmarkOverlay.js
browser/components/places/content/places.js
--- a/browser/components/places/content/editBookmarkOverlay.js
+++ b/browser/components/places/content/editBookmarkOverlay.js
@@ -190,18 +190,23 @@ var gEditItemOverlay = {
         var tags = PlacesUtils.tagging.getTagsForURI(this._uri, {}).join(", ");
         this._initTextField("tagsField", tags, false);
       }
       else {
         this._multiEdit = true;
         this._allTags = [];
         this._itemIds = aItemIdList;
         var nodeToCheck = 0;
-        for (var i = 0; i < this._itemIds.length; i++) {
-          this._uris[i] = PlacesUtils.bookmarks.getBookmarkURI(this._itemIds[i], {});
+        for (var i = 0; i < aItemIdList.length; i++) {
+          if (aItemIdList[i] instanceof Ci.nsIURI) {
+            this._uris[i] = aItemIdList[i];
+            this._itemIds[i] = -1;
+          }
+          else
+            this._uris[i] = PlacesUtils.bookmarks.getBookmarkURI(this._itemIds[i], {});
           this._tags[i] = PlacesUtils.tagging.getTagsForURI(this._uris[i], {});
           if (this._tags[i].length < this._tags[nodeToCheck].length)
             nodeToCheck =  i;
         }
         this._getCommonTags(nodeToCheck);
         this._initTextField("tagsField", this._allTags.join(", "), false);
         this._element("itemsCountText").value =
           PlacesUIUtils.getFormattedString("detailsPane.multipleItems",
--- a/browser/components/places/content/places.js
+++ b/browser/components/places/content/places.js
@@ -678,27 +678,29 @@ var PlacesOrganizer = {
                                    PlacesUtils._uri(aSelectedNode.uri),
                                    { hiddenRows: ["folderPicker"] });
       }
       this._detectAndSetDetailsPaneMinimalState(aSelectedNode);
     }
     else if (!aSelectedNode && aNodeList[0]) {
       var itemIds = [];
       for (var i = 0; i < aNodeList.length; i++) {
-        if (!PlacesUtils.nodeIsBookmark(aNodeList[i])) {
+        if (!PlacesUtils.nodeIsBookmark(aNodeList[i]) &&
+            !PlacesUtils.nodeIsURI(aNodeList[i])) {
           detailsDeck.selectedIndex = 0;
           var selectItemDesc = document.getElementById("selectItemDescription");
           var itemsCountLabel = document.getElementById("itemsCountText");
           selectItemDesc.hidden = false;
           itemsCountLabel.value =
             PlacesUIUtils.getFormattedString("detailsPane.multipleItems",
                                              [aNodeList.length]);
           return;
         }
-        itemIds[i] = PlacesUtils.getConcreteItemId(aNodeList[i]);
+        itemIds[i] = aNodeList[i].itemId != -1 ? aNodeList[i].itemId :
+                     PlacesUtils._uri(aNodeList[i].uri);
       }
       detailsDeck.selectedIndex = 1;
       gEditItemOverlay.initPanel(itemIds,
                                  { hiddenRows: ["folderPicker",
                                                 "loadInSidebar",
                                                 "location",
                                                 "keyword",
                                                 "description",