From 328e3df34089b31feba8826caef1dc45b90ecb58 Mon Sep 17 00:00:00 2001 From: SHIMODA Hiroshi Date: Thu, 9 Dec 2010 20:13:04 +0900 Subject: [PATCH] make extensions.treestyletab.autoAttachSearchResultAsChildren tribool --- content/treestyletab/treestyletab.js | 8 ++++++-- defaults/preferences/treestyletab.js | 5 ++++- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/content/treestyletab/treestyletab.js b/content/treestyletab/treestyletab.js index caffc8d5..e8bdfa86 100644 --- a/content/treestyletab/treestyletab.js +++ b/content/treestyletab/treestyletab.js @@ -145,10 +145,11 @@ var TreeStyleTabService = { shouldOpenSearchResultAsChild : function TSTService_shouldOpenSearchResultAsChild(aTerm) { - if (this.getTreePref('autoAttachSearchResultAsChildren.always')) + var mode = this.getTreePref('autoAttachSearchResultAsChildren'); + if (mode == this.kSEARCH_RESULT_ATTACH_ALWAYS) return true; - if (!aTerm) + if (!aTerm || mode == this.kSEARCH_RESULT_DO_NOT_ATTACH) return false; var w = document.commandDispatcher.focusedWindow; @@ -161,6 +162,9 @@ var TreeStyleTabService = { return Array.slice(aWindow.frames).some(arguments.callee); })(w); }, + kSEARCH_RESULT_DO_NOT_ATTACH : 0, + kSEARCH_RESULT_ATTACH_IF_SELECTED : 1, + kSEARCH_RESULT_ATTACH_ALWAYS : 2, /* Initializing */ diff --git a/defaults/preferences/treestyletab.js b/defaults/preferences/treestyletab.js index fd585443..587ea1d5 100644 --- a/defaults/preferences/treestyletab.js +++ b/defaults/preferences/treestyletab.js @@ -108,7 +108,10 @@ pref("extensions.treestyletab.collapseExpandSubtree.dblclick", false); pref("extensions.treestyletab.autoExpandSubtreeOnCollapsedChildFocused", true); pref("extensions.treestyletab.autoExpandSubtreeOnAppendChild", true); pref("extensions.treestyletab.autoAttachNewTabsAsChildren", true); -pref("extensions.treestyletab.autoAttachSearchResultAsChildren.always", false); +// 0 = don't attach +// 1 = attach if the search term equals to the selection in the current tab +// 2 = always attach +pref("extensions.treestyletab.autoAttachSearchResultAsChildren", 1); // 0 = default, 1 = only visible tabs pref("extensions.treestyletab.focusMode", 1); /*