зеркало из https://github.com/mozilla/gecko-dev.git
For search, cache default charset to the class. For eudora, changed to get a pref directly,
bug 110127, r=naving, sr=bienvenu.
This commit is contained in:
Родитель
3d86d24c3c
Коммит
16a527d0a8
|
@ -79,6 +79,8 @@ public:
|
||||||
nsCOMPtr<nsISupportsArray> m_searchTerms; /* linked list of criteria terms */
|
nsCOMPtr<nsISupportsArray> m_searchTerms; /* linked list of criteria terms */
|
||||||
|
|
||||||
PRBool m_abortCalled;
|
PRBool m_abortCalled;
|
||||||
|
nsXPIDLString m_defaultCharset;
|
||||||
|
PRBool m_forceAsciiSearch;
|
||||||
|
|
||||||
static nsresult EncodeImap (char **ppEncoding,
|
static nsresult EncodeImap (char **ppEncoding,
|
||||||
nsISupportsArray *searchTerms,
|
nsISupportsArray *searchTerms,
|
||||||
|
|
|
@ -78,7 +78,6 @@ const char *nsMsgSearchAdapter::m_kImapNotSeen = " UNSEEN ";
|
||||||
const char *nsMsgSearchAdapter::m_kImapNotAnswered = " UNANSWERED ";
|
const char *nsMsgSearchAdapter::m_kImapNotAnswered = " UNANSWERED ";
|
||||||
const char *nsMsgSearchAdapter::m_kImapCharset = " CHARSET ";
|
const char *nsMsgSearchAdapter::m_kImapCharset = " CHARSET ";
|
||||||
|
|
||||||
static NS_DEFINE_CID(kPrefServiceCID, NS_PREF_CID);
|
|
||||||
static NS_DEFINE_CID(kIOServiceCID, NS_IOSERVICE_CID);
|
static NS_DEFINE_CID(kIOServiceCID, NS_IOSERVICE_CID);
|
||||||
#define PREF_CUSTOM_HEADERS "mailnews.customHeaders"
|
#define PREF_CUSTOM_HEADERS "mailnews.customHeaders"
|
||||||
|
|
||||||
|
@ -321,13 +320,20 @@ char *nsMsgSearchAdapter::UnEscapeSearchUrl (const char *commandSpecificData)
|
||||||
void
|
void
|
||||||
nsMsgSearchAdapter::GetSearchCharsets(nsString &srcCharset, nsString& dstCharset)
|
nsMsgSearchAdapter::GetSearchCharsets(nsString &srcCharset, nsString& dstCharset)
|
||||||
{
|
{
|
||||||
nsresult rv;
|
nsresult rv;
|
||||||
nsAutoString defaultCharset;
|
if (m_defaultCharset.IsEmpty())
|
||||||
char *search_charset = nsMsgI18NGetDefaultMailCharset();
|
{
|
||||||
defaultCharset.AssignWithConversion(search_charset);
|
m_forceAsciiSearch = PR_FALSE; // set the default value in case of error
|
||||||
PR_Free((void *)search_charset);
|
nsCOMPtr<nsIPref> prefs(do_GetService(NS_PREF_CONTRACTID, &rv));
|
||||||
srcCharset = defaultCharset;
|
if (NS_SUCCEEDED(rv))
|
||||||
dstCharset = defaultCharset;
|
{
|
||||||
|
rv = prefs->GetLocalizedUnicharPref("mailnews.view_default_charset", getter_Copies(m_defaultCharset));
|
||||||
|
rv = prefs->GetBoolPref("mailnews.force_ascii_search", &m_forceAsciiSearch);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
srcCharset.Assign(m_defaultCharset.IsEmpty() ?
|
||||||
|
NS_LITERAL_STRING("ISO-8859-1") : m_defaultCharset);
|
||||||
|
dstCharset = srcCharset;
|
||||||
|
|
||||||
if (m_scope)
|
if (m_scope)
|
||||||
{
|
{
|
||||||
|
@ -351,19 +357,10 @@ nsMsgSearchAdapter::GetSearchCharsets(nsString &srcCharset, nsString& dstCharset
|
||||||
// the source. (CS_DEFAULT is an indication that the charset
|
// the source. (CS_DEFAULT is an indication that the charset
|
||||||
// was undefined or unavailable.)
|
// was undefined or unavailable.)
|
||||||
// ### well, it's not really anymore. Is there an equivalent?
|
// ### well, it's not really anymore. Is there an equivalent?
|
||||||
if (!nsCRT::strcmp(dstCharset.get(), defaultCharset.get()))
|
if (!nsCRT::strcmp(dstCharset.get(), m_defaultCharset.get()))
|
||||||
dstCharset = srcCharset;
|
dstCharset = srcCharset;
|
||||||
|
|
||||||
PRBool forceAscii = PR_FALSE;
|
if (m_forceAsciiSearch)
|
||||||
|
|
||||||
nsCOMPtr<nsIPref> prefs(do_GetService(kPrefServiceCID, &rv));
|
|
||||||
|
|
||||||
if (NS_SUCCEEDED(rv))
|
|
||||||
{
|
|
||||||
rv = prefs->GetBoolPref("mailnews.force_ascii_search", &forceAscii);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (forceAscii)
|
|
||||||
{
|
{
|
||||||
// Special cases to use in order to force US-ASCII searching with Latin1
|
// Special cases to use in order to force US-ASCII searching with Latin1
|
||||||
// or MacRoman text. Eurgh. This only has to happen because IMAP
|
// or MacRoman text. Eurgh. This only has to happen because IMAP
|
||||||
|
|
|
@ -36,6 +36,7 @@ REQUIRES = xpcom \
|
||||||
msglocal \
|
msglocal \
|
||||||
mimetype \
|
mimetype \
|
||||||
unicharutil \
|
unicharutil \
|
||||||
|
pref \
|
||||||
$(NULL)
|
$(NULL)
|
||||||
LIBRARY_NAME = $(MODULE)
|
LIBRARY_NAME = $(MODULE)
|
||||||
META_COMPONENT = mail
|
META_COMPONENT = mail
|
||||||
|
|
|
@ -47,6 +47,7 @@
|
||||||
#include "EudoraDebugLog.h"
|
#include "EudoraDebugLog.h"
|
||||||
|
|
||||||
#include "nsMimeTypes.h"
|
#include "nsMimeTypes.h"
|
||||||
|
#include "nsIPref.h"
|
||||||
|
|
||||||
static NS_DEFINE_CID( kMsgSendCID, NS_MSGSEND_CID);
|
static NS_DEFINE_CID( kMsgSendCID, NS_MSGSEND_CID);
|
||||||
static NS_DEFINE_CID( kMsgCompFieldsCID, NS_MSGCOMPFIELDS_CID);
|
static NS_DEFINE_CID( kMsgCompFieldsCID, NS_MSGCOMPFIELDS_CID);
|
||||||
|
@ -619,9 +620,11 @@ nsresult nsEudoraCompose::SendTheMessage( nsIFileSpec *pMsg)
|
||||||
{ // last resort
|
{ // last resort
|
||||||
if (!m_defCharset.Length())
|
if (!m_defCharset.Length())
|
||||||
{
|
{
|
||||||
char *pSet = nsMsgI18NGetDefaultMailCharset();
|
nsXPIDLString defaultCharset;
|
||||||
m_defCharset.AssignWithConversion(pSet);
|
nsCOMPtr<nsIPref> prefs(do_GetService(NS_PREF_CONTRACTID, &rv));
|
||||||
nsCRT::free( pSet);
|
if (NS_SUCCEEDED(rv))
|
||||||
|
rv = prefs->GetLocalizedUnicharPref("mailnews.view_default_charset", getter_Copies(defaultCharset));
|
||||||
|
m_defCharset.Assign(defaultCharset ? defaultCharset.get() : NS_LITERAL_STRING("ISO-8859-1").get());
|
||||||
}
|
}
|
||||||
headerVal = m_defCharset;
|
headerVal = m_defCharset;
|
||||||
}
|
}
|
||||||
|
|
Загрузка…
Ссылка в новой задаче