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

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

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