fix for bug #168525. r/sr=bienvenu

1) cylon on busy
2) run button turns into stop when filtering
3) closing window while running prompts
4) no ok / cancel / help
This commit is contained in:
sspitzer%netscape.com 2002-09-14 23:28:17 +00:00
parent aaa1c28e67
commit 247e3047d9
3 changed files with 51 additions and 25 deletions

View File

@ -49,10 +49,15 @@ var gStatusFeedback = {
},
stopMeteors: function()
{
// change run button to be a stop button
gRunFiltersButton.setAttribute("label", gRunFiltersButton.getAttribute("runlabel"));
gRunFiltersButton.setAttribute("accesskey", gRunFiltersButton.getAttribute("runaccesskey"));
gStatusBar.setAttribute("mode", "normal");
try {
// change run button to be a stop button
gRunFiltersButton.setAttribute("label", gRunFiltersButton.getAttribute("runlabel"));
gRunFiltersButton.setAttribute("accesskey", gRunFiltersButton.getAttribute("runaccesskey"));
gStatusBar.setAttribute("mode", "normal");
}
catch (ex) {
// can get here if closing window when running filters
}
},
showProgress: function(percentage)
{
@ -60,11 +65,6 @@ var gStatusFeedback = {
},
closeWindow: function()
{
// if we are running, and the user closes the window, stop.
// XXX todo, prompt first, though.
if (gRunFiltersButton.getAttribute("label") == gRunFiltersButton.getAttribute("stoplabel")) {
gFilterListMsgWindow.StopUrls();
}
}
};
@ -108,14 +108,7 @@ function onLoad()
}
}
function onOk()
{
// make sure to save the filter to disk
var filterList = currentFilterList();
if (filterList) filterList.saveToDefaultFile();
window.close();
}
/*
function onCancel()
{
var firstItem = getSelectedServerForFilters();
@ -144,6 +137,7 @@ function onCancel()
}
window.close();
}
*/
function onServerClick(event)
{
@ -293,6 +287,37 @@ function viewLog()
window.openDialog("chrome://messenger/content/viewLog.xul", "FilterLog", "chrome,modal,titlebar,resizable,centerscreen", args);
}
function onFilterClose()
{
// make sure to save the filter to disk
var filterList = currentFilterList();
if (filterList)
filterList.saveToDefaultFile();
var nsIPromptService = Components.interfaces.nsIPromptService;
if (gRunFiltersButton.getAttribute("label") == gRunFiltersButton.getAttribute("stoplabel")) {
var promptService = Components.classes["@mozilla.org/embedcomp/prompt-service;1"].getService(Components.interfaces.nsIPromptService);
var promptTitle = gFilterBundle.getString("promptTitle");
var promptMsg = gFilterBundle.getString("promptMsg");;
var stopButtonLabel = gFilterBundle.getString("stopButtonLabel");
var continueButtonLabel = gFilterBundle.getString("continueButtonLabel");
var result = promptService.confirmEx(window, promptTitle, promptMsg,
(promptService.BUTTON_TITLE_IS_STRING*promptService.BUTTON_POS_0) +
(promptService.BUTTON_TITLE_IS_STRING*promptService.BUTTON_POS_1),
continueButtonLabel, stopButtonLabel, null, null, {value:0});
if (result)
gFilterListMsgWindow.StopUrls();
else
return false;
}
window.close();
return true;
}
function runSelectedFilters()
{
// if run button has "stop" label, do stop.

View File

@ -28,15 +28,12 @@ Contributor(s): Hkan Waara <hwaara@chello.se>
<!DOCTYPE window SYSTEM "chrome://messenger/locale/FilterListDialog.dtd">
<dialog id="filterListDialog"
<window id="filterListDialog"
xmlns:nc="http://home.netscape.com/NC-rdf#"
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
windowtype="mailnews:filterlist"
buttons="accept,cancel,help"
onload="onLoad();"
ondialogaccept="return onOk();"
ondialogcancel="return onCancel();"
ondialoghelp="return doHelpButton();"
onclose="return onFilterClose();"
persist="width height screenX screenY"
title="&window.title;">
@ -172,10 +169,10 @@ Contributor(s): Hkan Waara <hwaara@chello.se>
<separator/>
<hbox id="statusContainerBox">
<hbox id="statusContainerBox" align="center">
<spacer flex="1"/>
<label id="statusText" crop="right" flex="1"/>
<progressmeter class="progressmeter-statusbar" id="statusbar-icon" mode="normal" value="0"/>
</hbox>
</dialog>
</window>

View File

@ -11,3 +11,7 @@ customHeaderOverflow=You've exceeded the limit of 50 custom headers. Please remo
filterCustomHeaderOverflow=Your filters have exceeded the limit of 50 custom headers. Please edit the rules.dat file, which contains your filters, to use fewer custom headers.
invalidCustomHeader=One of your filters uses a custom header that contains an invalid character, such as ':', a non-printable character, a non-ascii character, or an eight-bit ascii character. Please edit the rules.dat file, which contains your filters, to remove invalid characters from your custom headers.
continueFilterExecution=Applying filter %S failed. Would you like to continue applying filters?
promptTitle=Running Filters
promptMsg=You are currently in the process of filtering messages.\nWould you like to continue applying filters?
stopButtonLabel=Stop
continueButtonLabel=Continue