diff --git a/mozilla/mailnews/base/prefs/resources/content/AccountManager.js b/mozilla/mailnews/base/prefs/resources/content/AccountManager.js index a3619ce96c2..2a60df958b0 100644 --- a/mozilla/mailnews/base/prefs/resources/content/AccountManager.js +++ b/mozilla/mailnews/base/prefs/resources/content/AccountManager.js @@ -992,7 +992,7 @@ function getFormElementValue(formElement) { formElement.getAttribute("datatype") == "nsIFileSpec") { if (formElement.value) { var filespec = Components.classes["@mozilla.org/filespec;1"].createInstance(Components.interfaces.nsIFileSpec); - filespec.nativePath = formElement.value; + filespec.setUnicodePath(formElement.value); return filespec; } return null; @@ -1065,7 +1065,7 @@ function setFormElementValue(formElement, value) { if (value) { var filespec = value.QueryInterface(Components.interfaces.nsIFileSpec); try { - formElement.value = filespec.nativePath; + formElement.value = filespec.getUnicodePath(); } catch (ex) { dump("Still need to fix uninitialized filespec problem!\n"); } diff --git a/mozilla/xpcom/obsolete/nsFileSpecImpl.cpp b/mozilla/xpcom/obsolete/nsFileSpecImpl.cpp index fc155573ada..7234a7fcfa0 100644 --- a/mozilla/xpcom/obsolete/nsFileSpecImpl.cpp +++ b/mozilla/xpcom/obsolete/nsFileSpecImpl.cpp @@ -42,6 +42,7 @@ #include "nsFileStream.h" #include "nsILocalFile.h" +#include "nsNativeCharsetUtils.h" #include "prmem.h" @@ -211,6 +212,34 @@ NS_IMETHODIMP nsFileSpecImpl::SetNativePath(const char * aNativePath) return NS_OK; } +//---------------------------------------------------------------------------------------- +NS_IMETHODIMP nsFileSpecImpl::GetUnicodePath(PRUnichar * *aUnicodePath) +//---------------------------------------------------------------------------------------- +{ + TEST_OUT_PTR(aUnicodePath) + nsAutoString unicode; + nsCAutoString native; + native = mFileSpec.GetNativePathCString(); + NS_CopyNativeToUnicode(native, unicode); + *aUnicodePath = nsCRT::strdup(unicode.get()); + if (!*aUnicodePath) + return NS_ERROR_OUT_OF_MEMORY; + return NS_OK; +} + +//---------------------------------------------------------------------------------------- +NS_IMETHODIMP nsFileSpecImpl::SetUnicodePath(const PRUnichar * aUnicodePath) +//---------------------------------------------------------------------------------------- +{ + nsAutoString unicode; + nsCAutoString native; + + unicode = aUnicodePath; + NS_CopyUnicodeToNative(unicode, native); + mFileSpec = native.get(); + return NS_OK; +} + //---------------------------------------------------------------------------------------- NS_IMETHODIMP nsFileSpecImpl::GetNSPRPath(char * *aNSPRPath) //---------------------------------------------------------------------------------------- diff --git a/mozilla/xpcom/obsolete/nsIFileSpec.idl b/mozilla/xpcom/obsolete/nsIFileSpec.idl index 7f3371108be..51120c0aced 100644 --- a/mozilla/xpcom/obsolete/nsIFileSpec.idl +++ b/mozilla/xpcom/obsolete/nsIFileSpec.idl @@ -154,6 +154,8 @@ interface nsIFileSpec : nsISupports void seek(in long offset); long tell(); void endLine(); + wstring getUnicodePath(); + void setUnicodePath(in wstring aUnicodePath); };