Fix for 197280. Fixed i18n issue with selected pathnames. r/sr=sspitzer.

This commit is contained in:
cavin%netscape.com 2003-03-14 01:18:19 +00:00
Родитель 3c1739e1d7
Коммит 49c6ed7c0c
6 изменённых файлов: 48 добавлений и 40 удалений

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

@ -59,5 +59,5 @@ interface nsIComm4xProfile: nsISupports {
* @return The path to the mail directory for the profile with the name profileName
*
*/
string getMailDir(in wstring profileName);
wstring getMailDir(in wstring profileName);
};

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

@ -70,7 +70,7 @@ nsComm4xProfile::GetProfileList(PRUint32 *length, PRUnichar ***profileNames)
#define PREF_LENGTH 29
#define PREF_END "\")"
NS_IMETHODIMP
nsComm4xProfile::GetMailDir(const PRUnichar *profileName, char **_retval)
nsComm4xProfile::GetMailDir(const PRUnichar *profileName, PRUnichar **_retval)
{
NS_ENSURE_ARG_POINTER(_retval);
*_retval = nsnull;
@ -95,19 +95,19 @@ nsComm4xProfile::GetMailDir(const PRUnichar *profileName, char **_retval)
rv = profileLocation->Exists(&exists);
if (NS_FAILED(rv)) return rv;
if (exists) {
nsXPIDLCString prefValue;
nsXPIDLString prefValue;
rv = GetPrefValue(profileLocation, PREF_NAME, PREF_END, getter_Copies(prefValue));
if (NS_FAILED(rv)) return rv;
if (prefValue) {
#ifdef XP_MAC
rv = profileLocation->SetPersistentDescriptor(prefValue);
if (NS_FAILED(rv)) return rv;
nsCAutoString nativePath;
rv = profileLocation->GetNativePath(nativePath);
nsAutoString path;
rv = profileLocation->GetPath(path);
if (NS_FAILED(rv)) return rv;
*_retval = ToNewCString(nativePath);
*_retval = ToNewUnicode(path);
#else
*_retval = ToNewCString(prefValue);
*_retval = ToNewUnicode(prefValue);
#endif
}
#if defined(XP_PC) || defined(XP_MAC)
@ -117,10 +117,10 @@ nsComm4xProfile::GetMailDir(const PRUnichar *profileName, char **_retval)
if (NS_FAILED(rv)) return rv;
rv = mailLocation->AppendNative(NS_LITERAL_CSTRING("Mail"));
if (NS_FAILED(rv)) return rv;
nsCAutoString nativePath;
rv = mailLocation->GetNativePath(nativePath);
nsAutoString path;
rv = mailLocation->GetPath(path);
if (NS_FAILED(rv)) return rv;
*_retval = ToNewCString(nativePath);
*_retval = ToNewUnicode(path);
}
#endif
}
@ -128,7 +128,7 @@ nsComm4xProfile::GetMailDir(const PRUnichar *profileName, char **_retval)
return rv;
}
nsresult nsComm4xProfile::GetPrefValue(nsILocalFile *filePath, const char * prefName, const char * prefEnd, char ** retval)
nsresult nsComm4xProfile::GetPrefValue(nsILocalFile *filePath, const char * prefName, const char * prefEnd, PRUnichar ** retval)
{
nsString buffer;
PRBool more = PR_TRUE;
@ -155,11 +155,10 @@ nsresult nsComm4xProfile::GetPrefValue(nsILocalFile *filePath, const char * pref
if (offset != kNotFound) {
endOffset = buffer.Find(prefEnd,PR_FALSE, 0, -1);
if (endOffset != kNotFound) {
nsString prefValue;
nsAutoString prefValue;
buffer.Mid(prefValue, offset + PREF_LENGTH, endOffset-(offset + PREF_LENGTH));
found = PR_TRUE;
NS_ConvertUCS2toUTF8 utf8Pref(prefValue.get());
*retval = ToNewCString(utf8Pref);
*retval = ToNewUnicode(prefValue);
break;
}
}

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

@ -58,7 +58,7 @@ public:
nsComm4xProfile();
virtual ~nsComm4xProfile();
nsresult Get4xProfileInfo(const char *registryName);
nsresult GetPrefValue(nsILocalFile *filePath, const char * prefName, const char * prefEnd, char ** value);
nsresult GetPrefValue(nsILocalFile *filePath, const char * prefName, const char * prefEnd, PRUnichar ** value);
NS_DECL_ISUPPORTS
NS_DECL_NSICOMM4XPROFILE

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

@ -700,7 +700,9 @@ function ImportMail( module, success, error) {
}
if (!errorValue) {
var profileDir = comm4xprofile.getMailDir(profileList[selected.value]);
mailInterface.SetData( "mailLocation", CreateNewFileSpecFromPath( profileDir));
var localfile = Components.classes["@mozilla.org/file/local;1"].createInstance(Components.interfaces.nsILocalFile);
localfile.initWithPath(profileDir);
mailInterface.SetData( "mailLocation", localfile);
}
} // profileList
} // comm4xprofile
@ -720,7 +722,7 @@ function ImportMail( module, success, error) {
filePicker.appendFilters( Components.interfaces.nsIFilePicker.filterAll);
filePicker.show();
if (filePicker.file && (filePicker.file.path.length > 0))
mailInterface.SetData( "mailLocation", CreateNewFileSpecFromPath( filePicker.file.path));
mailInterface.SetData( "mailLocation", filePicker.file);
else
return( false);
} catch( ex) {
@ -823,7 +825,7 @@ function ImportAddress( module, success, error) {
filePicker.appendFilters( Components.interfaces.nsIFilePicker.filterAll);
filePicker.show();
if (filePicker.file && (filePicker.file.path.length > 0))
file = filePicker.file.path;
file = filePicker.file;
else
file = null;
} catch( ex) {
@ -848,7 +850,7 @@ function ImportAddress( module, success, error) {
return false;
if (filePicker.file && (filePicker.file.path.length > 0))
file = filePicker.file.path;
file = filePicker.file;
else
file = null;
} catch( ex) {
@ -863,9 +865,7 @@ function ImportAddress( module, success, error) {
return( false);
}
file = CreateNewFileSpecFromPath( file);
addInterface.SetData( "addressLocation", file);
addInterface.SetData("addressLocation", file);
}
// no need to use the fieldmap for 4.x import since we are using separate dialog

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

@ -54,6 +54,7 @@
#include "nsNetCID.h"
#include "nsIFileSpec.h"
#include "nsILocalFile.h"
#include "nsIAddrDatabase.h"
#include "nsIAddrBookSession.h"
@ -125,7 +126,7 @@ public:
private:
nsIImportAddressBooks * m_pInterface;
nsISupportsArray * m_pBooks;
nsIFileSpec * m_pLocation;
nsCOMPtr <nsIFileSpec> m_pLocation;
nsIImportFieldMap * m_pFieldMap;
PRBool m_autoFind;
PRUnichar * m_description;
@ -194,7 +195,6 @@ nsImportGenericAddressBooks::nsImportGenericAddressBooks()
m_pDestinationUri = nsnull;
m_pFieldMap = nsnull;
m_pLocation = nsnull;
m_autoFind = PR_FALSE;
m_description = nsnull;
m_gotLocation = PR_FALSE;
@ -217,7 +217,6 @@ nsImportGenericAddressBooks::~nsImportGenericAddressBooks()
nsCRT::free( m_description);
NS_IF_RELEASE( m_pFieldMap);
NS_IF_RELEASE( m_pLocation);
NS_IF_RELEASE( m_pInterface);
NS_IF_RELEASE( m_pBooks);
NS_IF_RELEASE( m_pSuccessLog);
@ -245,8 +244,7 @@ NS_IMETHODIMP nsImportGenericAddressBooks::GetData(const char *dataId, nsISuppor
if (!nsCRT::strcasecmp( dataId, "addressLocation")) {
if (!m_pLocation)
GetDefaultLocation();
*_retval = m_pLocation;
NS_IF_ADDREF( m_pLocation);
NS_IF_ADDREF(*_retval = m_pLocation);
}
if (!nsCRT::strcasecmp( dataId, "addressBooks")) {
@ -341,11 +339,19 @@ NS_IMETHODIMP nsImportGenericAddressBooks::SetData( const char *dataId, nsISuppo
}
if (!nsCRT::strcasecmp( dataId, "addressLocation")) {
NS_IF_RELEASE( m_pLocation);
if (item)
item->QueryInterface( NS_GET_IID(nsIFileSpec), (void **) &m_pLocation);
if (m_pInterface)
m_pInterface->SetSampleLocation( m_pLocation);
m_pLocation = nsnull;
if (item) {
nsresult rv;
nsCOMPtr <nsILocalFile> location = do_QueryInterface(item, &rv);
NS_ENSURE_SUCCESS(rv,rv);
rv = NS_NewFileSpecFromIFile(location, getter_AddRefs(m_pLocation));
NS_ENSURE_SUCCESS(rv,rv);
}
if (m_pInterface)
m_pInterface->SetSampleLocation(m_pLocation);
}
if (!nsCRT::strcasecmp( dataId, "addressDestination")) {

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

@ -139,7 +139,7 @@ private:
nsIMsgFolder * m_pDestFolder;
PRBool m_deleteDestFolder;
PRBool m_createdFolder;
nsIFileSpec * m_pSrcLocation;
nsCOMPtr <nsIFileSpec> m_pSrcLocation;
PRBool m_gotLocation;
PRBool m_found;
PRBool m_userVerify;
@ -196,7 +196,6 @@ nsresult NS_NewGenericMail(nsIImportGeneric** aImportGeneric)
nsImportGenericMail::nsImportGenericMail()
{
m_pSrcLocation = nsnull;
m_found = PR_FALSE;
m_userVerify = PR_FALSE;
m_gotLocation = PR_FALSE;
@ -226,7 +225,6 @@ nsImportGenericMail::~nsImportGenericMail()
}
NS_IF_RELEASE( m_pDestFolder);
NS_IF_RELEASE( m_pSrcLocation);
NS_IF_RELEASE( m_pInterface);
NS_IF_RELEASE( m_pMailboxes);
NS_IF_RELEASE( m_pSuccessLog);
@ -262,8 +260,7 @@ NS_IMETHODIMP nsImportGenericMail::GetData(const char *dataId, nsISupports **_re
if (!nsCRT::strcasecmp( dataId, "mailLocation")) {
if (!m_pSrcLocation)
GetDefaultLocation();
*_retval = m_pSrcLocation;
NS_IF_ADDREF( m_pSrcLocation);
NS_IF_ADDREF(*_retval = m_pSrcLocation);
}
if (!nsCRT::strcasecmp( dataId, "mailDestination")) {
@ -310,9 +307,15 @@ NS_IMETHODIMP nsImportGenericMail::SetData( const char *dataId, nsISupports *ite
if (!nsCRT::strcasecmp( dataId, "mailLocation")) {
NS_IF_RELEASE( m_pMailboxes);
NS_IF_RELEASE( m_pSrcLocation);
if (item)
item->QueryInterface( NS_GET_IID(nsIFileSpec), (void **) &m_pSrcLocation);
m_pSrcLocation = nsnull;
if (item) {
nsresult rv;
nsCOMPtr <nsILocalFile> location = do_QueryInterface(item, &rv);
NS_ENSURE_SUCCESS(rv,rv);
rv = NS_NewFileSpecFromIFile(location, getter_AddRefs(m_pSrcLocation));
NS_ENSURE_SUCCESS(rv,rv);
}
}
if (!nsCRT::strcasecmp( dataId, "mailDestination")) {