Set the predecessorid when creating records for upload.

This commit is contained in:
Edward Lee 2009-08-16 12:39:00 -07:00
Родитель 24b24d90a8
Коммит a899e3fc64
2 изменённых файлов: 15 добавлений и 3 удалений

Просмотреть файл

@ -541,14 +541,15 @@ BookmarksStore.prototype = {
} }
record.id = guid; record.id = guid;
record.parentid = this._getParentGUIDForItemId(placeId); record.parentid = this._getParentGUIDForId(placeId);
record.predecessorid = this._getPredecessorGUIDForId(placeId);
record.encryption = cryptoMetaURL; record.encryption = cryptoMetaURL;
this.cache.put(guid, record); this.cache.put(guid, record);
return record; return record;
}, },
_getParentGUIDForItemId: function BStore__getParentGUIDForItemId(itemId) { _getParentGUIDForId: function BStore__getParentGUIDForId(itemId) {
let parentid = this._bms.getFolderIdForItem(itemId); let parentid = this._bms.getFolderIdForItem(itemId);
if (parentid == -1) { if (parentid == -1) {
this._log.debug("Found orphan bookmark, reparenting to unfiled"); this._log.debug("Found orphan bookmark, reparenting to unfiled");
@ -558,6 +559,17 @@ BookmarksStore.prototype = {
return GUIDForId(parentid); return GUIDForId(parentid);
}, },
_getPredecessorGUIDForId: function BStore__getPredecessorGUIDForId(itemId) {
// Figure out the predecessor, unless it's the first item
let itemPos = Svc.Bookmark.getItemIndex(itemId);
if (itemPos == 0)
return;
let parentId = Svc.Bookmark.getFolderIdForItem(itemId);
let predecessorId = Svc.Bookmark.getIdForItemAt(parentId, itemPos - 1);
return GUIDForId(predecessorId);
},
_getChildren: function BStore_getChildren(guid, items) { _getChildren: function BStore_getChildren(guid, items) {
let node = guid; // the recursion case let node = guid; // the recursion case
if (typeof(node) == "string") // callers will give us the guid as the first arg if (typeof(node) == "string") // callers will give us the guid as the first arg

Просмотреть файл

@ -93,7 +93,7 @@ PlacesItem.prototype = {
}, },
}; };
Utils.deferGetSet(PlacesItem, "cleartext", "type"); Utils.deferGetSet(PlacesItem, "cleartext", ["predecessorid", "type"]);
function Bookmark(uri) { function Bookmark(uri) {
this._Bookmark_init(uri); this._Bookmark_init(uri);