diff --git a/mailnews/base/search/resources/content/FilterListDialog.js b/mailnews/base/search/resources/content/FilterListDialog.js index fde72c80ef35..2afc3624a409 100644 --- a/mailnews/base/search/resources/content/FilterListDialog.js +++ b/mailnews/base/search/resources/content/FilterListDialog.js @@ -263,16 +263,29 @@ function viewLog() function runSelectedFilters() { var folderURI = runFiltersFolderPicker.getAttribute("uri"); + var resource = rdf.GetResource(folderURI); + var msgFolder = resource.QueryInterface(Components.interfaces.nsIMsgFolder); + var filterService = Components.classes["@mozilla.org/messenger/services/filters;1"].getService(Components.interfaces.nsIMsgFilterService); + var filterList = filterService.getTempFilterList(msgFolder); + var folders = Components.classes["@mozilla.org/supports-array;1"].createInstance(Components.interfaces.nsISupportsArray); + folders.AppendElement(msgFolder); + // make sure the tmp filter list uses the real filter list log stream + filterList.logStream = currentFilterList().logStream; + filterList.loggingEnabled = currentFilterList().loggingEnabled; var sel = gFilterTree.view.selection; for (var i = 0; i < sel.getRangeCount(); i++) { var start = {}, end = {}; sel.getRangeAt(i, start, end); for (var j = start.value; j <= end.value; j++) { - var filter = getFilter(j); - alert("run filter " + filter.filterName + " on " + folderURI); + var curFilter = getFilter(j); + if (curFilter) + { + filterList.insertFilterAt(start.value - j, curFilter); + } } } + filterService.applyFiltersToFolders(filterList, folders, gFilterListMsgWindow); } function moveCurrentFilter(motion) diff --git a/mailnews/base/search/resources/locale/en-US/filter.properties b/mailnews/base/search/resources/locale/en-US/filter.properties index e95dfb5a67b7..67ee9fbec981 100644 --- a/mailnews/base/search/resources/locale/en-US/filter.properties +++ b/mailnews/base/search/resources/locale/en-US/filter.properties @@ -5,11 +5,9 @@ mustEnterName=You must give this filter a name. cannotHaveDuplicateFilterTitle=Duplicate Filter Name cannotHaveDuplicateFilterMessage=The filter name you entered already exists. Please enter a different filter name. deleteFilterConfirmation=Are you sure you want to delete this filter? -folderNotFoundText=The mail filter %1$S cannot move messages to the %2$S folder, because the folder cannot be found. Until you delete or fix the filter, messages which it matches will be left in your Inbox. -folderNotFoundIgnoreButton=Ignore Filter -folderNotFoundDeleteButton=Delete Filter untitledFilterName=untitled filter filterListBackUpMsg=Your filters do not work because the rules.dat file, which contains your filters, could not be read. A new rules.dat file will be created and a backup of the old file, called rulesbackup.dat, will be created in the same directory. customHeaderOverflow=You've exceeded the limit of 50 custom headers. Please remove one or more custom headers and try again. 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? diff --git a/mailnews/base/search/src/nsMsgFilterService.cpp b/mailnews/base/search/src/nsMsgFilterService.cpp index 3fc00ef900ef..53f2d989a5da 100644 --- a/mailnews/base/search/src/nsMsgFilterService.cpp +++ b/mailnews/base/search/src/nsMsgFilterService.cpp @@ -299,7 +299,7 @@ nsMsgFilterService::ThrowAlertMsg(const char*aMsgName, nsIMsgWindow *aMsgWindow) // this class holds the list of filters and folders, and applies them in turn, first iterating -// over all the filters on one folder, and then advancing to the next folder and repeating. \ +// over all the filters on one folder, and then advancing to the next folder and repeating. // For each filter,we take the filter criteria and create a search term list. Then, we execute the search. // We are a search listener so that we can build up the list of search hits. // Then, when the search is done, we will apply the filter action(s) en-masse, so, for example, if the action is a move,