41 let
Ci = Components.interfaces;
42 let
Cc = Components.classes;
43 let
Cr = Components.results;
49 const CLASS_ID = Components.ID(
"c0844a84-5a12-4808-80a8-809cb002bb4f");
50 const CONTRACT_ID =
"@mozilla.org/browser/placesTransactionsService;1";
52 Components.utils.import(
"resource://gre/modules/XPCOMUtils.jsm");
55 delete this.PlacesUtils
57 Components.utils.import(
"resource://gre/modules/utils.js", tmpScope);
58 return this.PlacesUtils = tmpScope.PlacesUtils;
66 this.mTransactionManager =
Cc[
"@mozilla.org/transactionmanager;1"].
76 Ci.nsITransactionManager]),
78 aggregateTransactions:
79 function placesTxn_aggregateTransactions(
aName, aTransactions) {
84 function placesTxn_createFolder(
aName, aContainer, aIndex,
85 aAnnotations, aChildItemsTransactions) {
87 aAnnotations, aChildItemsTransactions);
91 function placesTxn_createItem(aURI, aContainer, aIndex, aTitle,
92 aKeyword, aAnnotations, aChildTransactions) {
94 aKeyword, aAnnotations, aChildTransactions);
98 function placesTxn_createSeparator(aContainer, aIndex) {
103 function placesTxn_createLivemark(aFeedURI, aSiteURI,
aName,
104 aContainer, aIndex, aAnnotations) {
106 aContainer, aIndex, aAnnotations);
110 function placesTxn_moveItem(aItemId, aNewContainer, aNewIndex) {
115 function placesTxn_removeItem(aItemId) {
116 if (aItemId == PlacesUtils.tagsFolderId ||
117 aItemId == PlacesUtils.placesRootId ||
118 aItemId == PlacesUtils.bookmarksMenuFolderId ||
119 aItemId == PlacesUtils.toolbarFolderId)
120 throw Cr.NS_ERROR_INVALID_ARG;
123 var parent = PlacesUtils.bookmarks.getFolderIdForItem(aItemId);
124 var grandparent = PlacesUtils.bookmarks.getFolderIdForItem(parent);
125 if (grandparent == PlacesUtils.tagsFolderId) {
126 var
uri = PlacesUtils.bookmarks.getBookmarkURI(aItemId);
127 return this.untagURI(uri, [parent]);
132 if (PlacesUtils.itemIsLivemark(aItemId))
139 function placesTxn_editItemTitle(aItemId, aNewTitle) {
144 function placesTxn_editBookmarkURI(aItemId, aNewURI) {
149 function placesTxn_setItemAnnotation(aItemId, aAnnotationObject) {
154 function placesTxn_setPageAnnotation(aURI, aAnnotationObject) {
159 function placesTxn_setLoadInSidebar(aItemId, aLoadInSidebar) {
161 type:
Ci.nsIAnnotationService.TYPE_INT32,
163 value: aLoadInSidebar,
164 expires:
Ci.nsIAnnotationService.EXPIRE_NEVER };
165 return this.setItemAnnotation(aItemId, annoObj);
169 function placesTxn_editItemDescription(aItemId, aDescription) {
171 type:
Ci.nsIAnnotationService.TYPE_STRING,
174 expires:
Ci.nsIAnnotationService.EXPIRE_NEVER };
175 return this.setItemAnnotation(aItemId, annoObj);
179 function placesTxn_editBookmarkKeyword(aItemId, aNewKeyword) {
183 editBookmarkPostData:
184 function placesTxn_editBookmarkPostdata(aItemId, aPostData) {
189 function placesTxn_editLivemarkSiteURI(aLivemarkId, aSiteURI) {
194 function placesTxn_editLivemarkFeedURI(aLivemarkId, aFeedURI) {
198 editBookmarkMicrosummary:
199 function placesTxn_editBookmarkMicrosummary(aItemId, aNewMicrosummary) {
204 function placesTxn_editItemDateAdded(aItemId, aNewDateAdded) {
208 editItemLastModified:
209 function placesTxn_editItemLastModified(aItemId, aNewLastModified) {
214 function placesTxn_sortFolderByName(aFolderId) {
219 function placesTxn_tagURI(aURI, aTags) {
224 function placesTxn_untagURI(aURI, aTags) {
230 _updateCommands:
function placesTxn__updateCommands() {
231 var
wm =
Cc[
"@mozilla.org/appshell/window-mediator;1"].
233 var
win = wm.getMostRecentWindow(
null);
235 win.updateCommands(
"undo");
239 beginBatch:
function() {
240 this.mTransactionManager.beginBatch();
250 this.doTransaction({ doTransaction:
function() { },
251 undoTransaction:
function() { },
252 redoTransaction:
function() { },
254 merge:
function() {
return false; } });
257 endBatch:
function() this.mTransactionManager.endBatch(),
259 doTransaction:
function placesTxn_doTransaction(txn) {
260 this.mTransactionManager.doTransaction(txn);
261 this._updateCommands();
264 undoTransaction:
function placesTxn_undoTransaction() {
265 this.mTransactionManager.undoTransaction();
266 this._updateCommands();
269 redoTransaction:
function placesTxn_redoTransaction() {
270 this.mTransactionManager.redoTransaction();
271 this._updateCommands();
274 clear:
function() this.mTransactionManager.clear(),
276 get numberOfUndoItems() {
277 return this.mTransactionManager.numberOfUndoItems;
280 get numberOfRedoItems() {
281 return this.mTransactionManager.numberOfRedoItems;
284 get maxTransactionCount() {
285 return this.mTransactionManager.maxTransactionCount;
287 set maxTransactionCount(
val) {
288 return this.mTransactionManager.maxTransactionCount =
val;
291 peekUndoStack:
function() this.mTransactionManager.peekUndoStack(),
292 peekRedoStack:
function() this.mTransactionManager.peekRedoStack(),
293 getUndoStack:
function() this.mTransactionManager.getUndoStack(),
294 getRedoStack:
function() this.mTransactionManager.getRedoStack(),
295 AddListener:
function(l) this.mTransactionManager.AddListener(l),
296 RemoveListener:
function(l) this.mTransactionManager.RemoveListener(l)
307 get wrappedJSObject() {
312 redoTransaction:
function PBT_redoTransaction() {
313 throw Cr.NS_ERROR_NOT_IMPLEMENTED;
320 merge:
function mergeFunc(transaction) {
329 this._transactions = transactions;
332 this.redoTransaction = this.doTransaction;
336 var countTransactions =
function(aTransactions, aTxnCount) {
340 let txn = aTransactions[
i].wrappedJSObject;
341 if (txn && txn.childTransactions && txn.childTransactions.length)
342 aTxnCount = countTransactions(txn.childTransactions, aTxnCount);
347 var txnCount = countTransactions(transactions, 0);
354 doTransaction:
function PAT_doTransaction() {
355 if (this._useBatch) {
358 runBatched:
function() {
359 this._self.commit(
false);
362 PlacesUtils.bookmarks.runInBatchMode(callback,
null);
368 undoTransaction:
function PAT_undoTransaction() {
369 if (this._useBatch) {
372 runBatched:
function() {
373 this._self.commit(
true);
376 PlacesUtils.bookmarks.runInBatchMode(callback,
null);
382 commit:
function PAT_commit(aUndo) {
385 var transactions = this._transactions.slice(0);
387 transactions.reverse();
388 for (var
i = 0;
i < transactions.length;
i++) {
389 var txn = transactions[
i];
390 if (this.container > -1)
391 txn.wrappedJSObject.container = this.container;
393 txn.undoTransaction();
402 aChildItemsTransactions) {
404 this._container = aContainer;
405 this._index = typeof(aIndex) ==
"number" ? aIndex : -1;
406 this._annotations = aAnnotations;
408 this.childTransactions = aChildItemsTransactions || [];
409 this.redoTransaction = this.doTransaction;
416 get container() {
return this._container; },
417 set container(
val) {
return this._container =
val; },
419 doTransaction:
function PCFT_doTransaction() {
420 this._id = PlacesUtils.bookmarks.createFolder(this._container,
421 this._name, this._index);
422 if (this._annotations && this._annotations.length > 0)
423 PlacesUtils.setAnnotationsForItem(this._id, this._annotations);
425 if (this.childTransactions.length) {
427 for (var
i = 0;
i < this.childTransactions.length; ++
i) {
428 this.childTransactions[
i].wrappedJSObject.container = this._id;
432 this.childTransactions);
433 aggregateTxn.doTransaction();
437 PlacesUtils.bookmarks.setItemGUID(this._id, this._GUID);
440 undoTransaction:
function PCFT_undoTransaction() {
441 if (this.childTransactions.length) {
443 this.childTransactions);
444 aggregateTxn.undoTransaction();
448 if (PlacesUtils.annotations.itemHasAnnotation(
this._id,
GUID_ANNO))
449 this._GUID = PlacesUtils.bookmarks.getItemGUID(
this._id);
452 PlacesUtils.bookmarks.removeItem(this._id);
457 aKeyword, aAnnotations,
458 aChildTransactions) {
460 this._container = aContainer;
461 this._index = typeof(aIndex) ==
"number" ? aIndex : -1;
462 this._title = aTitle;
463 this._keyword = aKeyword;
464 this._annotations = aAnnotations;
465 this.childTransactions = aChildTransactions || [];
466 this.redoTransaction = this.doTransaction;
473 get container() {
return this._container; },
474 set container(
val) {
return this._container =
val; },
476 doTransaction:
function PCIT_doTransaction() {
477 this._id = PlacesUtils.bookmarks.insertBookmark(this.container, this._uri,
478 this._index, this._title);
480 PlacesUtils.bookmarks.setKeywordForBookmark(this._id, this._keyword);
481 if (this._annotations && this._annotations.length > 0)
482 PlacesUtils.setAnnotationsForItem(this._id, this._annotations);
484 if (this.childTransactions.length) {
486 for (var
i = 0;
i < this.childTransactions.length; ++
i) {
487 this.childTransactions[
i].wrappedJSObject.id = this._id;
490 this.childTransactions);
491 aggregateTxn.doTransaction();
494 PlacesUtils.bookmarks.setItemGUID(this._id, this._GUID);
497 undoTransaction:
function PCIT_undoTransaction() {
498 if (this.childTransactions.length) {
501 this.childTransactions);
502 aggregateTxn.undoTransaction();
506 if (PlacesUtils.annotations.itemHasAnnotation(
this._id,
GUID_ANNO))
507 this._GUID = PlacesUtils.bookmarks.getItemGUID(
this._id);
510 PlacesUtils.bookmarks.removeItem(this._id);
515 this._container = aContainer;
516 this._index = typeof(aIndex) ==
"number" ? aIndex : -1;
518 this.redoTransaction = this.doTransaction;
525 get container() {
return this._container; },
526 set container(
val) {
return this._container =
val; },
528 doTransaction:
function PCST_doTransaction() {
529 this._id = PlacesUtils.bookmarks
530 .insertSeparator(this.container, this._index);
532 PlacesUtils.bookmarks.setItemGUID(this._id, this._GUID);
535 undoTransaction:
function PCST_undoTransaction() {
537 if (PlacesUtils.annotations.itemHasAnnotation(
this._id,
GUID_ANNO))
538 this._GUID = PlacesUtils.bookmarks.getItemGUID(
this._id);
540 PlacesUtils.bookmarks.removeItem(this._id);
547 this.redoTransaction = this.doTransaction;
549 this._siteURI = aSiteURI;
551 this._container = aContainer;
552 this._index = typeof(aIndex) ==
"number" ? aIndex : -1;
553 this._annotations = aAnnotations;
560 get container() {
return this._container; },
561 set container(
val) {
return this._container =
val; },
563 doTransaction:
function PCLT_doTransaction() {
564 this._id = PlacesUtils.livemarks.createLivemark(this._container, this._name,
567 if (this._annotations && this._annotations.length > 0)
568 PlacesUtils.setAnnotationsForItem(this._id, this._annotations);
570 PlacesUtils.bookmarks.setItemGUID(this._id, this._GUID);
573 undoTransaction:
function PCLT_undoTransaction() {
575 if (PlacesUtils.annotations.itemHasAnnotation(
this._id,
GUID_ANNO))
576 this._GUID = PlacesUtils.bookmarks.getItemGUID(
this._id);
578 PlacesUtils.bookmarks.removeItem(this._id);
583 this.redoTransaction = this.doTransaction;
584 this._id = aFolderId;
585 this._title = PlacesUtils.bookmarks.getItemTitle(this._id);
586 this._container = PlacesUtils.bookmarks.getFolderIdForItem(this._id);
587 var annos = PlacesUtils.getAnnotationsForItem(this._id);
589 var annosToExclude = [
"livemark/feedURI",
591 "livemark/expiration",
592 "livemark/loadfailed",
594 this._annotations = annos.filter(
function(
aValue, aIndex, aArray) {
595 return annosToExclude.indexOf(
aValue.name) == -1;
597 this.
_feedURI = PlacesUtils.livemarks.getFeedURI(this._id);
598 this._siteURI = PlacesUtils.livemarks.getSiteURI(this._id);
599 this._dateAdded = PlacesUtils.bookmarks.getItemDateAdded(this._id);
600 this._lastModified = PlacesUtils.bookmarks.getItemLastModified(this._id);
606 doTransaction:
function PRLT_doTransaction() {
607 this._index = PlacesUtils.bookmarks.getItemIndex(this._id);
608 PlacesUtils.bookmarks.removeItem(this._id);
611 undoTransaction:
function PRLT_undoTransaction() {
612 this._id = PlacesUtils.livemarks.createLivemark(this._container,
617 PlacesUtils.bookmarks.setItemDateAdded(this._id, this._dateAdded);
618 PlacesUtils.bookmarks.setItemLastModified(this._id, this._lastModified);
620 PlacesUtils.setAnnotationsForItem(this._id, this._annotations);
626 this._oldContainer = PlacesUtils.bookmarks.getFolderIdForItem(this._id);
627 this._newContainer = aNewContainer;
628 this._newIndex = aNewIndex;
629 this.redoTransaction = this.doTransaction;
635 doTransaction:
function PMIT_doTransaction() {
636 this._oldIndex = PlacesUtils.bookmarks.getItemIndex(this._id);
637 PlacesUtils.bookmarks.moveItem(this._id, this._newContainer, this._newIndex);
638 this._undoIndex = PlacesUtils.bookmarks.getItemIndex(this._id);
641 undoTransaction:
function PMIT_undoTransaction() {
644 if (this._newContainer == this._oldContainer &&
645 this._oldIndex > this._undoIndex)
646 PlacesUtils.bookmarks.moveItem(this._id, this._oldContainer, this._oldIndex + 1);
648 PlacesUtils.bookmarks.moveItem(this._id, this._oldContainer, this._oldIndex);
653 this.redoTransaction = this.doTransaction;
655 this._itemType = PlacesUtils.bookmarks.getItemType(this._id);
656 if (this._itemType ==
Ci.nsINavBookmarksService.TYPE_FOLDER) {
657 this.childTransactions = this._getFolderContentsTransactions();
659 let txn = PlacesUtils.bookmarks.getRemoveFolderTransaction(this._id);
660 this.childTransactions.push(txn);
662 else if (this._itemType ==
Ci.nsINavBookmarksService.TYPE_BOOKMARK) {
663 this._uri = PlacesUtils.bookmarks.getBookmarkURI(this._id);
664 this._keyword = PlacesUtils.bookmarks.getKeywordForBookmark(this._id);
667 if (this._itemType !=
Ci.nsINavBookmarksService.TYPE_SEPARATOR)
668 this._title = PlacesUtils.bookmarks.getItemTitle(this._id);
670 this._oldContainer = PlacesUtils.bookmarks.getFolderIdForItem(this._id);
671 this._annotations = PlacesUtils.getAnnotationsForItem(this._id);
672 this._dateAdded = PlacesUtils.bookmarks.getItemDateAdded(this._id);
673 this._lastModified = PlacesUtils.bookmarks.getItemLastModified(this._id);
679 doTransaction:
function PRIT_doTransaction() {
680 this._oldIndex = PlacesUtils.bookmarks.getItemIndex(this._id);
682 if (this._itemType ==
Ci.nsINavBookmarksService.TYPE_FOLDER) {
684 this.childTransactions);
685 aggregateTxn.doTransaction();
688 PlacesUtils.bookmarks.removeItem(this._id);
693 if (PlacesUtils.getMostRecentBookmarkForURI(
this._uri) == -1) {
694 this._tags = PlacesUtils.tagging.getTagsForURI(this._uri, {});
695 PlacesUtils.tagging.untagURI(this._uri, this._tags);
701 undoTransaction:
function PRIT_undoTransaction() {
702 if (this._itemType ==
Ci.nsINavBookmarksService.TYPE_BOOKMARK) {
703 this._id = PlacesUtils.bookmarks.insertBookmark(this._oldContainer,
707 if (this._tags && this._tags.length > 0)
708 PlacesUtils.tagging.tagURI(this._uri, this._tags);
710 PlacesUtils.bookmarks.setKeywordForBookmark(this._id, this._keyword);
712 else if (this._itemType ==
Ci.nsINavBookmarksService.TYPE_FOLDER) {
714 this.childTransactions);
715 aggregateTxn.undoTransaction();
718 this._id = PlacesUtils.bookmarks.insertSeparator(this._oldContainer, this._oldIndex);
720 if (this._annotations.length > 0)
721 PlacesUtils.setAnnotationsForItem(this._id, this._annotations);
723 PlacesUtils.bookmarks.setItemDateAdded(this._id, this._dateAdded);
724 PlacesUtils.bookmarks.setItemLastModified(this._id, this._lastModified);
731 _getFolderContentsTransactions:
732 function PRIT__getFolderContentsTransactions() {
733 var transactions = [];
735 PlacesUtils.getFolderContents(this._id,
false,
false).root;
736 for (var
i = 0;
i < contents.childCount; ++
i) {
738 transactions.push(txn);
740 contents.containerOpen =
false;
742 return transactions.reverse();
748 this._newTitle = newTitle;
750 this.redoTransaction = this.doTransaction;
756 doTransaction:
function PEITT_doTransaction() {
757 this._oldTitle = PlacesUtils.bookmarks.getItemTitle(this._id);
758 PlacesUtils.bookmarks.setItemTitle(this._id, this._newTitle);
761 undoTransaction:
function PEITT_undoTransaction() {
762 PlacesUtils.bookmarks.setItemTitle(this._id, this._oldTitle);
767 this._id = aBookmarkId;
768 this._newURI = aNewURI;
769 this.redoTransaction = this.doTransaction;
775 doTransaction:
function PEBUT_doTransaction() {
776 this._oldURI = PlacesUtils.bookmarks.getBookmarkURI(this._id);
777 PlacesUtils.bookmarks.changeBookmarkURI(this._id, this._newURI);
779 this._tags = PlacesUtils.tagging.getTagsForURI(this._oldURI, {});
780 if (this._tags.length != 0) {
782 if (PlacesUtils.getBookmarksForURI(
this._oldURI, {}).length == 0)
783 PlacesUtils.tagging.untagURI(this._oldURI, this._tags);
784 PlacesUtils.tagging.tagURI(this._newURI, this._tags);
788 undoTransaction:
function PEBUT_undoTransaction() {
789 PlacesUtils.bookmarks.changeBookmarkURI(this._id, this._oldURI);
791 if (this._tags.length != 0) {
793 if (PlacesUtils.getBookmarksForURI(
this._newURI, {}).length == 0)
794 PlacesUtils.tagging.untagURI(this._newURI, this._tags);
795 PlacesUtils.tagging.tagURI(this._oldURI, this._tags);
802 this._anno = aAnnotationObject;
804 this._oldAnno = {
name: this._anno.name,
805 type:
Ci.nsIAnnotationService.TYPE_STRING,
808 expires:
Ci.nsIAnnotationService.EXPIRE_NEVER };
809 this.redoTransaction = this.doTransaction;
815 doTransaction:
function PSIAT_doTransaction() {
818 if (PlacesUtils.annotations.itemHasAnnotation(
this.id,
this._anno.name)) {
820 var
flags = {}, expires = {}, mimeType = {}, type = {};
821 PlacesUtils.annotations.getItemAnnotationInfo(this.
id, this._anno.name,
822 flags, expires, mimeType,
824 this._oldAnno.flags = flags.value;
825 this._oldAnno.expires = expires.value;
826 this._oldAnno.mimeType = mimeType.value;
827 this._oldAnno.type = type.value;
828 this._oldAnno.value = PlacesUtils.annotations
829 .getItemAnnotation(this.
id,
833 PlacesUtils.setAnnotationsForItem(this.
id, [this._anno]);
836 undoTransaction:
function PSIAT_undoTransaction() {
837 PlacesUtils.setAnnotationsForItem(this.
id, [this._oldAnno]);
843 this._anno = aAnnotationObject;
845 this._oldAnno = {
name: this._anno.name,
846 type:
Ci.nsIAnnotationService.TYPE_STRING,
849 expires:
Ci.nsIAnnotationService.EXPIRE_NEVER };
851 if (PlacesUtils.annotations.pageHasAnnotation(
this._uri,
this._anno.name)) {
853 var flags = {}, expires = {}, mimeType = {}, type = {};
854 PlacesUtils.annotations.getPageAnnotationInfo(this._uri, this._anno.name,
855 flags, expires, mimeType, type);
856 this._oldAnno.flags = flags.value;
857 this._oldAnno.expires = expires.value;
858 this._oldAnno.mimeType = mimeType.value;
859 this._oldAnno.type = type.value;
860 this._oldAnno.value = PlacesUtils.annotations
861 .getPageAnnotation(this._uri, this._anno.name);
864 this.redoTransaction = this.doTransaction;
870 doTransaction:
function PSPAT_doTransaction() {
871 PlacesUtils.setAnnotationsForURI(this._uri, [this._anno]);
874 undoTransaction:
function PSPAT_undoTransaction() {
875 PlacesUtils.setAnnotationsForURI(this._uri, [this._oldAnno]);
881 this._newKeyword = newKeyword;
882 this._oldKeyword =
"";
883 this.redoTransaction = this.doTransaction;
889 doTransaction:
function PEBKT_doTransaction() {
890 this._oldKeyword = PlacesUtils.bookmarks.getKeywordForBookmark(this.
id);
891 PlacesUtils.bookmarks.setKeywordForBookmark(this.
id, this._newKeyword);
894 undoTransaction:
function PEBKT_undoTransaction() {
895 PlacesUtils.bookmarks.setKeywordForBookmark(this.
id, this._oldKeyword);
901 this._newPostData = aPostData;
902 this._oldPostData =
null;
903 this.redoTransaction = this.doTransaction;
909 doTransaction:
function PEUPDT_doTransaction() {
910 this._oldPostData = PlacesUtils.getPostDataForBookmark(this.
id);
911 PlacesUtils.setPostDataForBookmark(this.
id, this._newPostData);
914 undoTransaction:
function PEUPDT_undoTransaction() {
915 PlacesUtils.setPostDataForBookmark(this.
id, this._oldPostData);
920 this._folderId = folderId;
923 this.redoTransaction = this.doTransaction;
929 doTransaction:
function PELSUT_doTransaction() {
930 this._oldURI = PlacesUtils.livemarks.getSiteURI(this._folderId);
931 PlacesUtils.livemarks.setSiteURI(this._folderId, this._newURI);
934 undoTransaction:
function PELSUT_undoTransaction() {
935 PlacesUtils.livemarks.setSiteURI(this._folderId, this._oldURI);
940 this._folderId = folderId;
943 this.redoTransaction = this.doTransaction;
949 doTransaction:
function PELFUT_doTransaction() {
950 this._oldURI = PlacesUtils.livemarks.getFeedURI(this._folderId);
951 PlacesUtils.livemarks.setFeedURI(this._folderId, this._newURI);
952 PlacesUtils.livemarks.reloadLivemarkFolder(this._folderId);
955 undoTransaction:
function PELFUT_undoTransaction() {
956 PlacesUtils.livemarks.setFeedURI(this._folderId, this._oldURI);
957 PlacesUtils.livemarks.reloadLivemarkFolder(this._folderId);
963 this._mss =
Cc[
"@mozilla.org/microsummary/service;1"].
965 this._newMicrosummary = newMicrosummary;
966 this._oldMicrosummary =
null;
967 this.redoTransaction = this.doTransaction;
973 doTransaction:
function PEBMT_doTransaction() {
974 this._oldMicrosummary = this._mss.getMicrosummary(this.
id);
975 if (this._newMicrosummary)
976 this._mss.setMicrosummary(this.
id, this._newMicrosummary);
978 this._mss.removeMicrosummary(this.
id);
981 undoTransaction:
function PEBMT_undoTransaction() {
982 if (this._oldMicrosummary)
983 this._mss.setMicrosummary(this.
id, this._oldMicrosummary);
985 this._mss.removeMicrosummary(this.
id);
991 this._newDateAdded = newDateAdded;
992 this._oldDateAdded =
null;
993 this.redoTransaction = this.doTransaction;
1000 get container() {
return this.
id; },
1001 set container(
val) {
return this.
id =
val; },
1003 doTransaction:
function PEIDA_doTransaction() {
1004 this._oldDateAdded = PlacesUtils.bookmarks.getItemDateAdded(this.
id);
1005 PlacesUtils.bookmarks.setItemDateAdded(this.
id, this._newDateAdded);
1008 undoTransaction:
function PEIDA_undoTransaction() {
1009 PlacesUtils.bookmarks.setItemDateAdded(this.
id, this._oldDateAdded);
1015 this._newLastModified = newLastModified;
1016 this._oldLastModified =
null;
1017 this.redoTransaction = this.doTransaction;
1024 get container() {
return this.
id; },
1025 set container(
val) {
return this.
id =
val; },
1027 doTransaction:
function PEILM_doTransaction() {
1028 this._oldLastModified = PlacesUtils.bookmarks.getItemLastModified(this.
id);
1029 PlacesUtils.bookmarks.setItemLastModified(this.
id, this._newLastModified);
1032 undoTransaction:
function PEILM_undoTransaction() {
1033 PlacesUtils.bookmarks.setItemLastModified(this.
id, this._oldLastModified);
1038 this._folderId = aFolderId;
1039 this._oldOrder =
null,
1040 this.redoTransaction = this.doTransaction;
1046 doTransaction:
function PSSFBN_doTransaction() {
1047 this._oldOrder = [];
1050 PlacesUtils.getFolderContents(this._folderId,
false,
false).root;
1051 var
count = contents.childCount;
1058 if (PlacesUtils.nodeIsContainer(a) && !PlacesUtils.nodeIsContainer(b))
1060 if (!PlacesUtils.nodeIsContainer(a) && PlacesUtils.nodeIsContainer(b))
1062 return a.title.localeCompare(b.title);
1066 var item = contents.getChild(
i);
1067 this._oldOrder[item.itemId] =
i;
1068 if (PlacesUtils.nodeIsSeparator(item)) {
1069 if (preSep.length > 0) {
1070 preSep.sort(sortingMethod);
1071 newOrder = newOrder.concat(preSep);
1074 newOrder.push(item);
1079 contents.containerOpen =
false;
1081 if (preSep.length > 0) {
1082 preSep.sort(sortingMethod);
1083 newOrder = newOrder.concat(preSep);
1088 runBatched:
function() {
1089 for (var
i = 0;
i < newOrder.length; ++
i) {
1090 PlacesUtils.bookmarks.setItemIndex(newOrder[
i].itemId,
i);
1094 PlacesUtils.bookmarks.runInBatchMode(callback,
null);
1097 undoTransaction:
function PSSFBN_undoTransaction() {
1100 runBatched:
function() {
1101 for (item in this._self._oldOrder)
1102 PlacesUtils.bookmarks.setItemIndex(item, this._self._oldOrder[item]);
1105 PlacesUtils.bookmarks.runInBatchMode(callback,
null);
1112 this._unfiledItemId = -1;
1113 this.redoTransaction = this.doTransaction;
1119 doTransaction:
function PTU_doTransaction() {
1120 if (PlacesUtils.getMostRecentBookmarkForURI(
this._uri) == -1) {
1122 this._unfiledItemId =
1123 PlacesUtils.bookmarks
1124 .insertBookmark(PlacesUtils.unfiledBookmarksFolderId,
1126 PlacesUtils.bookmarks.DEFAULT_INDEX,
1127 PlacesUtils.history.getPageTitle(
this._uri));
1129 PlacesUtils.bookmarks.setItemGUID(this._unfiledItemId, this._GUID);
1131 PlacesUtils.tagging.tagURI(this._uri, this._tags);
1134 undoTransaction:
function PTU_undoTransaction() {
1135 if (this._unfiledItemId != -1) {
1137 if (PlacesUtils.annotations.itemHasAnnotation(
this._unfiledItemId,
GUID_ANNO)) {
1138 this._GUID = PlacesUtils.bookmarks.getItemGUID(this._unfiledItemId);
1140 PlacesUtils.bookmarks.removeItem(this._unfiledItemId);
1141 this._unfiledItemId = -1;
1143 PlacesUtils.tagging.untagURI(this._uri, this._tags);
1154 for (var
i=0;
i < aTags.length;
i++) {
1155 if (typeof(this._tags[
i]) ==
"number")
1156 this._tags[
i] = PlacesUtils.bookmarks.getItemTitle(this._tags[i]);
1160 this._tags = PlacesUtils.tagging.getTagsForURI(this._uri, {});
1162 this.redoTransaction = this.doTransaction;
1168 doTransaction:
function PUTU_doTransaction() {
1169 PlacesUtils.tagging.untagURI(this._uri, this._tags);
1172 undoTransaction:
function PUTU_undoTransaction() {
1173 PlacesUtils.tagging.tagURI(this._uri, this._tags);
function placesSortFolderByNameTransactions(aFolderId)
const LOAD_IN_SIDEBAR_ANNO
function placesEditItemDateAddedTransaction(id, newDateAdded)
__defineGetter__("PlacesUtils", function(){delete this.PlacesUtils var tmpScope={};Components.utils.import("resource://gre/modules/utils.js", tmpScope);return this.PlacesUtils=tmpScope.PlacesUtils;})
function NSGetModule(aCompMgr, aFileSpec)
sbDeviceFirmwareAutoCheckForUpdate prototype flags
function placesEditBookmarkKeywordTransactions(id, newKeyword)
sbDeviceFirmwareAutoCheckForUpdate prototype contractID
function placesCreateSeparatorTransactions(aContainer, aIndex)
sbOSDControlService prototype QueryInterface
sbDeviceFirmwareAutoCheckForUpdate prototype classDescription
function placesMoveItemTransactions(aItemId, aNewContainer, aNewIndex)
getService(Ci.sbIFaceplateManager)
function placesTagURITransaction(aURI, aTags)
function placesEditLivemarkSiteURITransactions(folderId, uri)
function placesRemoveItemTransaction(aItemId)
function placesSetItemAnnotationTransactions(aItemId, aAnnotationObject)
this _dialogInput val(dateText)
function placesEditBookmarkPostDataTransactions(aItemId, aPostData)
function placesEditItemTitleTransactions(id, newTitle)
function placesBaseTransaction()
function placesCreateItemTransactions(aURI, aContainer, aIndex, aTitle, aKeyword, aAnnotations, aChildTransactions)
function placesEditLivemarkFeedURITransactions(folderId, uri)
function placesSetPageAnnotationTransactions(aURI, aAnnotationObject)
function placesUntagURITransaction(aURI, aTags)
function placesCreateLivemarkTransactions(aFeedURI, aSiteURI, aName, aContainer, aIndex, aAnnotations)
function placesRemoveLivemarkTransaction(aFolderId)
function placesTransactionsService()
sbDeviceFirmwareAutoCheckForUpdate prototype classID
function placesEditBookmarkURITransactions(aBookmarkId, aNewURI)
function placesCreateFolderTransactions(aName, aContainer, aIndex, aAnnotations, aChildItemsTransactions)
function placesEditItemLastModifiedTransaction(id, newLastModified)
function placesAggregateTransactions(name, transactions)
_getSelectedPageStyle s i
const MIN_TRANSACTIONS_FOR_BATCH
function placesEditBookmarkMicrosummaryTransactions(aItemId, newMicrosummary)