Bug #328795 --> Covnert Thunderbird to use toolkit's typeaheadfind bar sr=bienvenu

This commit is contained in:
scott%scott-macgregor.org 2006-03-02 20:17:01 +00:00
parent 2726f394c8
commit 6db3e48650
10 changed files with 59 additions and 50 deletions

View File

@ -179,6 +179,11 @@ pref("browser.preferences.animateFadeIn", true);
pref("browser.preferences.animateFadeIn", false);
#endif
pref("accessibility.typeaheadfind", false);
pref("accessibility.typeaheadfind.timeout", 5000);
pref("accessibility.typeaheadfind.linksonly", false);
pref("accessibility.typeaheadfind.flashBar", 1);
/////////////////////////////////////////////////////////////////
// Overrides of the seamonkey suite mailnews.js prefs
/////////////////////////////////////////////////////////////////

View File

@ -200,7 +200,7 @@ var DefaultController =
case "cmd_getNextNMessages":
case "cmd_find":
case "cmd_findAgain":
case "cmd_findPrev":
case "cmd_findPrevious":
case "cmd_search":
case "button_mark":
case "cmd_markAsRead":
@ -366,7 +366,7 @@ var DefaultController =
return IsFolderSelected();
case "cmd_find":
case "cmd_findAgain":
case "cmd_findPrev":
case "cmd_findPrevious":
return IsMessageDisplayedInMessagePane();
break;
case "cmd_search":
@ -592,7 +592,7 @@ var DefaultController =
SetFocusMessagePane();
MsgFindAgain(false);
return;
case "cmd_findPrev":
case "cmd_findPrevious":
// make sure the message pane has focus before we start a find since we only support searching
// within the message body. Do it here and not in MsgFind() which can be called from standalone where we don't want to set focus
SetFocusMessagePane();

View File

@ -224,7 +224,7 @@ function InitMsgWindow()
msgWindow.msgHeaderSink = messageHeaderSink;
msgWindow.SetDOMWindow(window);
mailSession.AddMsgWindow(msgWindow);
document.getElementById("messagepane").docShell.allowAuth = false;
getBrowser().docShell.allowAuth = false;
msgWindow.rootDocShell.allowAuth = true;
}
@ -602,6 +602,12 @@ function HidingThreadPane()
ClearThreadPane();
}
// the find toolbar needs a method called getBrowser
function getBrowser()
{
return document.getElementById("messagepane");
}
function ObserveDisplayDeckChange(event)
{
var deck = document.getElementById("displayDeck");

View File

@ -1372,26 +1372,16 @@ function MsgViewPageSource()
ViewPageSource(messages);
}
var gFindInstData;
function getFindInstData()
{
if (!gFindInstData) {
gFindInstData = new nsFindInstData();
gFindInstData.browser = getMessageBrowser();
gFindInstData.__proto__.rootSearchWindow = window.top.content;
gFindInstData.__proto__.currentSearchWindow = window.top.content;
}
return gFindInstData;
}
function MsgFind()
{
findInPage(getFindInstData());
gFindBar.onFindCmd();
}
function MsgFindAgain(reverse)
{
findAgainInPage(getFindInstData(), reverse);
if (reverse)
gFindBar.onFindPreviousCmd();
else
gFindBar.onFindAgainCmd();
}
function MsgCanFindAgain()

View File

@ -37,7 +37,8 @@
# ***** END LICENSE BLOCK *****
<?xml-stylesheet href="chrome://messenger/skin/folderMenus.css" type="text/css"?>
<?xml-stylesheet href="chrome://communicator/skin/tasksOverlay.css" type="text/css"?>
<?xml-stylesheet href="chrome://communicator/skin/tasksOverlay.css" type="text/css"?>
<?xml-stylesheet href="chrome://global/skin/findBar.css" type="text/css"?>
<?xul-overlay href="chrome://global/content/charsetOverlay.xul"?>
<?xul-overlay href="chrome://messenger/content/mailWindowExtrasOverlay.xul"?>
@ -51,6 +52,8 @@
%contentAreaCommandsDTD;
<!ENTITY % brandDTD SYSTEM "chrome://branding/locale/brand.dtd">
%brandDTD;
<!ENTITY % findBarDTD SYSTEM "chrome://global/locale/findbar.dtd">
%findBarDTD;
]>
<overlay
@ -60,14 +63,14 @@
<script type="application/x-javascript" src="chrome://messenger/content/mailCommands.js"/>
<script type="application/x-javascript" src="chrome://messenger/content/mailWindowOverlay.js"/>
<script type="application/x-javascript" src="chrome://messenger/content/mailCore.js"/>
<script type="application/x-javascript" src="chrome://global/content/findUtils.js"/>
<script type="application/x-javascript" src="chrome://global/content/findBar.js"/>
<script type="application/x-javascript" src="chrome://communicator/content/printing.js"/>
<script type="application/x-javascript" src="chrome://messenger/content/msgViewPickerOverlay.js"/>
<script type="application/x-javascript" src="chrome://global/content/viewZoomOverlay.js"/>
<stringbundleset id="stringbundleset">
<stringbundle id="bundle_messenger" src="chrome://messenger/locale/messenger.properties"/>
<stringbundle id="findBundle" src="chrome://global/locale/finddialog.properties"/>
<stringbundle id="bundle_messenger" src="chrome://messenger/locale/messenger.properties"/>
<stringbundle id="bundle_findBar" src="chrome://global/locale/findbar.properties"/>
</stringbundleset>
<!-- Performance optimization...we include utilityOverlay.xul which defines some command sets
@ -185,7 +188,7 @@
valueGeneric="&folderPropsCmd.label;"/>
<command id="cmd_find" oncommand="goDoCommand('cmd_find')" disabled="true"/>
<command id="cmd_findAgain" oncommand="goDoCommand('cmd_findAgain')" disabled="true"/>
<command id="cmd_findPrev" oncommand="goDoCommand('cmd_findPrev')" disabled="true"/>
<command id="cmd_findPrevious" oncommand="goDoCommand('cmd_findPrevious')" disabled="true"/>
<command id="cmd_stop" oncommand="MsgStop();"/>
</commandset>
@ -376,9 +379,9 @@
modifiers="accel, shift"/>
<key id="key_find" key="&findCmd.key;" oncommand="goDoCommand('cmd_find')" modifiers="accel"/>
<key id="key_findAgain" key="&findAgainCmd.key;" oncommand="goDoCommand('cmd_findAgain')" modifiers="accel"/>
<key id="key_findPrev" key="&findPrevCmd.key;" oncommand="goDoCommand('cmd_findPrev')" modifiers="accel, shift"/>
<key id="key_findPrev" key="&findPrevCmd.key;" oncommand="goDoCommand('cmd_findPrevious')" modifiers="accel, shift"/>
<key keycode="&findAgainCmd.key2;" oncommand="goDoCommand('cmd_findAgain')"/>
<key keycode="&findPrevCmd.key2;" oncommand="goDoCommand('cmd_findPrev')" modifiers="shift"/>
<key keycode="&findPrevCmd.key2;" oncommand="goDoCommand('cmd_findPrevious')" modifiers="shift"/>
<key key="&quickSearchCmd.key;" oncommand="QuickSearchFocus()" modifiers="accel"/>
<key id="key_stop" keycode="VK_ESCAPE" command="cmd_stop"/>
@ -1191,9 +1194,8 @@
<menuseparator/>
<menu label="&find.label;" accesskey="&find.accesskey;">
<menupopup>
<menuitem label="&findCmd.label;" key="key_find" accesskey="&findCmd.accesskey;" observes="cmd_find"/>
<menuitem label="&findAgainCmd.label;" key="key_findAgain" accesskey="&findAgainCmd.accesskey;" observes="cmd_findAgain"/>
<menuitem label="&findPrevCmd.label;" key="key_findPrev" accesskey="&findPrevCmd.accesskey;" observes="cmd_findPrev"/>
<menuitem label="&findCmd.label;" key="key_find" accesskey="&findCmd.accesskey;" observes="cmd_find"/>
<menuitem label="&findAgainCmd.label;" key="key_findAgain" accesskey="&findAgainCmd.accesskey;" observes="cmd_findAgain"/>
<menuseparator/>
<menuitem id="searchMailCmd" label="&searchMailCmd.label;"
key="key_searchMail"
@ -2056,7 +2058,9 @@
</hbox>
</deck>
<statusbar class="chromeclass-status" id="status-bar">
#include ../../../toolkit/components/typeaheadfind/content/findBar.inc
<statusbar class="chromeclass-status" id="status-bar">
<hbox insertbefore="unreadMessageCount" id="statusTextBox" flex="1">
<statusbarpanel id="statusText" label="&statusText.label;" flex="1"/>
<statusbarpanel class="statusbarpanel-progress" collapsed="true" id="statusbar-progresspanel">

View File

@ -318,6 +318,8 @@ function delayedOnLoadMessageWindow()
CreateView(originalView);
gFindBar.initFindBar();
// initialize the customizeDone method on the customizeable toolbar
var toolbox = document.getElementById("mail-toolbox");
toolbox.customizeDone = MailToolboxCustomizeDone;
@ -534,6 +536,8 @@ function OnUnloadMessageWindow()
OnUnloadMsgHeaderPane();
OnMailWindowUnload();
gFindBar.uninitFindBar();
}
function CreateMessageWindowGlobals()
@ -798,7 +802,7 @@ var MessageWindowController =
case "cmd_getNextNMessages":
case "cmd_find":
case "cmd_findAgain":
case "cmd_findPrev":
case "cmd_findPrevious":
case "cmd_search":
case "cmd_reload":
case "cmd_getNewMessages":
@ -904,7 +908,7 @@ var MessageWindowController =
case "cmd_previousUnreadMsg":
return true;
case "cmd_findAgain":
case "cmd_findPrev":
case "cmd_findPrevious":
return MsgCanFindAgain();
case "cmd_search":
var loadedFolder = GetLoadedMsgFolder();
@ -1019,7 +1023,7 @@ var MessageWindowController =
case "cmd_findAgain":
MsgFindAgain(false);
break;
case "cmd_findPrev":
case "cmd_findPrevious":
MsgFindAgain(true);
break;
case "cmd_search":

View File

@ -67,7 +67,6 @@
<stringbundleset id="stringbundleset">
<stringbundle id="bundle_brand" src="chrome://branding/locale/brand.properties"/>
<stringbundle id="bundle_messenger" src="chrome://messenger/locale/messenger.properties"/>
<stringbundle id="bundle_offlinePrompts" src="chrome://messenger/locale/offline.properties"/>
</stringbundleset>
@ -165,8 +164,8 @@
disablesecurity="true" disablehistory="true" type="content-primary"
src="about:blank" onclick="return contentAreaClick(event);" autofind="false"/>
<hbox id="attachmentView"/>
<toolbar id="FindToolbar"/>
</vbox>
<statusbar class="chromeclass-status" id="status-bar"/>
</window>

View File

@ -66,7 +66,6 @@
windowtype="mail:3pane">
<stringbundleset id="stringbundleset">
<stringbundle id="bundle_messenger" src="chrome://messenger/locale/messenger.properties"/>
<stringbundle id="bundle_brand" src="chrome://branding/locale/brand.properties"/>
<stringbundle id="bundle_search" src="chrome://messenger/locale/search.properties"/>
</stringbundleset>
@ -399,11 +398,11 @@
disablehistory="true" type="content-primary" src="about:blank"
disablesecurity="true" onclick="return contentAreaClick(event);"/>
<hbox id="attachmentView"/>
<toolbar id="FindToolbar"/>
</vbox>
</box>
</vbox>
</hbox>
</box> <!-- end of mailContentWrapper -->
<statusbar id="status-bar" class="chromeclass-status">

View File

@ -842,7 +842,9 @@ function delayedOnLoadMessenger()
//Set focus to the Thread Pane the first time the window is opened.
SetFocusThreadPane();
gFindBar.initFindBar();
// initialize the customizeDone method on the customizeable toolbar
var toolbox = document.getElementById("mail-toolbox");
toolbox.customizeDone = MailToolboxCustomizeDone;
@ -858,6 +860,8 @@ function OnUnloadMessenger()
pref.QueryInterface(Components.interfaces.nsIPrefBranch2);
pref.removeObserver("mail.pane_config.dynamic", MailPrefObserver);
pref.removeObserver("mail.showFolderPaneColumns", MailPrefObserver);
gFindBar.uninitFindBar();
// FIX ME - later we will be able to use onload from the overlay
OnUnloadMsgHeaderPane();
@ -1201,35 +1205,35 @@ function OnLoadThreadPane()
function GetFolderDatasource()
{
var folderTree = GetFolderTree();
return folderTree.database;
var folderTree = GetFolderTree();
return folderTree.database;
}
/* Functions for accessing particular parts of the window*/
function GetFolderTree()
{
if (! gFolderTree)
gFolderTree = document.getElementById("folderTree");
return gFolderTree;
if (! gFolderTree)
gFolderTree = document.getElementById("folderTree");
return gFolderTree;
}
function GetSearchInput()
{
if (gSearchInput) return gSearchInput;
if (!gSearchInput)
gSearchInput = document.getElementById("searchInput");
return gSearchInput;
return gSearchInput;
}
function GetMessagePane()
{
if (gMessagePane) return gMessagePane;
if (!gMessagePane)
gMessagePane = document.getElementById("messagepanebox");
return gMessagePane;
return gMessagePane;
}
function GetMessagePaneFrame()
{
return window.content;
return window.content;
}
function FindInSidebar(currentWindow, id)

View File

@ -245,8 +245,6 @@
<!ENTITY findAgainCmd.accesskey "g">
<!ENTITY findAgainCmd.key "g">
<!ENTITY findAgainCmd.key2 "VK_F3">
<!ENTITY findPrevCmd.label "Find Previous">
<!ENTITY findPrevCmd.accesskey "v">
<!ENTITY findPrevCmd.key "g">
<!ENTITY findPrevCmd.key2 "VK_F3">
<!ENTITY searchMailCmd.label "Search Messages...">