複数のタブが閉じられようとしている時、条件によっては操作をキャンセルできるようにした

git-svn-id: http://www.cozmixng.org/repos/piro/treestyletab/trunk@5650 599a83e7-65a4-db11-8015-0010dcdd6dc2
This commit is contained in:
piro 2009-12-26 04:57:57 +00:00
parent e18a267860
commit 45b1e6473c

View File

@ -1413,7 +1413,8 @@ TreeStyleTabBrowser.prototype = {
case 'MultipleTabHandlerTabsClosing': case 'MultipleTabHandlerTabsClosing':
this.onTabsRemoved(aEvent.tabs); if (!this.onTabsRemoving(aEvent))
aEvent.preventDefault();
return; return;
} }
}, },
@ -1747,11 +1748,26 @@ TreeStyleTabBrowser.prototype = {
this.getPreviousVisibleTab(aTab); this.getPreviousVisibleTab(aTab);
}, },
onTabsRemoved : function TSTBrowser_onTabsRemoved(aTabs) onTabsRemoving : function TSTBrowser_onTabsRemoving(aEvent)
{ {
this.splitTabsToSubtrees(aTabs).forEach(function(aTabs) { var b = this.getTabBrowserFromChild(aEvent.tabs[0]);
var trees = this.splitTabsToSubtrees(aEvent.tabs);
if (trees.some(function(aTabs) {
return aTabs.length > 1 &&
!this.fireTabSubtreeClosingEvent(aTabs[0], aTabs);
}, this))
return false;
trees.forEach(function(aTabs) {
this.markAsClosedSet(aTabs); this.markAsClosedSet(aTabs);
}, this); }, this);
window.setTimeout(function(aSelf) {
trees.forEach(function(aTabs) {
aSelf.fireTabSubtreeClosedEvent(b, aTabs[0], aTabs);
});
}, 0, this);
}, },
onTabMove : function TSTBrowser_onTabMove(aEvent) onTabMove : function TSTBrowser_onTabMove(aEvent)