mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-12-13 01:55:44 +00:00
Added mailCharacterSet to nsIMsgWindow to keep the charset used by libmime, bug 28869, r=mscott.
This commit is contained in:
parent
b8bd1adb30
commit
fbd57efd15
@ -45,6 +45,7 @@ interface nsIMsgWindow : nsISupports {
|
||||
attribute nsIMsgFolder openFolder;
|
||||
attribute nsIDocShell rootDocShell;
|
||||
readonly attribute nsIPrompt promptDialog;
|
||||
attribute wstring mailCharacterSet;
|
||||
|
||||
void SetDOMWindow(in nsIDOMWindow window);
|
||||
void StopUrls();
|
||||
|
@ -39,6 +39,8 @@
|
||||
#include "nsIWebProgressListener.h"
|
||||
#include "nsPIDOMWindow.h"
|
||||
#include "nsIPrompt.h"
|
||||
#include "nsICharsetConverterManager.h"
|
||||
#include "nsICharsetConverterManager2.h"
|
||||
|
||||
// XXX Remove
|
||||
#include "nsIWebShell.h"
|
||||
@ -230,6 +232,37 @@ NS_IMETHODIMP nsMsgWindow::SetRootDocShell(nsIDocShell * aDocShell)
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsMsgWindow::GetMailCharacterSet(PRUnichar * *aMailCharacterSet)
|
||||
{
|
||||
if(!aMailCharacterSet)
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
|
||||
*aMailCharacterSet = mMailCharacterSet.ToNewUnicode();
|
||||
if (!(*aMailCharacterSet))
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsMsgWindow::SetMailCharacterSet(const PRUnichar * aMailCharacterSet)
|
||||
{
|
||||
mMailCharacterSet.Assign(aMailCharacterSet);
|
||||
|
||||
// Convert to a canonical charset name instead of using the charset name from the message header as is.
|
||||
// This is needed for charset menu item to have a check mark correctly.
|
||||
nsresult rv;
|
||||
nsCOMPtr<nsICharsetConverterManager2> ccm2 = do_GetService(NS_CHARSETCONVERTERMANAGER_PROGID, &rv);
|
||||
if (NS_SUCCEEDED(rv))
|
||||
{
|
||||
nsCOMPtr <nsIAtom> charsetAtom;
|
||||
rv = ccm2->GetCharsetAtom(mMailCharacterSet.GetUnicode(), getter_AddRefs(charsetAtom));
|
||||
if (NS_SUCCEEDED(rv))
|
||||
rv = charsetAtom->ToString(mMailCharacterSet);
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsMsgWindow::SetDOMWindow(nsIDOMWindow *aWindow)
|
||||
{
|
||||
if (!aWindow)
|
||||
|
@ -57,6 +57,8 @@ protected:
|
||||
// let's not make this a strong ref - we don't own it.
|
||||
nsIDocShell *mRootDocShell;
|
||||
nsIDocShell *mMessageWindowDocShell;
|
||||
|
||||
nsString mMailCharacterSet;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
Loading…
Reference in New Issue
Block a user