Bug #43661 --> open attachment needs to pass in the file name

r=bienvenu
This commit is contained in:
mscott%netscape.com 2000-07-07 21:57:39 +00:00
Родитель dbaac39c8d
Коммит f4be0bbdc6
5 изменённых файлов: 30 добавлений и 14 удалений

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

@ -84,12 +84,14 @@ interface nsIMsgMessageService : nsISupports {
/////////////////////////////////////////////////////////////////////
// OpenAttachment: When you want an attachment downloaded
// aContentType --> we need to know the content type of the attachment
// aFileName --> the name of the attachment.
// aUrl --> string representation of the original url associated with the msg.
// aMessageUri --> RDF resource that describes the message
// aMsgWindow --> message window
///////////////////////////////////////////////////////////////////
void openAttachment(in string aContentType,
in string aFileName,
in string aUrl,
in string aMessageUri,
in nsISupports aDisplayConsumer,

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

@ -292,7 +292,9 @@ NS_IMETHODIMP nsImapService::GetUrlForUri(const char *aMessageURI, nsIURI **aURL
return rv;
}
NS_IMETHODIMP nsImapService::OpenAttachment(const char *aContentType, const char *aUrl,
NS_IMETHODIMP nsImapService::OpenAttachment(const char *aContentType,
const char *aFileName,
const char *aUrl,
const char *aMessageUri,
nsISupports *aDisplayConsumer,
nsIMsgWindow *aMsgWindow,
@ -350,6 +352,9 @@ NS_IMETHODIMP nsImapService::OpenAttachment(const char *aContentType, const char
return rv;
if (uriMimePart)
{
nsCOMPtr<nsIMsgMailNewsUrl> mailUrl (do_QueryInterface(imapUrl));
if (mailUrl)
mailUrl->SetFileName(aFileName);
rv = FetchMimePart(imapUrl, nsIImapUrl::nsImapOpenMimePart, folder, imapMessageSink,
nsnull, aDisplayConsumer, msgKey, uriMimePart);
}

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

@ -105,7 +105,7 @@ nsresult nsMailboxService::CopyMessage(const char * aSrcMailboxURI,
nsMailboxAction mailboxAction = nsIMailboxUrl::ActionMoveMessage;
if (!moveMessage)
mailboxAction = nsIMailboxUrl::ActionCopyMessage;
return FetchMessage(aSrcMailboxURI, aMailboxCopyHandler, nsnull, aUrlListener, mailboxAction, nsnull, aURL);
return FetchMessage(aSrcMailboxURI, aMailboxCopyHandler, nsnull, aUrlListener, nsnull, mailboxAction, nsnull, aURL);
}
nsresult nsMailboxService::CopyMessages(nsMsgKeyArray *msgKeys,
@ -123,6 +123,7 @@ nsresult nsMailboxService::FetchMessage(const char* aMessageURI,
nsISupports * aDisplayConsumer,
nsIMsgWindow * aMsgWindow,
nsIUrlListener * aUrlListener,
const char * aFileName, /* only used by open attachment... */
nsMailboxAction mailboxAction,
const PRUnichar * aCharsetOverride,
nsIURI ** aURL)
@ -144,6 +145,9 @@ nsresult nsMailboxService::FetchMessage(const char* aMessageURI,
nsCOMPtr<nsIMsgI18NUrl> i18nurl (do_QueryInterface(msgUrl));
i18nurl->SetCharsetOverRide(aCharsetOverride);
if (aFileName)
msgUrl->SetFileName(aFileName);
// instead of running the mailbox url like we used to, let's try to run the url in the docshell...
nsCOMPtr<nsIDocShell> docShell(do_QueryInterface(aDisplayConsumer, &rv));
// if we were given a docShell, run the url in the docshell..otherwise just run it normally.
@ -179,15 +183,17 @@ nsresult nsMailboxService::DisplayMessage(const char* aMessageURI,
nsIURI ** aURL)
{
return FetchMessage(aMessageURI, aDisplayConsumer,
aMsgWindow,aUrlListener,
aMsgWindow,aUrlListener, nsnull,
nsIMailboxUrl::ActionDisplayMessage, aCharsetOveride, aURL);
}
NS_IMETHODIMP nsMailboxService::OpenAttachment(const char *aContentType, const char *aUrl,
const char *aMessageUri,
nsISupports *aDisplayConsumer,
nsIMsgWindow *aMsgWindow,
nsIUrlListener *aUrlListener)
NS_IMETHODIMP nsMailboxService::OpenAttachment(const char *aContentType,
const char *aFileName,
const char *aUrl,
const char *aMessageUri,
nsISupports *aDisplayConsumer,
nsIMsgWindow *aMsgWindow,
nsIUrlListener *aUrlListener)
{
nsCAutoString partMsgUrl = aMessageUri;
@ -198,7 +204,7 @@ NS_IMETHODIMP nsMailboxService::OpenAttachment(const char *aContentType, const c
partMsgUrl += "&type=";
partMsgUrl += aContentType;
return FetchMessage(partMsgUrl, aDisplayConsumer,
aMsgWindow,aUrlListener,
aMsgWindow,aUrlListener, aFileName,
nsIMailboxUrl::ActionOpenAttachment, nsnull, nsnull);
}
@ -223,9 +229,9 @@ nsMailboxService::SaveMessageToDisk(const char *aMessageURI,
nsCOMPtr<nsIMsgMessageUrl> msgUrl = do_QueryInterface(mailboxurl);
if (msgUrl)
{
msgUrl->SetMessageFile(aFile);
msgUrl->SetAddDummyEnvelope(aAddDummyEnvelope);
msgUrl->SetCanonicalLineEnding(canonicalLineEnding);
msgUrl->SetMessageFile(aFile);
msgUrl->SetAddDummyEnvelope(aAddDummyEnvelope);
msgUrl->SetCanonicalLineEnding(canonicalLineEnding);
}
nsCOMPtr<nsIURI> url = do_QueryInterface(mailboxurl);
@ -414,7 +420,7 @@ nsresult nsMailboxService::DisplayMessageForPrinting(const char* aMessageURI,
nsIURI ** aURL)
{
mPrintingOperation = PR_TRUE;
nsresult rv = FetchMessage(aMessageURI, aDisplayConsumer, aMsgWindow,aUrlListener,
nsresult rv = FetchMessage(aMessageURI, aDisplayConsumer, aMsgWindow,aUrlListener, nsnull,
nsIMailboxUrl::ActionDisplayMessage, nsnull, aURL);
mPrintingOperation = PR_FALSE;
return rv;

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

@ -62,6 +62,7 @@ protected:
nsISupports * aDisplayConsumer,
nsIMsgWindow * aMsgWindow,
nsIUrlListener * aUrlListener,
const char * aFileName, /* only used by open attachment */
nsMailboxAction mailboxAction,
const PRUnichar * aCharsetOverride,
nsIURI ** aURL);

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

@ -214,7 +214,9 @@ nsNntpService::DisplayMessage(const char* aMessageURI, nsISupports * aDisplayCon
}
NS_IMETHODIMP nsNntpService::OpenAttachment(const char *aContentType, const char *aUrl,
NS_IMETHODIMP nsNntpService::OpenAttachment(const char *aContentType,
const char *aFileName,
const char *aUrl,
const char *aMessageUri,
nsISupports *aDisplayConsumer,
nsIMsgWindow *aMsgWindow,