mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-07 12:15:51 +00:00
implemented SaveAs() method
This commit is contained in:
parent
94e527b91f
commit
73aec1aeb7
@ -43,6 +43,7 @@
|
||||
#include "nsIPop3IncomingServer.h"
|
||||
#include "nsINoIncomingServer.h"
|
||||
#include "nsIMsgMessageService.h"
|
||||
#include "nsIFileSpecWithUI.h"
|
||||
#include "nsFileSpec.h"
|
||||
|
||||
#include "nsIMessage.h"
|
||||
@ -405,6 +406,33 @@ nsMessenger::OpenURL(const char * url)
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsMessenger::SaveAs(const char* url, PRBool asFile)
|
||||
{
|
||||
nsresult rv = NS_OK;
|
||||
|
||||
if (url)
|
||||
{
|
||||
nsIMsgMessageService* messageService = nsnull;
|
||||
rv = GetMessageServiceFromURI(url, &messageService);
|
||||
if (NS_SUCCEEDED(rv) && messageService)
|
||||
{
|
||||
if (asFile)
|
||||
{
|
||||
nsCOMPtr<nsIFileSpecWithUI>
|
||||
fileSpec(getter_AddRefs(NS_CreateFileSpecWithUI()));
|
||||
if (!fileSpec) return NS_ERROR_FAILURE;
|
||||
rv = fileSpec->ChooseOutputFile("Save Message", "",
|
||||
nsIFileSpecWithUI::eAllMailOutputFilters);
|
||||
if (NS_SUCCEEDED(rv))
|
||||
messageService->SaveMessageToDisk(url, fileSpec, PR_FALSE, nsnull,
|
||||
nsnull);
|
||||
}
|
||||
}
|
||||
}
|
||||
return rv;
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsMessenger::DoCommand(nsIRDFCompositeDataSource* db, char *command,
|
||||
nsISupportsArray *srcArray,
|
||||
|
Loading…
Reference in New Issue
Block a user