clean up my fix for #75942 to not give a JS error in the filter dialog.

(I forgot the search terms are shared.)  also make it so if you hit enter in
a search term and the search has started, it will stop it and and start a new one.
rename gButton to gSearchStopButton, since that is what it is.
sr=bienvenu
This commit is contained in:
sspitzer%netscape.com 2001-04-14 23:08:00 +00:00
Родитель 162e4b1f50
Коммит dde7ed9173
3 изменённых файлов: 24 добавлений и 5 удалений

Просмотреть файл

@ -400,7 +400,7 @@
<handlers>
<handler event="keypress"><![CDATA[
if (event.keyCode == 13) {
onSearch();
onEnterInSearchTerm();
}
]]></handler>
</handlers>

Просмотреть файл

@ -64,6 +64,11 @@ function filterEditorOnLoad()
moveToAlertPosition();
}
function onEnterInSearchTerm()
{
// do nothing. okOk() will get called since this is a dialog
}
function onOk()
{
if (isDuplicateFilterNameExists())

Просмотреть файл

@ -46,7 +46,7 @@ var gNextMessageViewIndexAfterDelete = -1;
var gDataSourceSearchListener;
var gViewSearchListener;
var gButton;
var gSearchStopButton;
var gSearchSessionFolderListener;
var gMailSession;
@ -109,7 +109,7 @@ var gSearchNotificationListener =
onSearchDone: function(status)
{
gButton.setAttribute("label", gSearchBundle.getString("labelForSearchButton"));
gSearchStopButton.setAttribute("label", gSearchBundle.getString("labelForSearchButton"));
var statusMsg;
// if there are no hits, it means no matches were found in the search.
@ -133,7 +133,7 @@ var gSearchNotificationListener =
onNewSearch: function()
{
gButton.setAttribute("label", gSearchBundle.getString("labelForStopButton"));
gSearchStopButton.setAttribute("label", gSearchBundle.getString("labelForStopButton"));
// if (gThreadTree)
// gThreadTree.clearItemSelection();
@ -227,7 +227,7 @@ function initializeSearchWindowWidgets()
{
gFolderPicker = document.getElementById("searchableFolders");
// gThreadTree = document.getElementById("threadTree");
gButton = document.getElementById("search-button");
gSearchStopButton = document.getElementById("search-button");
gStatusBar = document.getElementById('statusbar-icon');
msgWindow = Components.classes[msgWindowContractID].createInstance(nsIMsgWindow);
@ -298,6 +298,20 @@ function onChooseFolder(event) {
}
}
function onEnterInSearchTerm()
{
// on enter
// if not searching, start the search
// if searching, stop and then start again
if (gSearchStopButton.getAttribute("label") == gSearchBundle.getString("labelForSearchButton")) {
onSearch();
}
else {
onSearchStop();
onSearch();
}
}
function onSearch()
{
// set the view. do this on every search, to