ブックマークフォルダをタブで開く時の挙動をダイアログで尋ねられるように

git-svn-id: http://www.cozmixng.org/repos/piro/treestyletab/trunk@4781 599a83e7-65a4-db11-8015-0010dcdd6dc2
This commit is contained in:
piro 2009-07-22 04:51:54 +00:00
parent c2d0986de3
commit a1a3f8efd7
11 changed files with 131 additions and 18 deletions

View File

@ -6,8 +6,8 @@ window.addEventListener('load', function() {
BookmarksCommand.openGroupBookmark.toSource().replace( BookmarksCommand.openGroupBookmark.toSource().replace(
'var index = index0;', 'var index = index0;',
<![CDATA[ <![CDATA[
if (TreeStyleTabService.getTreePref('openGroupBookmarkAsTabSubTree') && var howToOpenGroupBookmark = TreeStyleTabService.howToOpenGroupBookmark();
TreeStyleTabService.getTreePref('openGroupBookmarkAsTabSubTree.underParent')) { if (howToOpenGroupBookmark & TreeStyleTabService.kGROUP_BOOKMARK_USE_DUMMY)) {
var folderTitle = BMDS.GetTarget(resource, RDF.GetResource(gNC_NS + 'Name'), true) var folderTitle = BMDS.GetTarget(resource, RDF.GetResource(gNC_NS + 'Name'), true)
.QueryInterface(kRDFLITIID) .QueryInterface(kRDFLITIID)
.Value; .Value;
@ -31,7 +31,7 @@ window.addEventListener('load', function() {
<![CDATA[ <![CDATA[
$1$2 $1$2
if (!doReplace && if (!doReplace &&
TreeStyleTabService.getTreePref('openGroupBookmarkAsTabSubTree') && howToOpenGroupBookmark & TreeStyleTabService.kGROUP_BOOKMARK_SUBTREE &&
!browser.treeStyleTab.parentTab) { !browser.treeStyleTab.parentTab) {
browser.treeStyleTab.partTab(browser.treeStyleTab.getTabs(browser).snapshotItem(index)); browser.treeStyleTab.partTab(browser.treeStyleTab.getTabs(browser).snapshotItem(index));
TreeStyleTabService.readyToOpenChildTab($1, true); TreeStyleTabService.readyToOpenChildTab($1, true);
@ -42,7 +42,7 @@ window.addEventListener('load', function() {
<![CDATA[ <![CDATA[
var openedTab = $& var openedTab = $&
if (!doReplace && if (!doReplace &&
TreeStyleTabService.getTreePref('openGroupBookmarkAsTabSubTree') && howToOpenGroupBookmark & TreeStyleTabService.kGROUP_BOOKMARK_SUBTREE &&
!browser.treeStyleTab.parentTab) { !browser.treeStyleTab.parentTab) {
TreeStyleTabService.readyToOpenChildTab(openedTab, true); TreeStyleTabService.readyToOpenChildTab(openedTab, true);
} }
@ -65,22 +65,22 @@ window.addEventListener('load', function() {
).replace( ).replace(
'browserWindow.getBrowser().loadTabs(', 'browserWindow.getBrowser().loadTabs(',
<![CDATA[ <![CDATA[
var howToOpenGroupBookmark = TreeStyleTabService.howToOpenGroupBookmark();
if ( if (
TreeStyleTabService.getTreePref('openGroupBookmarkAsTabSubTree') && where.indexOf('tab') == 0 ||
( aEvent.target.id == 'placesContext_openContainer:tabs' ||
where.indexOf('tab') == 0 || aEvent.target == aEvent.target.parentNode._endOptOpenAllInTabs ||
aEvent.target.id == 'placesContext_openContainer:tabs' || aEvent.target.getAttribute('openInTabs') == 'true'
aEvent.target == aEvent.target.parentNode._endOptOpenAllInTabs ||
aEvent.target.getAttribute('openInTabs') == 'true'
)
) { ) {
TreeStyleTabService.readyToOpenNewTabGroup(); if (howToOpenGroupBookmark & TreeStyleTabService.kGROUP_BOOKMARK_SUBTREE) {
if (TreeStyleTabService.getTreePref('openGroupBookmarkAsTabSubTree.underParent')) TreeStyleTabService.readyToOpenNewTabGroup();
urls.unshift(TreeStyleTabService.getGroupTabURI(aFolderTitle)); if (howToOpenGroupBookmark & TreeStyleTabService.kGROUP_BOOKMARK_USE_DUMMY)
replaceCurrentTab = false; urls.unshift(TreeStyleTabService.getGroupTabURI(aFolderTitle));
} replaceCurrentTab = false;
else if (!TreeStyleTabService.getPref('browser.tabs.loadFolderAndReplace')) { }
replaceCurrentTab = false; else {
replaceCurrentTab = howToOpenGroupBookmark & TreeStyleTabService.kGROUP_BOOKMARK_REPLACE ? true : false ;
}
} }
$&]]> $&]]>
) )

View File

@ -1161,6 +1161,54 @@ var TreeStyleTabService = {
return newChildTab return newChildTab
}, },
howToOpenGroupBookmark : function()
{
var dummyTabFlag = this.getTreePref('openGroupBookmarkAsTabSubTree.underParent') ?
this.kGROUP_BOOKMARK_USE_DUMMY :
0 ;
if (!this.getTreePref('openGroupBookmarkBehavior.confirm')) {
return this.getTreePref('openGroupBookmarkAsTabSubTree') ?
this.kGROUP_BOOKMARK_SUBTREE | dummyTabFlag :
this.getPref('browser.tabs.loadFolderAndReplace') ?
this.kGROUP_BOOKMARK_REPLACE :
this.kGROUP_BOOKMARK_SEPARATE ;
}
var checked = { value : false };
var behavior = this.PromptService.confirmEx(window,
this.stringbundle.getString('openGroupBookmarkBehavior.title'),
this.stringbundle.getString('openGroupBookmarkBehavior.text'),
(this.PromptService.BUTTON_TITLE_IS_STRING * this.PromptService.BUTTON_POS_0) +
(this.PromptService.BUTTON_TITLE_IS_STRING * this.PromptService.BUTTON_POS_1) +
(this.PromptService.BUTTON_TITLE_IS_STRING * this.PromptService.BUTTON_POS_2),
this.stringbundle.getString('openGroupBookmarkBehavior.subTree'),
this.stringbundle.getString('openGroupBookmarkBehavior.replace'+(this.isGecko18 ? '2' : '' )),
this.stringbundle.getString('openGroupBookmarkBehavior.separate'),
this.stringbundle.getString('openGroupBookmarkBehavior.never'),
checked
);
switch (behavior)
{
case 0: behavior = this.kGROUP_BOOKMARK_SUBTREE | dummyTabFlag; break;
case 1: behavior = this.kGROUP_BOOKMARK_REPLACE; break;
default:
case 2: behavior = this.kGROUP_BOOKMARK_SEPARATE; break;
}
if (checked.value) {
this.setTreePref('openGroupBookmarkBehavior.confirm', false);
this.setTreePref('openGroupBookmarkAsTabSubTree', behavior & this.kGROUP_BOOKMARK_SUBTREE ? true : false );
this.setPref('browser.tabs.loadFolderAndReplace', behavior & this.kGROUP_BOOKMARK_REPLACE ? true : false );
}
return behavior;
},
kGROUP_BOOKMARK_SUBTREE : 1,
kGROUP_BOOKMARK_SEPARATE : 2,
kGROUP_BOOKMARK_REPLACE : 4,
kGROUP_BOOKMARK_USE_DUMMY : 256,
/* Initializing */ /* Initializing */
preInit : function() preInit : function()

View File

@ -83,6 +83,7 @@ pref("extensions.treestyletab.urlbar.loadSameDomainToNewChildTab", true);
pref("extensions.treestyletab.urlbar.invertDefaultBehavior", true); pref("extensions.treestyletab.urlbar.invertDefaultBehavior", true);
pref("extensions.treestyletab.loadDroppedLinkToNewChildTab", false); pref("extensions.treestyletab.loadDroppedLinkToNewChildTab", false);
pref("extensions.treestyletab.loadDroppedLinkToNewChildTab.confirm", true); pref("extensions.treestyletab.loadDroppedLinkToNewChildTab.confirm", true);
pref("extensions.treestyletab.openGroupBookmarkBehavior.confirm", true);
pref("extensions.treestyletab.openGroupBookmarkAsTabSubTree", true); pref("extensions.treestyletab.openGroupBookmarkAsTabSubTree", true);
pref("extensions.treestyletab.openGroupBookmarkAsTabSubTree.underParent", true); pref("extensions.treestyletab.openGroupBookmarkAsTabSubTree.underParent", true);
pref("extensions.treestyletab.useEffectiveTLD", true); pref("extensions.treestyletab.useEffectiveTLD", true);

View File

@ -11,3 +11,11 @@ dropLinkOnTab.text=A link has been dropped onto existing tab. Tree Style Tab can
dropLinkOnTab.never=Never show this confirmation dropLinkOnTab.never=Never show this confirmation
dropLinkOnTab.loadInTheTab=Load into the tab (Firefox default) dropLinkOnTab.loadInTheTab=Load into the tab (Firefox default)
dropLinkOnTab.openNewChildTab=Open as a New Child Tab dropLinkOnTab.openNewChildTab=Open as a New Child Tab
openGroupBookmarkBehavior.title=How to open multiple bookmarks?
openGroupBookmarkBehavior.text=Now multiple tabs will be opened from bookmarks. How to open them?
openGroupBookmarkBehavior.never=Never show this confirmation
openGroupBookmarkBehavior.subTree=Open as a New Tree
openGroupBookmarkBehavior.separate=Open as Separate Tabs
openGroupBookmarkBehavior.replace=Replace current one tab (Firefox default)
openGroupBookmarkBehavior.replace2=Replace current tab set (Firefox default)

View File

@ -11,3 +11,11 @@ dropLinkOnTab.text=A link has been dropped onto existing tab. Tree Style Tab can
dropLinkOnTab.never=Never show this confirmation dropLinkOnTab.never=Never show this confirmation
dropLinkOnTab.loadInTheTab=Load into the tab (Firefox default) dropLinkOnTab.loadInTheTab=Load into the tab (Firefox default)
dropLinkOnTab.openNewChildTab=Open as a New Child Tab dropLinkOnTab.openNewChildTab=Open as a New Child Tab
openGroupBookmarkBehavior.title=How to open multiple bookmarks?
openGroupBookmarkBehavior.text=Now multiple tabs will be opened from bookmarks. How to open them?
openGroupBookmarkBehavior.never=Never show this confirmation
openGroupBookmarkBehavior.subTree=Open as a New Tree
openGroupBookmarkBehavior.separate=Open as Separate Tabs
openGroupBookmarkBehavior.replace=Replace current one tab (Firefox default)
openGroupBookmarkBehavior.replace2=Replace current tab set (Firefox default)

View File

@ -11,3 +11,11 @@ dropLinkOnTab.text=A link has been dropped onto existing tab. Tree Style Tab can
dropLinkOnTab.never=Never show this confirmation dropLinkOnTab.never=Never show this confirmation
dropLinkOnTab.loadInTheTab=Load into the tab (Firefox default) dropLinkOnTab.loadInTheTab=Load into the tab (Firefox default)
dropLinkOnTab.openNewChildTab=Open as a New Child Tab dropLinkOnTab.openNewChildTab=Open as a New Child Tab
openGroupBookmarkBehavior.title=How to open multiple bookmarks?
openGroupBookmarkBehavior.text=Now multiple tabs will be opened from bookmarks. How to open them?
openGroupBookmarkBehavior.never=Never show this confirmation
openGroupBookmarkBehavior.subTree=Open as a New Tree
openGroupBookmarkBehavior.separate=Open as Separate Tabs
openGroupBookmarkBehavior.replace=Replace current one tab (Firefox default)
openGroupBookmarkBehavior.replace2=Replace current tab set (Firefox default)

View File

@ -11,3 +11,11 @@ dropLinkOnTab.text=リンクがタブにドロップされました。ツリー
dropLinkOnTab.never=今後この確認を表示しない dropLinkOnTab.never=今後この確認を表示しない
dropLinkOnTab.loadInTheTab=ドロップ先のタブに読み込むFirefox既定の動作 dropLinkOnTab.loadInTheTab=ドロップ先のタブに読み込むFirefox既定の動作
dropLinkOnTab.openNewChildTab=新しい子タブとして開く dropLinkOnTab.openNewChildTab=新しい子タブとして開く
openGroupBookmarkBehavior.title=複数のブックマークをどのように開きますか?
openGroupBookmarkBehavior.text=複数のブックマークをタブで開こうとしています。どのように開きますか?
openGroupBookmarkBehavior.never=今後この確認を表示しない
openGroupBookmarkBehavior.subTree=新しいツリーとして開く
openGroupBookmarkBehavior.separate=ばらばらのタブとして開く
openGroupBookmarkBehavior.replace=現在のタブを置き換えるFirefox既定の動作
openGroupBookmarkBehavior.replace2=すべてのタブを置き換えるFirefox既定の動作

View File

@ -11,3 +11,11 @@ dropLinkOnTab.text=A link has been dropped onto existing tab. Tree Style Tab can
dropLinkOnTab.never=Never show this confirmation dropLinkOnTab.never=Never show this confirmation
dropLinkOnTab.loadInTheTab=Load into the tab (Firefox default) dropLinkOnTab.loadInTheTab=Load into the tab (Firefox default)
dropLinkOnTab.openNewChildTab=Open as a New Child Tab dropLinkOnTab.openNewChildTab=Open as a New Child Tab
openGroupBookmarkBehavior.title=How to open multiple bookmarks?
openGroupBookmarkBehavior.text=Now multiple tabs will be opened from bookmarks. How to open them?
openGroupBookmarkBehavior.never=Never show this confirmation
openGroupBookmarkBehavior.subTree=Open as a New Tree
openGroupBookmarkBehavior.separate=Open as Separate Tabs
openGroupBookmarkBehavior.replace=Replace current one tab (Firefox default)
openGroupBookmarkBehavior.replace2=Replace current tab set (Firefox default)

View File

@ -11,3 +11,11 @@ dropLinkOnTab.text=A link has been dropped onto existing tab. Tree Style Tab can
dropLinkOnTab.never=Never show this confirmation dropLinkOnTab.never=Never show this confirmation
dropLinkOnTab.loadInTheTab=Load into the tab (Firefox default) dropLinkOnTab.loadInTheTab=Load into the tab (Firefox default)
dropLinkOnTab.openNewChildTab=Open as a New Child Tab dropLinkOnTab.openNewChildTab=Open as a New Child Tab
openGroupBookmarkBehavior.title=How to open multiple bookmarks?
openGroupBookmarkBehavior.text=Now multiple tabs will be opened from bookmarks. How to open them?
openGroupBookmarkBehavior.never=Never show this confirmation
openGroupBookmarkBehavior.subTree=Open as a New Tree
openGroupBookmarkBehavior.separate=Open as Separate Tabs
openGroupBookmarkBehavior.replace=Replace current one tab (Firefox default)
openGroupBookmarkBehavior.replace2=Replace current tab set (Firefox default)

View File

@ -11,3 +11,11 @@ dropLinkOnTab.text=A link has been dropped onto existing tab. Tree Style Tab can
dropLinkOnTab.never=Never show this confirmation dropLinkOnTab.never=Never show this confirmation
dropLinkOnTab.loadInTheTab=Load into the tab (Firefox default) dropLinkOnTab.loadInTheTab=Load into the tab (Firefox default)
dropLinkOnTab.openNewChildTab=Open as a New Child Tab dropLinkOnTab.openNewChildTab=Open as a New Child Tab
openGroupBookmarkBehavior.title=How to open multiple bookmarks?
openGroupBookmarkBehavior.text=Now multiple tabs will be opened from bookmarks. How to open them?
openGroupBookmarkBehavior.never=Never show this confirmation
openGroupBookmarkBehavior.subTree=Open as a New Tree
openGroupBookmarkBehavior.separate=Open as Separate Tabs
openGroupBookmarkBehavior.replace=Replace current one tab (Firefox default)
openGroupBookmarkBehavior.replace2=Replace current tab set (Firefox default)

View File

@ -11,3 +11,11 @@ dropLinkOnTab.text=A link has been dropped onto existing tab. Tree Style Tab can
dropLinkOnTab.never=Never show this confirmation dropLinkOnTab.never=Never show this confirmation
dropLinkOnTab.loadInTheTab=Load into the tab (Firefox default) dropLinkOnTab.loadInTheTab=Load into the tab (Firefox default)
dropLinkOnTab.openNewChildTab=Open as a New Child Tab dropLinkOnTab.openNewChildTab=Open as a New Child Tab
openGroupBookmarkBehavior.title=How to open multiple bookmarks?
openGroupBookmarkBehavior.text=Now multiple tabs will be opened from bookmarks. How to open them?
openGroupBookmarkBehavior.never=Never show this confirmation
openGroupBookmarkBehavior.subTree=Open as a New Tree
openGroupBookmarkBehavior.separate=Open as Separate Tabs
openGroupBookmarkBehavior.replace=Replace current one tab (Firefox default)
openGroupBookmarkBehavior.replace2=Replace current tab set (Firefox default)