fixed bug 16235 -- [FEATURE] pop3_gets_new_mail on biff; put up confirmation dialog when deleting imap folders; r=scottip

This commit is contained in:
jefft%netscape.com 2000-04-03 22:48:40 +00:00
Родитель 90d4dd3ad3
Коммит 35b21c5e0e
4 изменённых файлов: 45 добавлений и 6 удалений

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

@ -261,3 +261,8 @@
## @name IMAP_NET_TIMEOUT_ERROR
## @loc None
5054=Connection to the server timed out.
## @name IMAP_MOVE_FOLDER_TO_TRASH
## @loc None
5055=Are you sure you want to move the selected folders into the Trash?

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

@ -58,6 +58,9 @@
#include "nsIMsgFilterService.h"
#include "nsImapMoveCoalescer.h"
#include "nsIPrompt.h"
#include "nsIWebShell.h"
#include "nsIDocShell.h"
#include "nsIInterfaceRequestor.h"
#include "nsINetSupportDialogService.h"
#include "nsSpecialSystemDirectory.h"
#include "nsXPIDLString.h"
@ -1506,6 +1509,8 @@ nsImapMailFolder::DeleteSubFolders(nsISupportsArray* folders, nsIMsgWindow *msgW
nsCOMPtr<nsIMsgFolder> trashFolder;
PRUint32 i, folderCount = 0;
nsresult rv;
PRBool deleteFromTrash = InTrash(this);;
PRBool moveToTrash = PR_FALSE;
NS_WITH_SERVICE (nsIImapService, imapService, kCImapService, &rv);
if (NS_SUCCEEDED(rv))
@ -1514,6 +1519,18 @@ nsImapMailFolder::DeleteSubFolders(nsISupportsArray* folders, nsIMsgWindow *msgW
if (NS_SUCCEEDED(rv))
{
rv = GetTrashFolder(getter_AddRefs(trashFolder));
nsCOMPtr<nsIWebShell> webShell;
if (!msgWindow) return NS_ERROR_NULL_POINTER;
msgWindow->GetRootWebShell(getter_AddRefs(webShell));
nsCOMPtr<nsIDocShell> docShell;
if (webShell) docShell = do_QueryInterface(webShell);
nsCOMPtr<nsIPrompt> dialog;
if (docShell) dialog = do_GetInterface(docShell);
PRUnichar *moveToTrashStr = IMAPGetStringByID(IMAP_MOVE_FOLDER_TO_TRASH);
if (dialog && moveToTrashStr)
dialog->Confirm (moveToTrashStr, &moveToTrash);
for (i = 0; i < folderCount; i++)
{
folderSupport = getter_AddRefs(folders->ElementAt(i));
@ -1521,12 +1538,12 @@ nsImapMailFolder::DeleteSubFolders(nsISupportsArray* folders, nsIMsgWindow *msgW
if (NS_SUCCEEDED(rv))
{
urlListener = do_QueryInterface(curFolder);
if (InTrash(curFolder))
if (deleteFromTrash)
rv = imapService->DeleteFolder(m_eventQueue,
curFolder,
urlListener,
nsnull);
else
else if (moveToTrash)
rv = imapService->MoveFolder(m_eventQueue,
curFolder,
trashFolder,
@ -1534,10 +1551,15 @@ nsImapMailFolder::DeleteSubFolders(nsISupportsArray* folders, nsIMsgWindow *msgW
nsnull);
}
}
if (moveToTrashStr)
nsCRT::free(moveToTrashStr);
}
}
return nsMsgFolder::DeleteSubFolders(folders, nsnull);
if (deleteFromTrash || moveToTrash)
return nsMsgFolder::DeleteSubFolders(folders, nsnull);
else
return rv;
}
NS_IMETHODIMP nsImapMailFolder::GetNewMessages(nsIMsgWindow *aWindow)

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

@ -86,5 +86,6 @@ NS_END_EXTERN_C
#define IMAP_UNKNOWN_HOST_ERROR 5052
#define IMAP_CONNECTION_REFUSED_ERROR 5053
#define IMAP_NET_TIMEOUT_ERROR 5054
#define IMAP_MOVE_FOLDER_TO_TRASH 5055
#endif /* _nsImapStringBundle_H__ */

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

@ -126,7 +126,10 @@ NS_IMETHODIMP nsPop3IncomingServer::PerformBiff()
if(rootMsgFolder)
{
PRUint32 numFolders;
rv = rootMsgFolder->GetFoldersWithFlag(MSG_FOLDER_FLAG_INBOX, 1, &numFolders, getter_AddRefs(inbox));
rv = rootMsgFolder->GetFoldersWithFlag(MSG_FOLDER_FLAG_INBOX, 1,
&numFolders,
getter_AddRefs(inbox));
if (NS_FAILED(rv) || numFolders != 1) return rv;
}
}
@ -139,7 +142,15 @@ NS_IMETHODIMP nsPop3IncomingServer::PerformBiff()
rv = mailSession->GetTopmostMsgWindow(getter_AddRefs(msgWindow));
if(NS_SUCCEEDED(rv))
rv = pop3Service->CheckForNewMail(msgWindow, nsnull, inbox, this, nsnull);
{
PRBool downloadOnBiff = PR_FALSE;
rv = GetDownloadOnBiff(&downloadOnBiff);
if (downloadOnBiff)
rv = pop3Service->GetNewMail(msgWindow, nsnull, this, nsnull);
else
rv = pop3Service->CheckForNewMail(msgWindow, nsnull, inbox, this,
nsnull);
}
return NS_OK;
}