зеркало из https://github.com/mozilla/gecko-dev.git
enabled SaveAttachment
This commit is contained in:
Родитель
cfe0017815
Коммит
ffbed73cfa
|
@ -458,7 +458,8 @@ nsMessenger::OpenURL(const char * url)
|
|||
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsMessenger::OpenAttachment(const char * url)
|
||||
nsMessenger::OpenAttachment(const char * url, const char * displayName,
|
||||
const char * messageUri)
|
||||
{
|
||||
nsresult rv = NS_ERROR_FAILURE;
|
||||
char *unescapedUrl = nsnull;
|
||||
|
@ -480,7 +481,7 @@ nsMessenger::OpenAttachment(const char * url)
|
|||
|
||||
if (!fileSpec) goto done;
|
||||
|
||||
rv = fileSpec->ChooseOutputFile("Save Attachment", "",
|
||||
rv = fileSpec->ChooseOutputFile("Save Attachment", displayName,
|
||||
nsIFileSpecWithUI::eAllFiles);
|
||||
if (NS_FAILED(rv)) goto done;
|
||||
|
||||
|
@ -492,7 +493,7 @@ nsMessenger::OpenAttachment(const char * url)
|
|||
{
|
||||
NS_ADDREF(aListener);
|
||||
nsCOMPtr<nsIURI> aURL;
|
||||
#if 1
|
||||
|
||||
nsString urlString = unescapedUrl;
|
||||
char *urlCString = urlString.ToNewCString();
|
||||
rv = CreateStartupUrl(urlCString, getter_AddRefs(aURL));
|
||||
|
@ -519,24 +520,14 @@ nsMessenger::OpenAttachment(const char * url)
|
|||
rv = streamConverterService->AsyncConvertData(
|
||||
from.GetUnicode(), to.GetUnicode(), aListener,
|
||||
channelSupport, getter_AddRefs(convertedListener));
|
||||
#endif
|
||||
rv = GetMessageServiceFromURI(unescapedUrl, &messageService);
|
||||
|
||||
rv = GetMessageServiceFromURI(messageUri, &messageService);
|
||||
|
||||
if (NS_SUCCEEDED(rv) && messageService)
|
||||
{
|
||||
#if 1
|
||||
rv = messageService->DisplayMessage(unescapedUrl,
|
||||
rv = messageService->DisplayMessage(messageUri,
|
||||
convertedListener,
|
||||
nsnull, nsnull);
|
||||
#else
|
||||
nsCOMPtr<nsISupports> listenerSupport;
|
||||
rv = aListener->QueryInterface(
|
||||
nsCOMTypeInfo<nsISupports>::GetIID(),
|
||||
getter_AddRefs(listenerSupport));
|
||||
rv = messageService->DisplayMessage(unescapedUrl,
|
||||
listenerSupport,
|
||||
nsnull, nsnull);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
else
|
||||
|
|
|
@ -247,6 +247,10 @@ NSRegisterSelf(nsISupports* aServMgr, const char* path)
|
|||
"component://netscape/messenger/messageservice;type=imap_message",
|
||||
path, PR_TRUE, PR_TRUE);
|
||||
if (NS_FAILED(rv)) finalResult = rv;
|
||||
rv = compMgr->RegisterComponent(kCImapService, nsnull,
|
||||
"component://netscape/messenger/messageservice;type=imap",
|
||||
path, PR_TRUE, PR_TRUE);
|
||||
if (NS_FAILED(rv)) finalResult = rv;
|
||||
|
||||
rv = compMgr->RegisterComponent(kCImapService, nsnull, nsnull,
|
||||
path, PR_TRUE, PR_TRUE);
|
||||
|
|
|
@ -956,10 +956,23 @@ nsImapUrl::GetURI(char** aURI)
|
|||
*aURI = nsnull;
|
||||
PRUint32 key = m_listOfMessageIds ? atoi(m_listOfMessageIds) : 0;
|
||||
nsXPIDLCString theFile;
|
||||
#if 0
|
||||
// mscott --> this is probably wrong (the part about getting the file part)
|
||||
// we may need to extract it from a different part of the uri.
|
||||
GetFileName(getter_Copies(theFile));
|
||||
return nsBuildImapMessageURI(theFile, key, aURI);
|
||||
#else
|
||||
// jefft -- indeed that is wrong
|
||||
CreateCanonicalSourceFolderPathString(getter_Copies(theFile));
|
||||
nsCString fullFolderPath = m_userName;
|
||||
char *hostName = nsnull;
|
||||
rv = GetHost(&hostName);
|
||||
fullFolderPath += '@';
|
||||
fullFolderPath += hostName;
|
||||
fullFolderPath += '/';
|
||||
fullFolderPath += theFile;
|
||||
return nsBuildImapMessageURI(fullFolderPath, key, aURI);
|
||||
#endif
|
||||
}
|
||||
return rv;
|
||||
}
|
||||
|
|
|
@ -36,6 +36,7 @@
|
|||
#include "nsIAbAddressCollecter.h"
|
||||
#include "nsAbBaseCID.h"
|
||||
#include "nsCOMPtr.h"
|
||||
#include "nsIMsgMailNewsUrl.h"
|
||||
|
||||
static NS_DEFINE_CID(kMsgHeaderParserCID, NS_MSGHEADERPARSER_CID);
|
||||
static NS_DEFINE_CID(kCAddressCollecter, NS_ABADDRESSCOLLECTER_CID);
|
||||
|
@ -530,6 +531,7 @@ nsMimeXULEmitter::DumpAttachmentMenu()
|
|||
// RICHIE SHERRY - Hard coded string...evil...need to use string bundle when they work on
|
||||
// non UI threads.
|
||||
char *i18nString = nsnull;
|
||||
nsresult rv;
|
||||
|
||||
if (mAttachArray->Count() == 1)
|
||||
i18nString = "Attachment";
|
||||
|
@ -545,14 +547,15 @@ nsMimeXULEmitter::DumpAttachmentMenu()
|
|||
|
||||
UtilityWriteCRLF("<box align=\"horizontal\">");
|
||||
|
||||
UtilityWriteCRLF("<popup id=\"attachmentPopup\">");
|
||||
UtilityWriteCRLF("<menu>");
|
||||
|
||||
char *escapedUrl;
|
||||
char *escapedUrl = nsnull;
|
||||
nsCOMPtr<nsIMsgMessageUrl> messageUrl;
|
||||
char *urlString = nsnull;
|
||||
|
||||
// Now we can finally write out the attachment information...
|
||||
if (mAttachArray->Count() > 0)
|
||||
{
|
||||
UtilityWriteCRLF("<popup id=\"attachmentPopup\">");
|
||||
UtilityWriteCRLF("<menu>");
|
||||
PRInt32 i;
|
||||
|
||||
for (i=0; i<mAttachArray->Count(); i++)
|
||||
|
@ -574,15 +577,27 @@ nsMimeXULEmitter::DumpAttachmentMenu()
|
|||
{
|
||||
UtilityWrite(attachInfo->urlSpec);
|
||||
}
|
||||
UtilityWrite("mailboxMessage://dummyMessage");
|
||||
UtilityWrite("','");
|
||||
UtilityWrite(attachInfo->displayName);
|
||||
UtilityWrite("','");
|
||||
|
||||
nsCOMPtr<nsIMsgMessageUrl> messageUrl = do_QueryInterface(mURL, &rv);
|
||||
if (NS_SUCCEEDED(rv))
|
||||
rv = messageUrl->GetURI(&urlString);
|
||||
if (NS_SUCCEEDED(rv) && urlString)
|
||||
{
|
||||
UtilityWrite(urlString);
|
||||
nsCRT::free(urlString);
|
||||
urlString = nsnull;
|
||||
}
|
||||
UtilityWriteCRLF("' );\" />");
|
||||
}
|
||||
UtilityWriteCRLF("</menu>");
|
||||
UtilityWriteCRLF("</popup>");
|
||||
}
|
||||
|
||||
UtilityWriteCRLF("</menu>");
|
||||
UtilityWriteCRLF("</popup>");
|
||||
#if 1
|
||||
|
||||
#if defined (DEBUG_jefft)
|
||||
// **** jefft - this is a temporary implementation
|
||||
if (mAttachArray->Count() > 0)
|
||||
{
|
||||
|
@ -590,7 +605,7 @@ nsMimeXULEmitter::DumpAttachmentMenu()
|
|||
|
||||
UtilityWriteCRLF("<menubar>");
|
||||
|
||||
UtilityWriteCRLF("<menu value=\"Open Attachment(s)\">");
|
||||
UtilityWriteCRLF("<menu value=\"Save Attachment(s)\">");
|
||||
UtilityWriteCRLF("<menupopup>");
|
||||
|
||||
for (i=0; i<mAttachArray->Count(); i++)
|
||||
|
@ -612,6 +627,19 @@ nsMimeXULEmitter::DumpAttachmentMenu()
|
|||
else
|
||||
{
|
||||
UtilityWrite(attachInfo->urlSpec);
|
||||
}
|
||||
UtilityWrite("','");
|
||||
UtilityWrite(attachInfo->displayName);
|
||||
UtilityWrite("','");
|
||||
|
||||
nsCOMPtr<nsIMsgMessageUrl> messageUrl = do_QueryInterface(mURL, &rv);
|
||||
if (NS_SUCCEEDED(rv))
|
||||
rv = messageUrl->GetURI(&urlString);
|
||||
if (NS_SUCCEEDED(rv) && urlString)
|
||||
{
|
||||
UtilityWrite(urlString);
|
||||
nsCRT::free(urlString);
|
||||
urlString = nsnull;
|
||||
}
|
||||
UtilityWriteCRLF("' );\" />");
|
||||
}
|
||||
|
|
|
@ -963,11 +963,7 @@ mime_bridge_create_display_stream(
|
|||
// Store the URL string for this decode operation
|
||||
char *urlString;
|
||||
nsresult rv;
|
||||
nsCOMPtr<nsIMsgMessageUrl> messageUrl = do_QueryInterface(uri, &rv);
|
||||
if (NS_SUCCEEDED(rv))
|
||||
rv = messageUrl->GetURI(&urlString);
|
||||
if (NS_FAILED(rv))
|
||||
rv = uri->GetSpec(&urlString);
|
||||
rv = uri->GetSpec(&urlString);
|
||||
if (NS_SUCCEEDED(rv))
|
||||
{
|
||||
if ((urlString) && (*urlString))
|
||||
|
|
Загрузка…
Ссылка в новой задаче