diff --git a/mozilla/mailnews/base/public/nsIMsgFolder.idl b/mozilla/mailnews/base/public/nsIMsgFolder.idl index 73bd847c711..f35cf19eda2 100644 --- a/mozilla/mailnews/base/public/nsIMsgFolder.idl +++ b/mozilla/mailnews/base/public/nsIMsgFolder.idl @@ -150,6 +150,7 @@ const nsMsgBiffState nsMsgBiffState_Unknown = 2; // We dunno whether there is ne /* function to get the filter list on folder's server */ nsIMsgFilterList getFilterList( in nsIMsgWindow msgWindow); + void setFilterList( in nsIMsgFilterList filterList); void ForceDBClosed (); void Delete (); diff --git a/mozilla/mailnews/base/search/resources/content/FilterListDialog.js b/mozilla/mailnews/base/search/resources/content/FilterListDialog.js index 64fe2edf3a5..b349046abb2 100644 --- a/mozilla/mailnews/base/search/resources/content/FilterListDialog.js +++ b/mozilla/mailnews/base/search/resources/content/FilterListDialog.js @@ -79,6 +79,35 @@ function onOk() window.close(); } +function onCancel() +{ + var firstItem = getSelectedServerForFilters(); + if (!firstItem) + firstItem = getServerThatCanHaveFilters(); + + if (firstItem) { + var resource = rdf.GetResource(firstItem); + var msgFolder = resource.QueryInterface(Components.interfaces.nsIMsgFolder); + if (msgFolder) + { + msgFolder.ReleaseDelegate("filter"); + msgFolder.setFilterList(null); + try + { + //now find Inbox + var outNumFolders = new Object(); + var inboxFolder = msgFolder.getFoldersWithFlag(0x1000, 1, outNumFolders); + inboxFolder.setFilterList(null); + } + catch(ex) + { + dump ("ex " +ex + "\n"); + } + } + } + window.close(); +} + function onServerClick(event) { var item = event.target; diff --git a/mozilla/mailnews/base/search/resources/content/FilterListDialog.xul b/mozilla/mailnews/base/search/resources/content/FilterListDialog.xul index 0f9e93f67af..ad2b61d4c0e 100644 --- a/mozilla/mailnews/base/search/resources/content/FilterListDialog.xul +++ b/mozilla/mailnews/base/search/resources/content/FilterListDialog.xul @@ -33,6 +33,7 @@ Contributor(s): Hkan Waara buttons="accept,cancel,help" onload="onLoad();" ondialogaccept="return onOk();" + ondialogcancel="return onCancel();" ondialoghelp="return doHelpButton();" width="440" height="320" diff --git a/mozilla/mailnews/base/util/nsMsgFolder.cpp b/mozilla/mailnews/base/util/nsMsgFolder.cpp index 648b7ec2eae..7fb3525c36b 100644 --- a/mozilla/mailnews/base/util/nsMsgFolder.cpp +++ b/mozilla/mailnews/base/util/nsMsgFolder.cpp @@ -2536,6 +2536,18 @@ nsMsgFolder::GetFilterList(nsIMsgWindow *aMsgWindow, nsIMsgFilterList **aResult) return server->GetFilterList(aMsgWindow, aResult); } +NS_IMETHODIMP +nsMsgFolder::SetFilterList(nsIMsgFilterList *aFilterList) +{ + nsresult rv; + nsCOMPtr server; + rv = GetServer(getter_AddRefs(server)); + NS_ENSURE_SUCCESS(rv, rv); + NS_ENSURE_TRUE(server, NS_ERROR_FAILURE); + + return server->SetFilterList(aFilterList); +} + /* void enableNotifications (in long notificationType, in boolean enable); */ NS_IMETHODIMP nsMsgFolder::EnableNotifications(PRInt32 notificationType, PRBool enable, PRBool dbBatching) { diff --git a/mozilla/mailnews/base/util/nsMsgFolder.h b/mozilla/mailnews/base/util/nsMsgFolder.h index 11ad6741aed..6867617eadd 100644 --- a/mozilla/mailnews/base/util/nsMsgFolder.h +++ b/mozilla/mailnews/base/util/nsMsgFolder.h @@ -106,6 +106,7 @@ public: NS_IMETHOD GetCanFileMessages(PRBool *aCanFileMessages); NS_IMETHOD GetCanDeleteMessages(PRBool *aCanDeleteMessages); NS_IMETHOD GetFilterList(nsIMsgWindow *aMsgWindow, nsIMsgFilterList **aFilterList); + NS_IMETHOD SetFilterList(nsIMsgFilterList *aFilterList); NS_IMETHOD GetCanCreateSubfolders(PRBool *aCanCreateSubfolders); NS_IMETHOD GetCanRename(PRBool *aCanRename); NS_IMETHOD GetCanCompact(PRBool *aCanCompact); diff --git a/mozilla/mailnews/imap/src/nsImapMailFolder.cpp b/mozilla/mailnews/imap/src/nsImapMailFolder.cpp index 69ac4c186c4..70514d210a9 100644 --- a/mozilla/mailnews/imap/src/nsImapMailFolder.cpp +++ b/mozilla/mailnews/imap/src/nsImapMailFolder.cpp @@ -7017,3 +7017,10 @@ nsImapMailFolder::SetPerformingBiff(PRBool aPerformingBiff) return NS_OK; } +NS_IMETHODIMP +nsImapMailFolder::SetFilterList(nsIMsgFilterList *aMsgFilterList) +{ + m_filterList = aMsgFilterList; + return nsMsgFolder::SetFilterList(aMsgFilterList); +} + diff --git a/mozilla/mailnews/imap/src/nsImapMailFolder.h b/mozilla/mailnews/imap/src/nsImapMailFolder.h index eb9fb6384be..6dfab1ca45e 100644 --- a/mozilla/mailnews/imap/src/nsImapMailFolder.h +++ b/mozilla/mailnews/imap/src/nsImapMailFolder.h @@ -341,7 +341,8 @@ public: // nsIMsgFilterHitNotification method(s) NS_IMETHOD ApplyFilterHit(nsIMsgFilter *filter, nsIMsgWindow *msgWindow, PRBool *applyMore); NS_IMETHOD IsCommandEnabled(const char *command, PRBool *result); - + NS_IMETHOD SetFilterList(nsIMsgFilterList *aMsgFilterList); + nsresult MoveIncorporatedMessage(nsIMsgDBHdr *mailHdr, nsIMsgDatabase *sourceDB, const char *destFolder,