From bb520f27f8ca410edb79c2bed620551420de37b0 Mon Sep 17 00:00:00 2001 From: "bugzilla%standard8.demon.co.uk" Date: Wed, 4 Apr 2007 08:01:38 +0000 Subject: [PATCH] Part of Bug 131040 reduce duplicated import code - Remove nsTextStringBundle.h/.cpp. r=Neil,sr=bienvenu git-svn-id: svn://10.0.0.236/trunk@224136 18797224-902f-48f8-a5cc-f745e15eee43 --- .../mailnews/import/build/nsImportModule.cpp | 3 - .../import/src/nsImportAddressBooks.cpp | 9 +- .../mailnews/import/src/nsImportFieldMap.cpp | 2 +- mozilla/mailnews/import/src/nsImportMail.cpp | 14 +- .../import/src/nsImportStringBundle.cpp | 21 +- .../import/src/nsImportStringBundle.h | 13 +- mozilla/mailnews/import/text/src/Makefile.in | 1 - .../mailnews/import/text/src/nsTextImport.cpp | 179 ++++++++++-------- .../mailnews/import/text/src/nsTextImport.h | 9 +- 9 files changed, 146 insertions(+), 105 deletions(-) diff --git a/mozilla/mailnews/import/build/nsImportModule.cpp b/mozilla/mailnews/import/build/nsImportModule.cpp index ceabb2df5c4..9035431178b 100644 --- a/mozilla/mailnews/import/build/nsImportModule.cpp +++ b/mozilla/mailnews/import/build/nsImportModule.cpp @@ -55,7 +55,6 @@ // text import Include Files //////////////////////////////////////////////////////////////////////////////// #include "nsTextImport.h" -#include "nsTextStringBundle.h" static NS_DEFINE_CID(kTextImportCID, NS_TEXTIMPORT_CID); @@ -273,8 +272,6 @@ static const nsModuleComponentInfo components[] = { PR_STATIC_CALLBACK(void) importModuleDtor(nsIModule* self) { - nsTextStringBundle::Cleanup(); - #if defined(XP_WIN) || defined(XP_MACOSX) nsEudoraStringBundle::Cleanup(); #endif diff --git a/mozilla/mailnews/import/src/nsImportAddressBooks.cpp b/mozilla/mailnews/import/src/nsImportAddressBooks.cpp index aa3cb9374db..09c57c936cb 100644 --- a/mozilla/mailnews/import/src/nsImportAddressBooks.cpp +++ b/mozilla/mailnews/import/src/nsImportAddressBooks.cpp @@ -562,13 +562,15 @@ NS_IMETHODIMP nsImportGenericAddressBooks::BeginImport(nsISupportsString *succes if (!m_doImport) { *_retval = PR_TRUE; - nsImportStringBundle::GetStringByID(IMPORT_NO_ADDRBOOKS, success, m_stringBundle); + nsImportStringBundle::GetStringByID(IMPORT_NO_ADDRBOOKS, m_stringBundle, + success); SetLogs( success, error, successLog, errorLog); return( NS_OK); } if (!m_pInterface || !m_pBooks) { - nsImportStringBundle::GetStringByID(IMPORT_ERROR_AB_NOTINITIALIZED, error, m_stringBundle); + nsImportStringBundle::GetStringByID(IMPORT_ERROR_AB_NOTINITIALIZED, + m_stringBundle, error); SetLogs( success, error, successLog, errorLog); *_retval = PR_FALSE; return( NS_OK); @@ -615,7 +617,8 @@ NS_IMETHODIMP nsImportGenericAddressBooks::BeginImport(nsISupportsString *succes m_pThreadData->DriverDelete(); m_pThreadData = nsnull; *_retval = PR_FALSE; - nsImportStringBundle::GetStringByID(IMPORT_ERROR_AB_NOTHREAD, error, m_stringBundle); + nsImportStringBundle::GetStringByID(IMPORT_ERROR_AB_NOTHREAD, + m_stringBundle, error); SetLogs( success, error, successLog, errorLog); } else diff --git a/mozilla/mailnews/import/src/nsImportFieldMap.cpp b/mozilla/mailnews/import/src/nsImportFieldMap.cpp index 5c31db60fcd..025e85084de 100644 --- a/mozilla/mailnews/import/src/nsImportFieldMap.cpp +++ b/mozilla/mailnews/import/src/nsImportFieldMap.cpp @@ -87,7 +87,7 @@ nsImportFieldMap::nsImportFieldMap(nsIStringBundle *aBundle) for (PRInt32 i = IMPORT_FIELD_DESC_START; i <= IMPORT_FIELD_DESC_END; i++, m_mozFieldCount++) { pStr = new nsString(); if (pBundle) { - nsImportStringBundle::GetStringByID( i, *pStr, pBundle); + nsImportStringBundle::GetStringByID(i, pBundle, *pStr); } else pStr->AppendInt( i); diff --git a/mozilla/mailnews/import/src/nsImportMail.cpp b/mozilla/mailnews/import/src/nsImportMail.cpp index 9b6654185ec..a7861edd7a3 100644 --- a/mozilla/mailnews/import/src/nsImportMail.cpp +++ b/mozilla/mailnews/import/src/nsImportMail.cpp @@ -502,7 +502,7 @@ NS_IMETHODIMP nsImportGenericMail::BeginImport(nsISupportsString *successLog, ns if (!m_doImport) { nsImportStringBundle::GetStringByID(IMPORT_NO_MAILBOXES, - success, m_stringBundle); + m_stringBundle, success); SetLogs( success, error, successLog, errorLog); *_retval = PR_TRUE; return( NS_OK); @@ -511,7 +511,7 @@ NS_IMETHODIMP nsImportGenericMail::BeginImport(nsISupportsString *successLog, ns if (!m_pInterface || !m_pMailboxes) { IMPORT_LOG0( "*** BeginImport: Either the interface or source mailbox is not set properly."); nsImportStringBundle::GetStringByID(IMPORT_ERROR_MB_NOTINITIALIZED, - error, m_stringBundle); + m_stringBundle, error); SetLogs( success, error, successLog, errorLog); *_retval = PR_FALSE; return( NS_OK); @@ -520,7 +520,7 @@ NS_IMETHODIMP nsImportGenericMail::BeginImport(nsISupportsString *successLog, ns if (!m_pDestFolder) { IMPORT_LOG0( "*** BeginImport: The destination mailbox is not set properly."); nsImportStringBundle::GetStringByID(IMPORT_ERROR_MB_NODESTFOLDER, - error, m_stringBundle); + m_stringBundle, error); SetLogs( success, error, successLog, errorLog); *_retval = PR_FALSE; return( NS_OK); @@ -570,7 +570,7 @@ NS_IMETHODIMP nsImportGenericMail::BeginImport(nsISupportsString *successLog, ns m_pThreadData = nsnull; *_retval = PR_FALSE; nsImportStringBundle::GetStringByID(IMPORT_ERROR_MB_NOTHREAD, - error, m_stringBundle); + m_stringBundle, error); SetLogs( success, error, successLog, errorLog); } else @@ -833,7 +833,8 @@ ImportMailThread( void *stuff) getter_AddRefs( curProxy)); if (NS_FAILED( rv)) { IMPORT_LOG1("*** ImportMailThread: Failed to get the proxy interface for child folder '%s'.", NS_ConvertUTF16toUTF8(lastName).get()); - nsImportStringBundle::GetStringByID( IMPORT_ERROR_MB_NOPROXY, error, pBundle); + nsImportStringBundle::GetStringByID(IMPORT_ERROR_MB_NOPROXY, pBundle, + error); pData->fatalError = PR_TRUE; break; } @@ -862,7 +863,8 @@ ImportMailThread( void *stuff) } if (NS_FAILED( rv)) { IMPORT_LOG1("*** ImportMailThread: Failed to get the proxy interface for parent folder '%s'.", lastName.get()); - nsImportStringBundle::GetStringByID( IMPORT_ERROR_MB_NOPROXY, error, pBundle); + nsImportStringBundle::GetStringByID(IMPORT_ERROR_MB_NOPROXY, pBundle, + error); pData->fatalError = PR_TRUE; break; } diff --git a/mozilla/mailnews/import/src/nsImportStringBundle.cpp b/mozilla/mailnews/import/src/nsImportStringBundle.cpp index d09abed1f83..548b5a9bda3 100644 --- a/mozilla/mailnews/import/src/nsImportStringBundle.cpp +++ b/mozilla/mailnews/import/src/nsImportStringBundle.cpp @@ -44,7 +44,8 @@ #include "nsIProxyObjectManager.h" #include "nsIURI.h" -nsresult nsImportStringBundle::GetStringBundle(const char* aPropertyURL, nsIStringBundle** aBundle) +nsresult nsImportStringBundle::GetStringBundle(const char *aPropertyURL, + nsIStringBundle **aBundle) { nsresult rv; @@ -57,7 +58,8 @@ nsresult nsImportStringBundle::GetStringBundle(const char* aPropertyURL, nsIStri return rv; } -nsresult nsImportStringBundle::GetStringBundleProxy(nsIStringBundle* aOriginalBundle, nsIStringBundle **aProxy) +nsresult nsImportStringBundle::GetStringBundleProxy(nsIStringBundle *aOriginalBundle, + nsIStringBundle **aProxy) { // create a proxy object if we aren't on the same thread? return NS_GetProxyForObject( NS_PROXY_TO_MAIN_THREAD, @@ -67,24 +69,27 @@ nsresult nsImportStringBundle::GetStringBundleProxy(nsIStringBundle* aOriginalBu (void **) aProxy); } -void nsImportStringBundle::GetStringByID(PRInt32 stringID, nsString& result, nsIStringBundle *aBundle) +void nsImportStringBundle::GetStringByID(PRInt32 aStringID, + nsIStringBundle *aBundle, + nsString &aResult) { - result.Adopt(GetStringByID(stringID, aBundle)); + aResult.Adopt(GetStringByID(aStringID, aBundle)); } -PRUnichar *nsImportStringBundle::GetStringByID(PRInt32 stringID, nsIStringBundle *aBundle) +PRUnichar *nsImportStringBundle::GetStringByID(PRInt32 aStringID, + nsIStringBundle *aBundle) { if (aBundle) { PRUnichar *ptrv = nsnull; - nsresult rv = aBundle->GetStringFromID(stringID, &ptrv); - + nsresult rv = aBundle->GetStringFromID(aStringID, &ptrv); + if (NS_SUCCEEDED(rv) && ptrv) return(ptrv); } nsString resultString(NS_LITERAL_STRING("[StringID ")); - resultString.AppendInt(stringID); + resultString.AppendInt(aStringID); resultString.AppendLiteral("?]"); return ToNewUnicode(resultString); diff --git a/mozilla/mailnews/import/src/nsImportStringBundle.h b/mozilla/mailnews/import/src/nsImportStringBundle.h index bf9a400e884..1da9100ce6d 100644 --- a/mozilla/mailnews/import/src/nsImportStringBundle.h +++ b/mozilla/mailnews/import/src/nsImportStringBundle.h @@ -45,10 +45,15 @@ class nsIStringBundle; class nsImportStringBundle { public: - static PRUnichar* GetStringByID(PRInt32 stringID, nsIStringBundle *pBundle = nsnull); - static void GetStringByID(PRInt32 stringID, nsString& result, nsIStringBundle *pBundle); - static nsresult GetStringBundle(const char* pPropertyURL, nsIStringBundle** aBundle); - static nsresult GetStringBundleProxy(nsIStringBundle* aOriginalBundle, nsIStringBundle **aProxy); + static PRUnichar* GetStringByID(PRInt32 aStringID, + nsIStringBundle *aBundle = nsnull); + static void GetStringByID(PRInt32 aStringID, + nsIStringBundle *aBundle, + nsString &aResult); + static nsresult GetStringBundle(const char *aPropertyURL, + nsIStringBundle **aBundle); + static nsresult GetStringBundleProxy(nsIStringBundle *aOriginalBundle, + nsIStringBundle **aProxy); }; #define IMPORT_MSGS_URL "chrome://messenger/locale/importMsgs.properties" diff --git a/mozilla/mailnews/import/text/src/Makefile.in b/mozilla/mailnews/import/text/src/Makefile.in index c4ee2483bcf..b9084eb1fe4 100644 --- a/mozilla/mailnews/import/text/src/Makefile.in +++ b/mozilla/mailnews/import/text/src/Makefile.in @@ -64,7 +64,6 @@ REQUIRES = xpcom \ $(NULL) CPPSRCS = \ - nsTextStringBundle.cpp \ nsTextImport.cpp \ nsTextAddress.cpp \ $(NULL) diff --git a/mozilla/mailnews/import/text/src/nsTextImport.cpp b/mozilla/mailnews/import/text/src/nsTextImport.cpp index 398dd6e297a..37980ad5765 100644 --- a/mozilla/mailnews/import/text/src/nsTextImport.cpp +++ b/mozilla/mailnews/import/text/src/nsTextImport.cpp @@ -68,8 +68,7 @@ #include "nsIAbLDIFService.h" #include "nsAbBaseCID.h" #include "nsTextFormatter.h" -#include "nsTextStringBundle.h" -#include "nsIStringBundle.h" +#include "nsImportStringBundle.h" #include "nsTextAddress.h" #include "nsIPrefService.h" #include "nsIPrefBranch.h" @@ -79,15 +78,25 @@ #include "nsIFileSpec.h" #include "nsNetUtil.h" +#define TEXT_MSGS_URL "chrome://messenger/locale/textImportMsgs.properties" +#define TEXTIMPORT_NAME 2000 +#define TEXTIMPORT_DESCRIPTION 2001 +#define TEXTIMPORT_ADDRESS_NAME 2002 +#define TEXTIMPORT_ADDRESS_SUCCESS 2003 +#define TEXTIMPORT_ADDRESS_BADPARAM 2004 +#define TEXTIMPORT_ADDRESS_BADSOURCEFILE 2005 +#define TEXTIMPORT_ADDRESS_CONVERTERROR 2006 + static NS_DEFINE_IID(kISupportsIID, NS_ISUPPORTS_IID); PRLogModuleInfo* TEXTIMPORTLOGMODULE; class ImportAddressImpl : public nsIImportAddressBooks { public: - ImportAddressImpl(); + ImportAddressImpl(nsIStringBundle* aStringBundle); - static nsresult Create(nsIImportAddressBooks** aImport); + static nsresult Create(nsIImportAddressBooks** aImport, + nsIStringBundle *aStringBundle); // nsISupports interface NS_DECL_ISUPPORTS @@ -132,15 +141,19 @@ private: void ClearSampleFile( void); void SaveFieldMap( nsIImportFieldMap *pMap); - static void ReportSuccess( nsString& name, nsString *pStream); - static void SetLogs( nsString& success, nsString& error, PRUnichar **pError, PRUnichar **pSuccess); - static void ReportError( PRInt32 errorNum, nsString& name, nsString *pStream); - static void SanitizeSampleData( nsCString& val); + static void ReportSuccess(nsString& name, nsString *pStream, + nsIStringBundle* pBundle); + static void SetLogs(nsString& success, nsString& error, PRUnichar **pError, + PRUnichar **pSuccess); + static void ReportError(PRInt32 errorNum, nsString& name, nsString *pStream, + nsIStringBundle* pBundle); + static void SanitizeSampleData(nsCString& val); private: nsTextAddress m_text; PRBool m_haveDelim; nsCOMPtr m_fileLoc; + nsCOMPtr m_notProxyBundle; char m_delim; PRUint32 m_bytesImported; }; @@ -157,10 +170,10 @@ nsTextImport::nsTextImport() TEXTIMPORTLOGMODULE = PR_NewLogModule("IMPORT"); IMPORT_LOG0( "nsTextImport Module Created\n"); - nsTextStringBundle::GetStringBundle(); + nsImportStringBundle::GetStringBundle(TEXT_MSGS_URL, + getter_AddRefs(m_stringBundle)); } - nsTextImport::~nsTextImport() { @@ -175,24 +188,21 @@ NS_IMPL_ISUPPORTS1(nsTextImport, nsIImportModule) NS_IMETHODIMP nsTextImport::GetName( PRUnichar **name) { - NS_PRECONDITION(name != nsnull, "null ptr"); - if (! name) - return NS_ERROR_NULL_POINTER; + NS_ENSURE_ARG_POINTER(name); - *name = nsTextStringBundle::GetStringByID( TEXTIMPORT_NAME); - - return NS_OK; + *name = nsImportStringBundle::GetStringByID(TEXTIMPORT_NAME, m_stringBundle); + + return NS_OK; } NS_IMETHODIMP nsTextImport::GetDescription( PRUnichar **name) { - NS_PRECONDITION(name != nsnull, "null ptr"); - if (! name) - return NS_ERROR_NULL_POINTER; + NS_ENSURE_ARG_POINTER(name); - *name = nsTextStringBundle::GetStringByID( TEXTIMPORT_DESCRIPTION); - - return NS_OK; + *name = nsImportStringBundle::GetStringByID(TEXTIMPORT_DESCRIPTION, + m_stringBundle); + + return NS_OK; } NS_IMETHODIMP nsTextImport::GetSupports( char **supports) @@ -232,7 +242,7 @@ NS_IMETHODIMP nsTextImport::GetImportInterface( const char *pImportType, nsISupp // create the nsIImportMail interface and return it! nsIImportAddressBooks * pAddress = nsnull; nsIImportGeneric * pGeneric = nsnull; - rv = ImportAddressImpl::Create( &pAddress); + rv = ImportAddressImpl::Create(&pAddress, m_stringBundle); if (NS_SUCCEEDED( rv)) { nsCOMPtr impSvc(do_GetService(NS_IMPORTSERVICE_CONTRACTID, &rv)); if (NS_SUCCEEDED( rv)) { @@ -255,13 +265,14 @@ NS_IMETHODIMP nsTextImport::GetImportInterface( const char *pImportType, nsISupp -nsresult ImportAddressImpl::Create(nsIImportAddressBooks** aImport) +nsresult ImportAddressImpl::Create(nsIImportAddressBooks** aImport, + nsIStringBundle* aStringBundle) { NS_PRECONDITION(aImport != nsnull, "null ptr"); if (! aImport) return NS_ERROR_NULL_POINTER; - *aImport = new ImportAddressImpl(); + *aImport = new ImportAddressImpl(aStringBundle); if (! *aImport) return NS_ERROR_OUT_OF_MEMORY; @@ -270,7 +281,8 @@ nsresult ImportAddressImpl::Create(nsIImportAddressBooks** aImport) return NS_OK; } -ImportAddressImpl::ImportAddressImpl() +ImportAddressImpl::ImportAddressImpl(nsIStringBundle* aStringBundle) : + m_notProxyBundle(aStringBundle) { m_haveDelim = PR_FALSE; } @@ -287,7 +299,18 @@ NS_IMETHODIMP ImportAddressImpl::GetAutoFind(PRUnichar **addrDescription, PRBool nsString str; *_retval = PR_FALSE; - nsTextStringBundle::GetStringByID( TEXTIMPORT_ADDRESS_NAME, str); + + if (!m_notProxyBundle) + return NS_ERROR_FAILURE; + + nsCOMPtr proxy; + nsresult rv = + nsImportStringBundle::GetStringBundleProxy(m_notProxyBundle, + getter_AddRefs(proxy)); + NS_ENSURE_SUCCESS(rv, rv); + + nsImportStringBundle::GetStringByID(TEXTIMPORT_ADDRESS_NAME, proxy, str); + *addrDescription = ToNewUnicode(str); return( NS_OK); @@ -411,36 +434,36 @@ NS_IMETHODIMP ImportAddressImpl::FindAddressBooks(nsIFileSpec *pLoc, nsISupports return( rv); } - - -void ImportAddressImpl::ReportSuccess( nsString& name, nsString *pStream) +void ImportAddressImpl::ReportSuccess(nsString& name, nsString *pStream, + nsIStringBundle* pBundle) { - if (!pStream) - return; - // load the success string - nsIStringBundle *pBundle = nsTextStringBundle::GetStringBundleProxy(); - PRUnichar *pFmt = nsTextStringBundle::GetStringByID( TEXTIMPORT_ADDRESS_SUCCESS, pBundle); - PRUnichar *pText = nsTextFormatter::smprintf( pFmt, name.get()); - pStream->Append( pText); - nsTextFormatter::smprintf_free( pText); - nsTextStringBundle::FreeString( pFmt); - pStream->Append( PRUnichar(nsCRT::LF)); - NS_IF_RELEASE( pBundle); + if (!pStream) + return; + + // load the success string + PRUnichar *pFmt = + nsImportStringBundle::GetStringByID(TEXTIMPORT_ADDRESS_SUCCESS, pBundle); + + PRUnichar *pText = nsTextFormatter::smprintf(pFmt, name.get()); + pStream->Append(pText); + nsTextFormatter::smprintf_free(pText); + NS_Free(pFmt); + pStream->Append(PRUnichar(nsCRT::LF)); } -void ImportAddressImpl::ReportError( PRInt32 errorNum, nsString& name, nsString *pStream) +void ImportAddressImpl::ReportError(PRInt32 errorNum, nsString& name, + nsString *pStream, nsIStringBundle* pBundle) { - if (!pStream) - return; - // load the error string - nsIStringBundle *pBundle = nsTextStringBundle::GetStringBundleProxy(); - PRUnichar *pFmt = nsTextStringBundle::GetStringByID( errorNum, pBundle); - PRUnichar *pText = nsTextFormatter::smprintf( pFmt, name.get()); - pStream->Append( pText); - nsTextFormatter::smprintf_free( pText); - nsTextStringBundle::FreeString( pFmt); - pStream->Append( PRUnichar(nsCRT::LF)); - NS_IF_RELEASE( pBundle); + if (!pStream) + return; + + // load the error string + PRUnichar *pFmt = nsImportStringBundle::GetStringByID(errorNum, pBundle); + PRUnichar *pText = nsTextFormatter::smprintf(pFmt, name.get()); + pStream->Append(pText); + nsTextFormatter::smprintf_free(pText); + NS_Free(pFmt); + pStream->Append(PRUnichar(nsCRT::LF)); } void ImportAddressImpl::SetLogs( nsString& success, nsString& error, PRUnichar **pError, PRUnichar **pSuccess) @@ -463,19 +486,28 @@ NS_IMETHODIMP ImportAddressImpl::ImportAddressBook( nsIImportABDescriptor *pSour NS_PRECONDITION(pSource != nsnull, "null ptr"); NS_PRECONDITION(pDestination != nsnull, "null ptr"); NS_PRECONDITION(fatalError != nsnull, "null ptr"); + + nsCOMPtr pBundle; + nsresult rv = + nsImportStringBundle::GetStringBundleProxy(m_notProxyBundle, + getter_AddRefs(pBundle)); + NS_ENSURE_SUCCESS(rv, rv); - nsCOMPtr bundle( dont_AddRef( nsTextStringBundle::GetStringBundleProxy())); m_bytesImported = 0; - nsString success; - nsString error; - if (!pSource || !pDestination || !fatalError) { - IMPORT_LOG0( "*** Bad param passed to text address import\n"); - nsTextStringBundle::GetStringByID( TEXTIMPORT_ADDRESS_BADPARAM, error, bundle); - if (fatalError) - *fatalError = PR_TRUE; - SetLogs( success, error, pErrorLog, pSuccessLog); - return( NS_ERROR_NULL_POINTER); + nsString success, error; + if (!pSource || !pDestination || !fatalError) { + IMPORT_LOG0( "*** Bad param passed to text address import\n"); + nsImportStringBundle::GetStringByID(TEXTIMPORT_ADDRESS_BADPARAM, + pBundle, + error); + + SetLogs(success, error, pErrorLog, pSuccessLog); + + if (fatalError) + *fatalError = PR_TRUE; + + return NS_ERROR_NULL_POINTER; } ClearSampleFile(); @@ -488,20 +520,19 @@ NS_IMETHODIMP ImportAddressImpl::ImportAddressBook( nsIImportABDescriptor *pSour pSource->GetSize( &addressSize); if (addressSize == 0) { IMPORT_LOG0( "Address book size is 0, skipping import.\n"); - ReportSuccess( name, &success); - SetLogs( success, error, pErrorLog, pSuccessLog); + ReportSuccess(name, &success, pBundle); + SetLogs(success, error, pErrorLog, pSuccessLog); return NS_OK; } nsCOMPtr inFile; if (NS_FAILED(pSource->GetAbFile(getter_AddRefs(inFile)))) { - ReportError( TEXTIMPORT_ADDRESS_BADSOURCEFILE, name, &error); - SetLogs( success, error, pErrorLog, pSuccessLog); + ReportError(TEXTIMPORT_ADDRESS_BADSOURCEFILE, name, &error, pBundle); + SetLogs(success, error, pErrorLog, pSuccessLog); return NS_ERROR_FAILURE; } PRBool isLDIF = PR_FALSE; - nsresult rv; nsCOMPtr ldifService = do_GetService(NS_ABLDIFSERVICE_CONTRACTID, &rv); if (NS_SUCCEEDED(rv)) { @@ -512,8 +543,8 @@ NS_IMETHODIMP ImportAddressImpl::ImportAddressBook( nsIImportABDescriptor *pSour } if (NS_FAILED( rv)) { - ReportError( TEXTIMPORT_ADDRESS_CONVERTERROR, name, &error); - SetLogs( success, error, pErrorLog, pSuccessLog); + ReportError(TEXTIMPORT_ADDRESS_CONVERTERROR, name, &error, pBundle); + SetLogs(success, error, pErrorLog, pSuccessLog); return( rv); } @@ -529,14 +560,14 @@ NS_IMETHODIMP ImportAddressImpl::ImportAddressBook( nsIImportABDescriptor *pSour } if (NS_SUCCEEDED( rv) && error.IsEmpty()) { - ReportSuccess( name, &success); + ReportSuccess(name, &success, pBundle); + SetLogs(success, error, pErrorLog, pSuccessLog); } else { - ReportError( TEXTIMPORT_ADDRESS_CONVERTERROR, name, &error); + ReportError(TEXTIMPORT_ADDRESS_CONVERTERROR, name, &error, pBundle); + SetLogs(success, error, pErrorLog, pSuccessLog); } - SetLogs( success, error, pErrorLog, pSuccessLog); - IMPORT_LOG0( "*** Text address import done\n"); return rv; } diff --git a/mozilla/mailnews/import/text/src/nsTextImport.h b/mozilla/mailnews/import/text/src/nsTextImport.h index 1e7f68c815f..8f544f2c928 100644 --- a/mozilla/mailnews/import/text/src/nsTextImport.h +++ b/mozilla/mailnews/import/text/src/nsTextImport.h @@ -1,4 +1,4 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- +/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- * * ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 @@ -21,6 +21,7 @@ * the Initial Developer. All Rights Reserved. * * Contributor(s): + * Mark Banner * * Alternatively, the contents of this file may be used under the terms of * either of the GNU General Public License Version 2 or later (the "GPL"), @@ -41,21 +42,18 @@ #include "nsIImportModule.h" #include "nsCOMPtr.h" - +#include "nsIStringBundle.h" #define NS_TEXTIMPORT_CID \ { /* A5991D01-ADA7-11d3-A9C2-00A0CC26DA63 */ \ 0xa5991d01, 0xada7, 0x11d3, \ {0xa9, 0xc2, 0x0, 0xa0, 0xcc, 0x26, 0xda, 0x63 }} - - #define kTextSupportsString NS_IMPORT_ADDRESS_STR class nsTextImport : public nsIImportModule { public: - nsTextImport(); virtual ~nsTextImport(); @@ -69,6 +67,7 @@ public: protected: + nsCOMPtr m_stringBundle; };