スターボタンを押した時のポップアップでのツリー構造の編集が保存されていなかった

git-svn-id: http://www.cozmixng.org/repos/piro/treestyletab/trunk@4935 599a83e7-65a4-db11-8015-0010dcdd6dc2
This commit is contained in:
piro 2009-08-11 07:06:04 +00:00
parent 41b40ae291
commit e301ea416e

View File

@ -1,6 +1,7 @@
var TreeStyleTabBookmarksServiceEditable = { var TreeStyleTabBookmarksServiceEditable = {
instantApply : false, instantApply : false,
canceled : false,
get parentRow() get parentRow()
{ {
@ -27,21 +28,47 @@ var TreeStyleTabBookmarksServiceEditable = {
init : function() init : function()
{ {
// main browser window
if ('StarUI' in window) { if ('StarUI' in window) {
if ('_doShowEditBookmarkPanel' in StarUI) { if ('_doShowEditBookmarkPanel' in StarUI) {
eval('StarUI._doShowEditBookmarkPanel = '+StarUI._doShowEditBookmarkPanel.toSource().replace( eval('StarUI._doShowEditBookmarkPanel = '+StarUI._doShowEditBookmarkPanel.toSource().replace(
'{', '{',
'{ TreeStyleTabBookmarksServiceEditable.initUI();' '{ TreeStyleTabBookmarksServiceEditable.initEditUI();'
));
}
if ('quitEditMode' in StarUI) {
eval('StarUI.quitEditMode = '+StarUI.quitEditMode.toSource().replace(
'{',
'{ TreeStyleTabBookmarksServiceEditable.saveParentFor(this._itemId);'
));
}
if ('cancelButtonOnCommand' in StarUI) {
eval('StarUI.cancelButtonOnCommand = '+StarUI.cancelButtonOnCommand.toSource().replace(
'{',
'{ TreeStyleTabBookmarksServiceEditable.canceled = true;'
)); ));
} }
} }
this.initUI(); // Bookmarks Property dialog
if ('BookmarkPropertiesPanel' in window) {
eval('BookmarkPropertiesPanel._endBatch = '+BookmarkPropertiesPanel._endBatch.toSource().replace(
'PlacesUIUtils.ptm.endBatch();',
'$& TreeStyleTabBookmarksServiceEditable.saveParentFor(this._itemId);'
));
}
// Places Organizer (Library)
if ('PlacesOrganizer' in window) {
this.instantApply = true;
}
this.initEditUI();
}, },
initUI : function() initEditUI : function()
{ {
if (this.UIInitialized || !('gEditItemOverlay' in window)) return; if (this.editUIInitialized || !('gEditItemOverlay' in window)) return;
var container = document.getElementById('editBookmarkPanelGrid'); var container = document.getElementById('editBookmarkPanelGrid');
if (!container) return; if (!container) return;
@ -87,22 +114,9 @@ var TreeStyleTabBookmarksServiceEditable = {
'$& if (aNewParent == this._getFolderIdFromMenuList()) TreeStyleTabBookmarksServiceEditable.initParentMenuList();' '$& if (aNewParent == this._getFolderIdFromMenuList()) TreeStyleTabBookmarksServiceEditable.initParentMenuList();'
)); ));
// Bookmarks Property dialog this.editUIInitialized = true;
if ('BookmarkPropertiesPanel' in window) {
eval('BookmarkPropertiesPanel._endBatch = '+BookmarkPropertiesPanel._endBatch.toSource().replace(
'PlacesUIUtils.ptm.endBatch();',
'$& TreeStyleTabBookmarksServiceEditable.saveParentFor(this._itemId);'
));
}
// Places Organizer (Library)
if ('PlacesOrganizer' in window) {
this.instantApply = true;
}
this.UIInitialized = true;
}, },
UIInitialized : false, editUIInitialized : false,
initParentMenuList : function() initParentMenuList : function()
{ {
@ -123,6 +137,8 @@ var TreeStyleTabBookmarksServiceEditable = {
var selected = popup.getElementsByAttribute('selected', 'true')[0]; var selected = popup.getElementsByAttribute('selected', 'true')[0];
this.menulist.value = (selected || this.blankItem).getAttribute('value'); this.menulist.value = (selected || this.blankItem).getAttribute('value');
this.canceled = false;
}, },
_createSiblingsFragment : function(aCurrentItem) _createSiblingsFragment : function(aCurrentItem)
{ {
@ -187,7 +203,7 @@ var TreeStyleTabBookmarksServiceEditable = {
saveParentFor : function(aId) saveParentFor : function(aId)
{ {
var newParentId = parseInt(this.menulist.value || -1); var newParentId = parseInt(this.menulist.value || -1);
if (newParentId == this.getParentItem(aId)) return; if (this.canceled || newParentId == this.getParentItem(aId)) return;
var items = this._getSiblingItems(aId); var items = this._getSiblingItems(aId);
var treeStructure = this.getTreeStructureFromItems(items); var treeStructure = this.getTreeStructureFromItems(items);