fix bug 41083 Signature path not stored correctly when containing non-english characters

patch by alecf, updated by timeless and bz. r=sspitzer,alecf sr=mscott,alecf


git-svn-id: svn://10.0.0.236/trunk@87658 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
timeless%mac.com 2001-02-22 10:18:54 +00:00
parent edc70961f6
commit 2f43c71a22
6 changed files with 25 additions and 26 deletions

View File

@ -58,7 +58,7 @@
<checkbox wsm_persist="true" id="identity.attachSignature" value="&signature.label;" flex="1"/>
</box>
<box autostretch="never" class="indent">
<textfield wsm_persist="true" id="identity.signature" datatype="nsIFileSpec" flex="1" name="identity.signature"/>
<textfield wsm_persist="true" id="identity.signature" datatype="nsILocalFile" flex="1" name="identity.signature"/>
<button class="dialog push" name="browse" type="button" value="&choose.label;"
oncommand="prefNavSelectFile('identity.signature', 'choosefile', true)"/>
</box>

View File

@ -22,7 +22,7 @@
#include "nsISupports.idl"
#include "nsIMsgSignature.idl"
#include "nsIFileSpec.idl"
#include "nsILocalFile.idl"
#include "nsIMsgVCard.idl"
/*
@ -70,7 +70,7 @@ interface nsIMsgIdentity : nsISupports {
/* the current signature */
/* after PR1, let's make this a real object */
/* attribute nsIMsgSignature signature; */
attribute nsIFileSpec signature;
attribute nsILocalFile signature;
attribute long signatureDate;
/* the current vcard */

View File

@ -233,10 +233,10 @@ static NS_DEFINE_CID(kStringBundleServiceCID, NS_STRINGBUNDLESERVICE_CID);
#define MIGRATE_SIMPLE_FILE_PREF_TO_FILE_PREF(PREFNAME,MACRO_OBJECT,MACRO_METHOD) \
{ \
nsresult macro_rv; \
nsCOMPtr <nsIFileSpec>macro_spec; \
macro_rv = m_prefs->GetFilePref(PREFNAME, getter_AddRefs(macro_spec)); \
nsCOMPtr <nsILocalFile> macro_file; \
macro_rv = m_prefs->GetFileXPref(PREFNAME, getter_AddRefs(macro_file)); \
if (NS_SUCCEEDED(macro_rv)) { \
MACRO_OBJECT->MACRO_METHOD(macro_spec); \
MACRO_OBJECT->MACRO_METHOD(macro_file); \
} \
}

View File

@ -349,19 +349,19 @@ nsMsgIdentity::ToString(PRUnichar **aResult)
// XXX - these are a COM objects, use NS_ADDREF
//NS_IMPL_GETSET(nsMsgIdentity, Signature, nsIMsgSignature*, m_signature);
NS_IMETHODIMP
nsMsgIdentity::GetSignature(nsIFileSpec **sig) {
nsMsgIdentity::GetSignature(nsILocalFile **sig) {
nsresult rv = getPrefService();
if (NS_FAILED(rv)) return rv;
char *prefName = getPrefName(m_identityKey, "sig_file");
rv = m_prefs->GetFilePref(prefName, sig);
rv = m_prefs->GetFileXPref(prefName, sig);
if (NS_FAILED(rv))
*sig = nsnull;
return NS_OK;
}
NS_IMETHODIMP
nsMsgIdentity::SetSignature(nsIFileSpec *sig)
nsMsgIdentity::SetSignature(nsILocalFile *sig)
{
nsresult rv = getPrefService();
@ -370,8 +370,7 @@ nsMsgIdentity::SetSignature(nsIFileSpec *sig)
rv = NS_OK;
char *prefName = getPrefName(m_identityKey, "sig_file");
if (sig)
rv = m_prefs->SetFilePref(NS_CONST_CAST(const char*,prefName), sig,
PR_FALSE);
rv = m_prefs->SetFileXPref(prefName, sig);
/*
else
m_prefs->ClearFilePref(prefName);
@ -483,7 +482,7 @@ nsMsgIdentity::setFolderPref(const char *prefname, const char *value)
#define COPY_IDENTITY_FILE_VALUE(SRC_ID,MACRO_GETTER,MACRO_SETTER) \
{ \
nsresult macro_rv; \
nsCOMPtr <nsIFileSpec>macro_spec; \
nsCOMPtr <nsILocalFile>macro_spec; \
macro_rv = SRC_ID->MACRO_GETTER(getter_AddRefs(macro_spec)); \
if (NS_FAILED(macro_rv)) return macro_rv; \
this->MACRO_SETTER(macro_spec); \

View File

@ -508,15 +508,12 @@ nsresult nsMsgCompose::_SendMsg(MSG_DeliverMode deliverMode, nsIMsgIdentity *ide
identity->GetFullName(getter_Copies(fullName));
identity->GetOrganization(getter_Copies(organization));
char * sender = nsnull;
nsCOMPtr<nsIMsgHeaderParser> parser (do_GetService(kHeaderParserCID));
if (parser) {
// convert to UTF8 before passing to MakeFullAddress
nsAutoString fullNameStr(fullName);
char *fullNameUTF8 = fullNameStr.ToNewUTF8String();
parser->MakeFullAddress(nsnull, fullNameUTF8, email, &sender);
nsCRT::free(fullNameUTF8);
}
char * sender = nsnull;
nsCOMPtr<nsIMsgHeaderParser> parser (do_GetService(kHeaderParserCID));
if (parser) {
// convert to UTF8 before passing to MakeFullAddress
parser->MakeFullAddress(nsnull, NS_ConvertUCS2toUTF8(fullName), email, &sender);
}
if (!sender)
m_compFields->SetFrom(email);
@ -1929,7 +1926,7 @@ nsMsgCompose::ProcessSignature(nsIMsgIdentity *identity, nsString *aMsgBody)
// saying "Image Signature Omitted" or something.
//
nsAutoString urlStr;
nsCOMPtr<nsIFileSpec> sigFileSpec;
nsXPIDLCString sigNativePath;
PRBool useSigFile = PR_FALSE;
PRBool htmlSig = PR_FALSE;
PRBool imageSig = PR_FALSE;
@ -1941,18 +1938,20 @@ nsMsgCompose::ProcessSignature(nsIMsgIdentity *identity, nsString *aMsgBody)
rv = identity->GetAttachSignature(&useSigFile);
if (NS_SUCCEEDED(rv) && useSigFile)
{
identity->GetSignature(getter_AddRefs(sigFileSpec));
nsCOMPtr<nsILocalFile> sigFile;
rv = identity->GetSignature(getter_AddRefs(sigFile));
if (NS_SUCCEEDED(rv))
rv = sigFile->GetPath(getter_Copies(sigNativePath));
}
}
// Now, if they didn't even want to use a signature, we should
// just return nicely.
//
if ((!useSigFile) || (!sigFileSpec))
if ((!useSigFile) || NS_FAILED(rv))
return NS_OK;
nsFileSpec testSpec;
sigFileSpec->GetFileSpec(&testSpec);
nsFileSpec testSpec(sigNativePath);
// If this file doesn't really exist, just bail!
if (!testSpec.Exists())

View File

@ -22,6 +22,7 @@
*/
#include "nsIMsgComposeParams.h"
#include "nsString.h"
class nsMsgComposeParams : public nsIMsgComposeParams
{