replace nsIPref with nsIPrefBranch in mailnews, patch by arne.anka@stupido.com, r=me, sr=mscott

This commit is contained in:
bienvenu%nventure.com 2004-01-04 21:47:17 +00:00
Родитель 8d2dfd4582
Коммит 693f9301e7
23 изменённых файлов: 97 добавлений и 150 удалений

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

@ -46,7 +46,8 @@
#include "nsMsgBaseCID.h"
#include "nsIMsgMailSession.h"
#include "nsIMsgFolderCache.h"
#include "nsIPref.h"
#include "nsIPrefService.h"
#include "nsIPrefBranch.h"
#include "nsIDOMWindow.h"
#include "nsXPCOM.h"
#include "nsISupportsPrimitives.h"
@ -54,7 +55,6 @@
#include "nsString.h"
#include "nsIURI.h"
#include "nsIDialogParamBlock.h"
static NS_DEFINE_CID(kPrefServiceCID, NS_PREF_CID);
NS_IMPL_THREADSAFE_ADDREF(nsMessengerBootstrap)
NS_IMPL_THREADSAFE_RELEASE(nsMessengerBootstrap)
@ -74,12 +74,12 @@ NS_IMETHODIMP nsMessengerBootstrap::GetChromeUrlForTask(char **aChromeUrlForTask
{
#ifndef MOZ_THUNDERBIRD
if (!aChromeUrlForTask) return NS_ERROR_FAILURE;
nsresult rv;
nsCOMPtr<nsIPref> prefService(do_GetService(kPrefServiceCID, &rv));
if (NS_SUCCEEDED(rv))
nsCOMPtr<nsIPrefBranch> pPrefBranch(do_GetService(NS_PREFSERVICE_CONTRACTID));
if (pPrefBranch)
{
nsresult rv;
PRInt32 layout;
rv = prefService->GetIntPref("mail.pane_config", &layout);
rv = pPrefBranch->GetIntPref("mail.pane_config", &layout);
if(NS_SUCCEEDED(rv))
{
if(layout == 0)

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

@ -38,10 +38,10 @@
#include "nsMsgAttachmentHandler.h"
#include "nsMsgCopy.h"
#include "nsIPref.h"
#include "nsIPrefService.h"
#include "nsIPrefBranch.h"
#include "nsMsgSend.h"
#include "nsMsgCompUtils.h"
#include "nsIPref.h"
#include "nsMsgEncoders.h"
#include "nsMsgI18N.h"
#include "nsURLFetcher.h"
@ -67,8 +67,6 @@
#include "nsNetUtil.h"
static NS_DEFINE_CID(kPrefCID, NS_PREF_CID);
///////////////////////////////////////////////////////////////////////////
// Mac Specific Attachment Handling for AppleDouble Encoded Files
///////////////////////////////////////////////////////////////////////////
@ -250,8 +248,7 @@ nsMsgAttachmentHandler::AnalyzeSnarfedFile(void)
int
nsMsgAttachmentHandler::PickEncoding(const char *charset, nsIMsgSend *mime_delivery_state)
{
nsresult rv;
nsCOMPtr<nsIPref> prefs(do_GetService(kPrefCID, &rv));
nsCOMPtr<nsIPrefBranch> pPrefBranch(do_GetService(NS_PREFSERVICE_CONTRACTID));
// use the boolean so we only have to test for uuencode vs base64 once
PRBool needsB64 = PR_FALSE;
@ -264,8 +261,8 @@ nsMsgAttachmentHandler::PickEncoding(const char *charset, nsIMsgSend *mime_deliv
/* Allow users to override our percentage-wise guess on whether
the file is text or binary */
if (NS_SUCCEEDED(rv) && prefs)
prefs->GetBoolPref ("mail.file_attach_binary", &forceB64);
if (pPrefBranch)
pPrefBranch->GetBoolPref ("mail.file_attach_binary", &forceB64);
if (!mMainBody && (forceB64 || mime_type_requires_b64_p (m_type)))
{
@ -1117,10 +1114,9 @@ nsMsgAttachmentHandler::UrlExit(nsresult status, const PRUnichar* aMsg)
// Conversion to plain text desired.
//
PRInt32 width = 72;
nsresult rv;
nsCOMPtr<nsIPref> prefs(do_GetService(kPrefCID, &rv));
if (NS_SUCCEEDED(rv) && prefs)
prefs->GetIntPref("mailnews.wraplength", &width);
nsCOMPtr<nsIPrefBranch> pPrefBranch(do_GetService(NS_PREFSERVICE_CONTRACTID));
if (pPrefBranch)
pPrefBranch->GetIntPref("mailnews.wraplength", &width);
// Let sanity reign!
if (width == 0)
width = 72;

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

@ -171,10 +171,6 @@ nsMsgComposeService::~nsMsgComposeService()
nsresult nsMsgComposeService::Init()
{
nsresult rv = NS_OK;
nsCOMPtr<nsIPrefService> prefService = do_GetService(NS_PREF_CONTRACTID);
if (!prefService)
return NS_ERROR_FAILURE;
// Register observers
// Register for quit application and profile change, we will need to clear the cache.
@ -186,16 +182,11 @@ nsresult nsMsgComposeService::Init()
}
// Register some pref observer
nsCOMPtr<nsIPrefBranch> prefs;
rv = prefService->GetBranch(nsnull, getter_AddRefs(prefs));
if (NS_SUCCEEDED(rv))
{
nsCOMPtr<nsIPrefBranchInternal> pbi = do_QueryInterface(prefs, &rv);
if (NS_SUCCEEDED(rv))
rv = pbi->AddObserver(PREF_MAIL_COMPOSE_MAXRECYCLEDWINDOWS, this, PR_TRUE);
}
nsCOMPtr<nsIPrefBranchInternal> pbi = do_GetService(NS_PREFSERVICE_CONTRACTID);
if (pbi)
rv = pbi->AddObserver(PREF_MAIL_COMPOSE_MAXRECYCLEDWINDOWS, this, PR_TRUE);
Reset();
Reset();
AddGlobalHtmlDomains();
@ -214,15 +205,9 @@ void nsMsgComposeService::Reset()
mMaxRecycledWindows = 0;
}
nsCOMPtr<nsIPrefService> prefService = do_GetService(NS_PREF_CONTRACTID);
if (!prefService)
return;
nsCOMPtr<nsIPrefBranch> prefs;
rv = prefService->GetBranch(nsnull, getter_AddRefs(prefs));
if (NS_FAILED(rv))
return;
rv = prefs->GetIntPref(PREF_MAIL_COMPOSE_MAXRECYCLEDWINDOWS, &mMaxRecycledWindows);
nsCOMPtr<nsIPrefBranch> prefs(do_GetService(NS_PREFSERVICE_CONTRACTID));
if(prefs)
rv = prefs->GetIntPref(PREF_MAIL_COMPOSE_MAXRECYCLEDWINDOWS, &mMaxRecycledWindows);
if (NS_SUCCEEDED(rv) && mMaxRecycledWindows > 0)
{
mCachedWindows = new nsMsgCachedWindowInfo[mMaxRecycledWindows];
@ -388,22 +373,16 @@ nsMsgComposeService::DetermineComposeHTML(nsIMsgIdentity *aIdentity, MSG_Compose
}
else
{
nsresult rv;
// default identity not found. Use the mail.html_compose pref to determine
// message compose type (HTML or PlainText).
nsCOMPtr<nsIPrefService> prefService = do_GetService(NS_PREF_CONTRACTID, &rv);
if (NS_SUCCEEDED(rv))
nsCOMPtr<nsIPrefBranch> prefs(do_GetService(NS_PREFSERVICE_CONTRACTID));
if (prefs)
{
nsCOMPtr<nsIPrefBranch> prefs;
rv = prefService->GetBranch(MAIL_ROOT_PREF, getter_AddRefs(prefs));
nsresult rv;
PRBool useHTMLCompose;
rv = prefs->GetBoolPref(MAIL_ROOT_PREF "html_compose", &useHTMLCompose);
if (NS_SUCCEEDED(rv))
{
PRBool useHTMLCompose;
rv = prefs->GetBoolPref("html_compose", &useHTMLCompose);
if (NS_SUCCEEDED(rv))
*aComposeHTML = useHTMLCompose;
}
*aComposeHTML = useHTMLCompose;
}
}
break;
@ -556,14 +535,9 @@ NS_IMETHODIMP nsMsgComposeService::GetParamsForMailto(nsIURI * aURI, nsIMsgCompo
nsCOMPtr<nsIContentSink> sink = do_CreateInstance(MOZ_SANITIZINGHTMLSERIALIZER_CONTRACTID);
nsXPIDLCString allowedTags;
nsCOMPtr<nsIPrefService> prefService = do_GetService(NS_PREF_CONTRACTID);
if (prefService)
{
nsCOMPtr<nsIPrefBranch> prefs;
rv = prefService->GetBranch(MAILNEWS_ROOT_PREF, getter_AddRefs(prefs));
if (NS_SUCCEEDED(rv))
prefs->GetCharPref("display.html_sanitizer.allowed_tags", getter_Copies(allowedTags));
}
nsCOMPtr<nsIPrefBranch> prefs(do_GetService(NS_PREFSERVICE_CONTRACTID));
if (prefs)
prefs->GetCharPref(MAILNEWS_ROOT_PREF "display.html_sanitizer.allowed_tags", getter_Copies(allowedTags));
if (parser && sink)
{
@ -989,7 +963,7 @@ nsresult nsMsgComposeService::AddGlobalHtmlDomains()
{
nsresult rv;
nsCOMPtr<nsIPref> prefs = do_GetService(NS_PREF_CONTRACTID, &rv);
nsCOMPtr<nsIPrefService> prefs = do_GetService(NS_PREFSERVICE_CONTRACTID, &rv);
NS_ENSURE_SUCCESS(rv,rv);
nsCOMPtr<nsIPrefBranch> prefBranch;

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

@ -49,7 +49,8 @@
#include "nsIMsgMailSession.h"
#include "nsIMsgIdentity.h"
#include "nsEscape.h"
#include "nsIPref.h"
#include "nsIPrefService.h"
#include "nsIPrefBranch.h"
#include "nsIMsgMailNewsUrl.h"
#include "nsMsgDeliveryListener.h"
#include "nsMsgComposeStringBundle.h"
@ -110,7 +111,6 @@
#include "nsRDFCID.h"
#include "nsIMsgAccountManager.h"
static NS_DEFINE_CID(kPrefCID, NS_PREF_CID);
static NS_DEFINE_CID(kRDFServiceCID, NS_RDFSERVICE_CID);
#define PREF_MAIL_SEND_STRUCT "mail.send_struct"
@ -1726,10 +1726,10 @@ nsMsgComposeAndSend::GetBodyFromEditor()
{
PRUint32 whattodo = mozITXTToHTMLConv::kURLs;
PRBool enable_structs = PR_FALSE;
nsCOMPtr<nsIPref> prefs(do_GetService(kPrefCID, &rv));
if (NS_SUCCEEDED(rv) && prefs)
nsCOMPtr<nsIPrefBranch> pPrefBranch(do_GetService(NS_PREFSERVICE_CONTRACTID));
if (pPrefBranch)
{
rv = prefs->GetBoolPref(PREF_MAIL_SEND_STRUCT,&enable_structs);
rv = pPrefBranch->GetBoolPref(PREF_MAIL_SEND_STRUCT, &enable_structs);
if (enable_structs)
whattodo = whattodo | mozITXTToHTMLConv::kStructPhrase;
}
@ -3171,11 +3171,11 @@ nsMsgComposeAndSend::Init(
// Needed for mime encoding!
//
PRBool strictly_mime = PR_TRUE;
nsCOMPtr<nsIPref> prefs(do_GetService(kPrefCID, &rv));
if (NS_SUCCEEDED(rv) && prefs)
nsCOMPtr<nsIPrefBranch> pPrefBranch(do_GetService(NS_PREFSERVICE_CONTRACTID));
if (pPrefBranch)
{
rv = prefs->GetBoolPref(PREF_MAIL_STRICTLY_MIME, &strictly_mime);
rv = prefs->GetIntPref(PREF_MAIL_MESSAGE_WARNING_SIZE, (PRInt32 *) &mMessageWarningSize);
rv = pPrefBranch->GetBoolPref(PREF_MAIL_STRICTLY_MIME, &strictly_mime);
rv = pPrefBranch->GetIntPref(PREF_MAIL_MESSAGE_WARNING_SIZE, (PRInt32 *) &mMessageWarningSize);
}
nsMsgMIMESetConformToStandard(strictly_mime);
@ -3381,11 +3381,9 @@ nsMsgComposeAndSend::DeliverFileAsMail()
nsresult rv;
PRBool collectOutgoingAddresses = PR_TRUE;
nsCOMPtr<nsIPref> prefs(do_GetService(kPrefCID, &rv));
if (NS_SUCCEEDED(rv) && prefs)
{
prefs->GetBoolPref(PREF_MAIL_COLLECT_EMAIL_ADDRESS_OUTGOING,&collectOutgoingAddresses);
}
nsCOMPtr<nsIPrefBranch> pPrefBranch(do_GetService(NS_PREFSERVICE_CONTRACTID));
if (pPrefBranch)
pPrefBranch->GetBoolPref(PREF_MAIL_COLLECT_EMAIL_ADDRESS_OUTGOING, &collectOutgoingAddresses);
nsCOMPtr<nsIAbAddressCollecter> addressCollecter =

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

@ -38,7 +38,8 @@
#include "nsMsgSendLater.h"
#include "nsCOMPtr.h"
#include "nsMsgCopy.h"
#include "nsIPref.h"
#include "nsIPrefService.h"
#include "nsIPrefBranch.h"
#include "nsIEnumerator.h"
#include "nsIFileSpec.h"
#include "nsISmtpService.h"
@ -71,7 +72,6 @@
#include "nsIMimeConverter.h"
#include "nsMsgMimeCID.h"
static NS_DEFINE_CID(kPrefCID, NS_PREF_CID);
static NS_DEFINE_CID(kISupportsArrayCID, NS_SUPPORTSARRAY_CID);
NS_IMPL_ISUPPORTS2(nsMsgSendLater, nsIMsgSendLater, nsIStreamListener)
@ -389,9 +389,9 @@ SendOperationListener::OnStopSending(const char *aMsgID, nsresult aStatus, const
//
// Now delete the message from the outbox folder.
//
nsCOMPtr<nsIPref> prefs(do_GetService(kPrefCID, &rv));
if (NS_SUCCEEDED(rv) && prefs)
prefs->GetBoolPref("mail.really_delete_draft", &deleteMsgs);
nsCOMPtr<nsIPrefBranch> pPrefBranch(do_GetService(NS_PREFSERVICE_CONTRACTID, &rv));
if (pPrefBranch)
pPrefBranch->GetBoolPref("mail.really_delete_draft", &deleteMsgs);
mSendLater->SetOrigMsgDisposition();
if (deleteMsgs)

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

@ -82,13 +82,13 @@ static NS_DEFINE_CID(kCMorkFactory, NS_MORK_CID);
#include "nsICollation.h"
#include "nsCollationCID.h"
#include "nsIPref.h"
#include "nsIPrefService.h"
#include "nsIPrefBranch.h"
#if defined(DEBUG_sspitzer_) || defined(DEBUG_seth_)
#define DEBUG_MSGKEYSET 1
#endif
static NS_DEFINE_CID(kPrefCID, NS_PREF_CID);
static NS_DEFINE_CID(kCollationFactoryCID, NS_COLLATIONFACTORY_CID);
#define MSG_HASH_SIZE 512
@ -3704,10 +3704,10 @@ nsresult nsMsgDatabase::GetBoolPref(const char *prefName, PRBool *result)
{
PRBool prefValue = PR_FALSE;
nsresult rv;
nsCOMPtr<nsIPref> prefs(do_GetService(kPrefCID, &rv));
if (NS_SUCCEEDED(rv) && prefs)
nsCOMPtr<nsIPrefBranch> pPrefBranch(do_GetService(NS_PREFSERVICE_CONTRACTID, &rv));
if (pPrefBranch)
{
rv = prefs->GetBoolPref(prefName, &prefValue);
rv = pPrefBranch->GetBoolPref(prefName, &prefValue);
*result = prefValue;
}
return rv;
@ -3717,10 +3717,10 @@ nsresult nsMsgDatabase::GetIntPref(const char *prefName, PRInt32 *result)
{
PRInt32 prefValue = 0;
nsresult rv;
nsCOMPtr<nsIPref> prefs(do_GetService(kPrefCID, &rv));
if (NS_SUCCEEDED(rv) && prefs)
nsCOMPtr<nsIPrefBranch> pPrefBranch(do_GetService(NS_PREFSERVICE_CONTRACTID, &rv));
if (pPrefBranch)
{
rv = prefs->GetIntPref(prefName, &prefValue);
rv = pPrefBranch->GetIntPref(prefName, &prefValue);
*result = prefValue;
}
return rv;

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

@ -60,7 +60,7 @@
#include "nsMsgCompCID.h"
#include "nsIPrompt.h"
#include "nsIMsgCompUtils.h"
#include "nsIPref.h"
#include "nsIPrefService.h"
#include "nsIPrefBranchInternal.h"
#include "nsIPrefBranch.h"
#include "nsIStringBundle.h"
@ -923,27 +923,24 @@ nsresult nsMsgMdnGenerator::InitAndProcess()
}
else
{
nsCOMPtr<nsIPref> prefs =
do_GetService(NS_PREF_CONTRACTID, &rv);
if (NS_FAILED(rv))
return rv;
PRBool bVal = PR_FALSE;
nsCOMPtr<nsIPrefBranch> prefBranch;
rv = prefs->GetBranch(nsnull, getter_AddRefs(prefBranch));
nsCOMPtr<nsIPrefBranch> prefBranch(do_GetService(NS_PREFSERVICE_CONTRACTID, &rv));
if (NS_FAILED(rv))
return rv;
PRBool bVal = PR_FALSE;
prefBranch->GetBoolPref("mail.mdn.report.enabled",
&bVal);
m_mdnEnabled = bVal;
prefBranch->GetIntPref("mail.mdn.report.not_in_to_cc",
&m_notInToCcOp);
prefBranch->GetIntPref("mail.mdn.report.outside_domain",
&m_outsideDomainOp);
prefBranch->GetIntPref("mail.mdn.report.other",
&m_otherOp);
if(prefBranch)
{
prefBranch->GetBoolPref("mail.mdn.report.enabled",
&bVal);
m_mdnEnabled = bVal;
prefBranch->GetIntPref("mail.mdn.report.not_in_to_cc",
&m_notInToCcOp);
prefBranch->GetIntPref("mail.mdn.report.outside_domain",
&m_outsideDomainOp);
prefBranch->GetIntPref("mail.mdn.report.other",
&m_otherOp);
}
}
}
}

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

@ -42,7 +42,8 @@
*
* ***** END LICENSE BLOCK ***** */
#include "nsIPref.h"
#include "nsIPrefService.h"
#include "nsIPrefBranch.h"
#include "prlog.h"
#include "msgCore.h" // precompiled header...
@ -1219,9 +1220,9 @@ nsresult nsMsgLocalMailFolder::ConfirmFolderDeletion(nsIMsgWindow *aMsgWindow, P
{
PRBool confirmDeletion = PR_TRUE;
nsresult rv;
nsCOMPtr<nsIPref> prefs(do_GetService(NS_PREF_CONTRACTID, &rv));
if (NS_SUCCEEDED(rv))
prefs->GetBoolPref("mailnews.confirm.moveFoldersToTrash", &confirmDeletion);
nsCOMPtr<nsIPrefBranch> pPrefBranch(do_GetService(NS_PREFSERVICE_CONTRACTID, &rv));
if (pPrefBranch)
pPrefBranch->GetBoolPref("mailnews.confirm.moveFoldersToTrash", &confirmDeletion);
if (confirmDeletion)
{
if (!mMsgStringService)

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

@ -64,8 +64,6 @@
#include "nsAppDirectoryServiceDefs.h"
#include "nsMsgUtils.h"
#include "nsIPref.h"
#include "nsMsgLocalCID.h"
#include "nsMsgBaseCID.h"
#include "nsXPIDLString.h"
@ -83,8 +81,6 @@ const char * gDefaultSpoolPaths[] = {
};
#define NUM_DEFAULT_SPOOL_PATHS (sizeof(gDefaultSpoolPaths)/sizeof(gDefaultSpoolPaths[0]))
static NS_DEFINE_CID(kPrefCID, NS_PREF_CID);
nsMovemailService::nsMovemailService()
{
#ifdef MOVEMAIL_DEBUG

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

@ -42,7 +42,6 @@
#include "prprf.h"
#include "nsIFileSpec.h"
#include "nsIPref.h"
#include "nsXPIDLString.h"
#include "nsNoIncomingServer.h"

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

@ -44,8 +44,6 @@
#include "nsIMsgProtocolInfo.h"
#include "nsIMsgMailSession.h"
#include "nsIPref.h"
#include "nsMsgLocalCID.h"
#include "nsMsgBaseCID.h"
#include "nsXPIDLString.h"
@ -59,8 +57,6 @@
#define PREF_MAIL_ROOT_NONE "mail.root.none" // old - for backward compatibility only
#define PREF_MAIL_ROOT_NONE_REL "mail.root.none-rel"
static NS_DEFINE_CID(kPrefCID, NS_PREF_CID);
nsNoneService::nsNoneService()
{
}

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

@ -62,7 +62,6 @@
#include "nsIIOService.h"
#include "nsNetCID.h"
#include "nsRDFCID.h"
#include "nsIPref.h"
#include "nsIRDFService.h"
#include "nsMsgI18N.h"
#include "nsAppDirectoryServiceDefs.h"

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

@ -40,7 +40,6 @@
#include "prprf.h"
#include "nsCOMPtr.h"
#include "nsIPref.h"
#include "nsXPIDLString.h"
#include "nsIStringBundle.h"

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

@ -53,7 +53,6 @@
#include "nsLocalStringBundle.h"
#include "nsTextFormatter.h"
#include "nsCOMPtr.h"
#include "nsIPref.h"
#include "nsIMsgWindow.h"
#include "nsIMsgFolder.h" // TO include biffState enum. Change to bool later...
#include "nsIDocShell.h"

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

@ -43,8 +43,6 @@
#include "nsIPop3IncomingServer.h"
#include "nsIMsgMailSession.h"
#include "nsIPref.h"
#include "nsPop3URL.h"
#include "nsPop3Sink.h"
#include "nsPop3Protocol.h"
@ -69,7 +67,6 @@
#define PREF_MAIL_ROOT_POP3 "mail.root.pop3" // old - for backward compatibility only
#define PREF_MAIL_ROOT_POP3_REL "mail.root.pop3-rel"
static NS_DEFINE_CID(kPrefCID, NS_PREF_CID);
static NS_DEFINE_CID(kPop3UrlCID, NS_POP3URL_CID);
static NS_DEFINE_CID(kRDFServiceCID, NS_RDFSERVICE_CID);

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

@ -50,7 +50,6 @@
#include "nsDirectoryService.h"
#include "nsDirectoryServiceDefs.h"
#include "nsAppDirectoryServiceDefs.h"
#include "nsIPref.h"
#define EXE_EXTENSION ".exe"
#define MOZ_HWND_BROADCAST_MSG_TIMEOUT 5000

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

@ -56,7 +56,6 @@
#include "nsReadableUtils.h"
#include "nsIStringBundle.h"
#include "nsIPref.h"
#include "nsVCardStringResources.h"
#include "nsCRT.h"

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

@ -40,7 +40,6 @@
#include "nsMailHeaders.h"
#include "nsIMimeEmitter.h"
#include "nsIStringBundle.h"
#include "nsIPref.h"
#include "nsIServiceManager.h"
#include "nsIIOService.h"
#include "nsIURI.h"

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

@ -44,7 +44,8 @@
#include "nsMimeBaseEmitter.h"
#include "nsMailHeaders.h"
#include "nscore.h"
#include "nsIPref.h"
#include "nsIPrefService.h"
#include "nsIPrefBranch.h"
#include "nsIServiceManager.h"
#include "nsEscape.h"
#include "prmem.h"
@ -125,9 +126,9 @@ nsMimeBaseEmitter::nsMimeBaseEmitter()
gMimeEmitterLogModule = PR_NewLogModule("MIME");
// Do prefs last since we can live without this if it fails...
mPrefs = do_GetService(NS_PREF_CONTRACTID);
if (mPrefs)
mPrefs->GetIntPref("mail.show_headers", &mHeaderDisplayType);
nsCOMPtr<nsIPrefBranch> pPrefBranch(do_GetService(NS_PREFSERVICE_CONTRACTID));
if (pPrefBranch)
pPrefBranch->GetIntPref("mail.show_headers", &mHeaderDisplayType);
}
nsMimeBaseEmitter::~nsMimeBaseEmitter(void)

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

@ -46,7 +46,6 @@
#include "nsIOutputStream.h"
#include "nsIAsyncInputStream.h"
#include "nsIURI.h"
#include "nsIPref.h"
#include "nsIChannel.h"
#include "nsString.h"
#include "nsFileSpec.h"
@ -147,7 +146,6 @@ protected:
PRUint32 mTotalRead;
// Output control and info...
nsCOMPtr<nsIPref> mPrefs; // Connnection to prefs service manager
PRBool mDocHeader; // For header determination...
nsIURI *mURL; // the url for the data being processed...
PRInt32 mHeaderDisplayType; // The setting for header output...

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

@ -43,6 +43,8 @@
#include "nsMailHeaders.h"
#include "nscore.h"
#include "nsEmitterUtils.h"
#include "nsIPrefService.h"
#include "nsIPrefBranch.h"
#include "nsEscape.h"
#include "nsIMimeStreamConverter.h"
#include "nsIMsgWindow.h"
@ -185,9 +187,9 @@ NS_IMETHODIMP nsMimeHtmlDisplayEmitter::WriteHTMLHeaders()
nsresult rv = GetHeaderSink(getter_AddRefs(headerSink));
PRInt32 viewMode = 0;
nsCOMPtr <nsIPref> prefs = do_GetService(NS_PREF_CONTRACTID, &rv);
if (prefs)
rv = prefs->GetIntPref("mail.show_headers", &viewMode);
nsCOMPtr<nsIPrefBranch> pPrefBranch(do_GetService(NS_PREFSERVICE_CONTRACTID, &rv));
if (pPrefBranch)
rv = pPrefBranch->GetIntPref("mail.show_headers", &viewMode);
if (headerSink)
{
@ -211,8 +213,8 @@ NS_IMETHODIMP nsMimeHtmlDisplayEmitter::WriteHTMLHeaders()
if (nsCRT::strcasecmp("Date", headerInfo->name) == 0)
{
PRBool displayOriginalDate = PR_FALSE;
if (prefs)
prefs->GetBoolPref("mailnews.display.original_date", &displayOriginalDate);
if (pPrefBranch)
pPrefBranch->GetBoolPref("mailnews.display.original_date", &displayOriginalDate);
if (displayOriginalDate)
headerValues[numHeadersAdded] = ToNewUnicode(nsDependentCString(headerValue));

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

@ -44,7 +44,6 @@
#include "mimemoz2.h"
#include "nsIMimeEmitter.h"
#include "nsCRT.h"
#include "nsIPref.h"
#include "nsEscape.h"
#include "nsMsgMessageFlags.h"
#include "nsMimeAddress.h"

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

@ -58,7 +58,8 @@
#include "nsMemory.h"
#include "nsIPipe.h"
#include "nsMimeStringResources.h"
#include "nsIPref.h"
#include "nsIPrefService.h"
#include "nsIPrefBranch.h"
#include "nsNetUtil.h"
#include "nsIMsgQuote.h"
#include "nsIScriptSecurityManager.h"
@ -76,8 +77,6 @@
#define PREF_MAIL_DISPLAY_GLYPH "mail.display_glyph"
#define PREF_MAIL_DISPLAY_STRUCT "mail.display_struct"
static NS_DEFINE_CID(kPrefCID, NS_PREF_CID);
////////////////////////////////////////////////////////////////
// Bridge routines for new stream converter XP-COM interface
////////////////////////////////////////////////////////////////
@ -221,11 +220,11 @@ bridge_new_new_uri(void *bridgeStream, nsIURI *aURI, PRInt32 aOutputType)
// if the pref says always override and no manual override then set the folder charset to override
if (!*override_charset) {
nsCOMPtr <nsIPref> prefs = do_GetService(kPrefCID, &rv);
if (NS_SUCCEEDED(rv) && prefs)
nsCOMPtr<nsIPrefBranch> pPrefBranch(do_GetService(NS_PREFSERVICE_CONTRACTID, &rv));
if (pPrefBranch)
{
PRBool force_override;
rv = prefs->GetBoolPref("mailnews.force_charset_override", &force_override);
rv = pPrefBranch->GetBoolPref("mailnews.force_charset_override", &force_override);
if (NS_SUCCEEDED(rv) && force_override)
{
*override_charset = PR_TRUE;
@ -715,15 +714,15 @@ NS_IMETHODIMP nsStreamConverter::Init(nsIURI *aURI, nsIStreamListener * aOutList
PRBool enable_emoticons = PR_TRUE;
PRBool enable_structs = PR_TRUE;
nsCOMPtr<nsIPref> prefs(do_GetService(kPrefCID, &rv));
if (NS_SUCCEEDED(rv) && prefs)
nsCOMPtr<nsIPrefBranch> pPrefBranch(do_GetService(NS_PREFSERVICE_CONTRACTID, &rv));
if (pPrefBranch)
{
rv = prefs->GetBoolPref(PREF_MAIL_DISPLAY_GLYPH,&enable_emoticons);
rv = pPrefBranch->GetBoolPref(PREF_MAIL_DISPLAY_GLYPH,&enable_emoticons);
if (NS_FAILED(rv) || enable_emoticons)
{
whattodo = whattodo | mozITXTToHTMLConv::kGlyphSubstitution;
}
rv = prefs->GetBoolPref(PREF_MAIL_DISPLAY_STRUCT,&enable_structs);
rv = pPrefBranch->GetBoolPref(PREF_MAIL_DISPLAY_STRUCT,&enable_structs);
if (NS_FAILED(rv) || enable_structs)
{
whattodo = whattodo | mozITXTToHTMLConv::kStructPhrase;