From d9224bdc4d50e724b9f5408c6645a2c583d70113 Mon Sep 17 00:00:00 2001 From: "sspitzer%netscape.com" Date: Sat, 14 Apr 2001 23:08:00 +0000 Subject: [PATCH] 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 git-svn-id: svn://10.0.0.236/trunk@92324 18797224-902f-48f8-a5cc-f745e15eee43 --- .../base/resources/content/mailWidgets.xml | 2 +- .../search/resources/content/FilterEditor.js | 5 +++++ .../search/resources/content/SearchDialog.js | 22 +++++++++++++++---- 3 files changed, 24 insertions(+), 5 deletions(-) diff --git a/mozilla/mailnews/base/resources/content/mailWidgets.xml b/mozilla/mailnews/base/resources/content/mailWidgets.xml index 4949708d8ae..5fc62a33502 100644 --- a/mozilla/mailnews/base/resources/content/mailWidgets.xml +++ b/mozilla/mailnews/base/resources/content/mailWidgets.xml @@ -400,7 +400,7 @@ diff --git a/mozilla/mailnews/base/search/resources/content/FilterEditor.js b/mozilla/mailnews/base/search/resources/content/FilterEditor.js index ec757083877..3494a188de7 100644 --- a/mozilla/mailnews/base/search/resources/content/FilterEditor.js +++ b/mozilla/mailnews/base/search/resources/content/FilterEditor.js @@ -64,6 +64,11 @@ function filterEditorOnLoad() moveToAlertPosition(); } +function onEnterInSearchTerm() +{ + // do nothing. okOk() will get called since this is a dialog +} + function onOk() { if (isDuplicateFilterNameExists()) diff --git a/mozilla/mailnews/base/search/resources/content/SearchDialog.js b/mozilla/mailnews/base/search/resources/content/SearchDialog.js index 0b787bd3f35..1b9e437c2b3 100644 --- a/mozilla/mailnews/base/search/resources/content/SearchDialog.js +++ b/mozilla/mailnews/base/search/resources/content/SearchDialog.js @@ -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