fix for 41770 - new filters were not saving

- any kind of error during filter creation was not clearing gFilter,
  which meant the filter would not get added to the filterlist
- the filter type was uninitialized, so none of the rules would get saved
This commit is contained in:
alecf%netscape.com 2000-06-08 04:18:42 +00:00
Родитель 808c15f30f
Коммит 6d8b6a05fa
2 изменённых файлов: 9 добавлений и 3 удалений

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

@ -161,6 +161,7 @@ function saveFilter() {
if (!targetUri || targetUri == "") {
var str = Bundle.GetStringFromName("mustSelectFolder");
window.alert(str);
gFilter = null;
return false;
}
gFilter.actionTargetFolderUri = targetUri;
@ -170,13 +171,17 @@ function saveFilter() {
if (!gActionPriority.selectedItem) {
var str = Bundle.GetStringFromName("mustSelectPriority");
window.alert(str);
gFilter = null;
return false;
}
gFilter.actionPriority = gActionPriority.selectedItem.getAttribute("data");
}
if (isNewFilter)
if (isNewFilter) {
dump("new filter.. inserting into " + gFilterList + "\n");
gFilterList.insertFilterAt(0, gFilter);
}
// success!
return true;

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

@ -49,6 +49,7 @@ nsMsgRuleAction::~nsMsgRuleAction()
nsMsgFilter::nsMsgFilter() :
m_type(1),
m_filterList(nsnull)
{
NS_INIT_REFCNT();
@ -472,8 +473,8 @@ nsresult nsMsgFilter::SaveRule()
GetActionFilingStr(m_action.m_type, actionFilingStr);
err = filterList->WriteStrAttr(nsIMsgFilterList::attribAction, actionFilingStr);
if (!NS_SUCCEEDED(err))
return err;
NS_ENSURE_SUCCESS(err, err);
switch(m_action.m_type)
{
case nsMsgFilterAction::MoveToFolder: