Bug #43661 --> pass in the file name for the attachment

r=bienvenu
This commit is contained in:
mscott%netscape.com 2000-07-07 21:56:38 +00:00
Родитель db960d3077
Коммит 9be0256d9d
3 изменённых файлов: 30 добавлений и 6 удалений

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

@ -584,7 +584,7 @@ nsMessenger::OpenAttachment(const char * aContentType, const char * aUrl, const
rv = GetMessageServiceFromURI(aMessageUri, &messageService);
if (messageService)
{
rv = messageService->OpenAttachment(aContentType, aUrl, aMessageUri, mDocShell, mMsgWindow, nsnull);
rv = messageService->OpenAttachment(aContentType, aDisplayName, aUrl, aMessageUri, mDocShell, mMsgWindow, nsnull);
}
if (messageService)
ReleaseMessageServiceFromURI(aMessageUri, messageService);

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

@ -475,7 +475,13 @@ NS_IMETHODIMP nsMsgMailNewsUrl::SetDirectory(const char *aDirectory)
NS_IMETHODIMP nsMsgMailNewsUrl::GetFileName(char * *aFileName)
{
return m_baseURL->GetFileName(aFileName);
if (!mAttachmentFileName.IsEmpty())
{
*aFileName = mAttachmentFileName.ToNewCString();
return NS_OK;
}
else
return m_baseURL->GetFileName(aFileName);
}
NS_IMETHODIMP nsMsgMailNewsUrl::GetFileBaseName(char * *aFileBaseName)
@ -490,7 +496,17 @@ NS_IMETHODIMP nsMsgMailNewsUrl::SetFileBaseName(const char * aFileBaseName)
NS_IMETHODIMP nsMsgMailNewsUrl::GetFileExtension(char * *aFileExtension)
{
return m_baseURL->GetFileExtension(aFileExtension);
if (!mAttachmentFileName.IsEmpty())
{
nsCAutoString extension;
PRInt32 pos = mAttachmentFileName.RFindCharInSet(".");
if (pos > 0)
mAttachmentFileName.Mid(extension, pos + 1 /* skip the '.' */, -1);
*aFileExtension = extension.ToNewCString();
return NS_OK;
}
else
return m_baseURL->GetFileExtension(aFileExtension);
}
NS_IMETHODIMP nsMsgMailNewsUrl::SetFileExtension(const char * aFileExtension)
@ -500,7 +516,8 @@ NS_IMETHODIMP nsMsgMailNewsUrl::SetFileExtension(const char * aFileExtension)
NS_IMETHODIMP nsMsgMailNewsUrl::SetFileName(const char * aFileName)
{
return m_baseURL->SetFileName(aFileName);
mAttachmentFileName = aFileName;
return NS_OK;
}
NS_IMETHODIMP nsMsgMailNewsUrl::GetParam(char * *aParam)
@ -542,4 +559,3 @@ NS_IMETHODIMP nsMsgMailNewsUrl::SetFilePath(const char *i_DirFile)
{
return m_baseURL->SetFilePath(i_DirFile);
}

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

@ -34,6 +34,7 @@
#include "nsIURL.h"
#include "nsILoadGroup.h"
#include "nsIMsgSearchSession.h"
///////////////////////////////////////////////////////////////////////////////////
// Okay, I found that all of the mail and news url interfaces needed to support
// several common interfaces (in addition to those provided through nsIURI).
@ -68,9 +69,16 @@ protected:
PRBool m_updatingFolder;
PRBool m_addContentToCache;
// the following field is really a bit of a hack to make
// open attachments work. The external applications code sometimes trys to figure out the right
// handler to use by looking at the file extension of the url we are trying to load. Unfortunately,
// the attachment file name really isn't part of the url string....so we'll store it here...and if
// the url we are running is an attachment url, we'll set it here. Then when the helper apps code
// asks us for it, we'll return the right value.
nsCString mAttachmentFileName;
// manager of all of current url listeners....
nsCOMPtr<nsIUrlListenerManager> m_urlListeners;
};
#endif /* nsMsgMailNewsUrl_h___ */