mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-10 20:05:49 +00:00
Bug 62429 The "Start my reply above the quoted text" setting should ALSO allow to prepend the signature above the quote text. (top)
patch by bugzilla@arlen.demon.co.uk r=neil sr=bienvenu
This commit is contained in:
parent
d4c0e6f2e4
commit
39af5034bb
@ -106,7 +106,19 @@ function onSave()
|
||||
function quoteEnabling()
|
||||
{
|
||||
var quotebox = document.getElementById("thenBox");
|
||||
var placebox = document.getElementById("placeBox");
|
||||
var quotecheck = document.getElementById("identity.autoQuote");
|
||||
|
||||
if (quotecheck.checked && !quotecheck.disabled &&
|
||||
document.getElementById("identity.attachSignature").checked &&
|
||||
(document.getElementById("identity.replyOnTop").value == 1)) {
|
||||
placebox.firstChild.removeAttribute("disabled");
|
||||
placebox.lastChild.removeAttribute("disabled");
|
||||
}
|
||||
else {
|
||||
placebox.firstChild.setAttribute("disabled", "true");
|
||||
placebox.lastChild.setAttribute("disabled", "true");
|
||||
}
|
||||
if (quotecheck.checked && !quotecheck.disabled) {
|
||||
quotebox.firstChild.removeAttribute("disabled");
|
||||
quotebox.lastChild.removeAttribute("disabled");
|
||||
|
@ -42,6 +42,9 @@ Contributors:
|
||||
prefstring="mail.identity.%identitykey%.overrideGlobal_Pref"/>
|
||||
<label hidden="true" wsm_persist="true" id="overrideGlobalPref" value=""/>
|
||||
<label hidden="true" wsm_persist="true" id="directoryServer" value=""/>
|
||||
<checkbox hidden="true" wsm_persist="true" id="identity.attachSignature"
|
||||
pref="true" preftype="bool" prefattribute="value"
|
||||
prefstring="mail.identity.%identitykey%.attach_signature"/>
|
||||
|
||||
<dialogheader title="&addressing.label;"/>
|
||||
|
||||
@ -64,7 +67,7 @@ Contributors:
|
||||
</hbox>
|
||||
<hbox class="indent" align="center" id="thenBox">
|
||||
<label value="&then.label;" accesskey="&then.accesskey;" control="quoteList"/>
|
||||
<menulist wsm_persist="true" id="identity.replyOnTop"
|
||||
<menulist wsm_persist="true" id="identity.replyOnTop" oncommand="quoteEnabling();"
|
||||
pref="true" preftype="int" prefattribute="value"
|
||||
prefstring="mail.identity.%identitykey%.reply_on_top">
|
||||
<menupopup>
|
||||
@ -74,8 +77,18 @@ Contributors:
|
||||
</menupopup>
|
||||
</menulist>
|
||||
</hbox>
|
||||
<hbox class="indent" align="center" id="placeBox">
|
||||
<label value="&place.label;" accesskey="&place.accesskey;" control="sigPosList"/>
|
||||
<menulist wsm_persist="true" id="identity.sig_bottom" genericattr="true"
|
||||
pref="true" preftype="bool" prefattribute="value">
|
||||
<menupopup>
|
||||
<menuitem value="true" label="&belowText.label;" accesskey="&belowText.accesskey;"/>
|
||||
<menuitem value="false" label="&aboveText.label;" accesskey="&aboveText.accesskey;"/>
|
||||
</menupopup>
|
||||
</menulist>
|
||||
</hbox>
|
||||
</groupbox>
|
||||
|
||||
|
||||
<separator class="thin"/>
|
||||
<groupbox>
|
||||
<caption label="&addressingGroupTitle.label;"/>
|
||||
|
@ -28,3 +28,9 @@
|
||||
<!ENTITY belowQuote.accesskey "b">
|
||||
<!ENTITY selectAndQuote.label "select the quoted text">
|
||||
<!ENTITY selectAndQuote.accesskey "e">
|
||||
<!ENTITY place.label "and place my signature">
|
||||
<!ENTITY place.accesskey "p">
|
||||
<!ENTITY belowText.label "below the quoted text (recommended)">
|
||||
<!ENTITY belowText.accesskey "b">
|
||||
<!ENTITY aboveText.label "below my reply (above quoted text)">
|
||||
<!ENTITY aboveText.accesskey "v">
|
||||
|
@ -88,6 +88,9 @@ interface nsIMsgIdentity : nsISupports {
|
||||
/* what should our quoting preference be? */
|
||||
attribute long replyOnTop;
|
||||
|
||||
/* what should our signature be at the end of the quoted text when replying above it? */
|
||||
attribute boolean sigBottom;
|
||||
|
||||
/* the current signature */
|
||||
/* after PR1, let's make this a real object */
|
||||
/* attribute nsIMsgSignature signature; */
|
||||
|
@ -463,6 +463,7 @@ NS_IMPL_IDPREF_BOOL(AttachSignature, "attach_signature")
|
||||
|
||||
NS_IMPL_IDPREF_BOOL(AutoQuote, "auto_quote")
|
||||
NS_IMPL_IDPREF_INT(ReplyOnTop, "reply_on_top")
|
||||
NS_IMPL_IDPREF_BOOL(SigBottom, "sig_bottom")
|
||||
|
||||
NS_IMPL_IDPREF_INT(SignatureDate,"sig_date")
|
||||
|
||||
@ -794,6 +795,7 @@ nsMsgIdentity::Copy(nsIMsgIdentity *identity)
|
||||
COPY_IDENTITY_FILE_VALUE(identity,GetSignature,SetSignature)
|
||||
COPY_IDENTITY_BOOL_VALUE(identity,GetAutoQuote,SetAutoQuote)
|
||||
COPY_IDENTITY_INT_VALUE(identity,GetReplyOnTop,SetReplyOnTop)
|
||||
COPY_IDENTITY_BOOL_VALUE(identity,GetSigBottom,SetSigBottom)
|
||||
COPY_IDENTITY_INT_VALUE(identity,GetSignatureDate,SetSignatureDate)
|
||||
|
||||
return NS_OK;
|
||||
|
@ -232,7 +232,9 @@ interface nsIMsgCompose : nsISupports {
|
||||
[noscript] attribute string savedFolderURI;
|
||||
|
||||
/* Append the signature defined in the identity to the msgBody */
|
||||
[noscript] void processSignature(in nsIMsgIdentity identity, inout nsString aMsgBody);
|
||||
[noscript] void processSignature(in nsIMsgIdentity identity,
|
||||
in boolean aQuoted,
|
||||
inout nsString aMsgBody);
|
||||
|
||||
/* set any reply flags on the original message's folder */
|
||||
[noscript] void processReplyFlags();
|
||||
|
@ -489,8 +489,22 @@ nsMsgCompose::ConvertAndLoadComposeWindow(nsString& aPrefix,
|
||||
nsCOMPtr<nsIPlaintextEditor> textEditor (do_QueryInterface(m_editor));
|
||||
nsCOMPtr<nsIEditorMailSupport> mailEditor (do_QueryInterface(m_editor));
|
||||
m_editor->BeginTransaction();
|
||||
PRInt32 reply_on_top = 0;
|
||||
PRBool sig_bottom = PR_TRUE;
|
||||
m_identity->GetReplyOnTop(&reply_on_top);
|
||||
m_identity->GetSigBottom(&sig_bottom);
|
||||
PRBool sigOnTop = (reply_on_top == 1 && !sig_bottom);
|
||||
if ( (aQuoted) )
|
||||
{
|
||||
if (!aSignature.IsEmpty() && sigOnTop)
|
||||
{
|
||||
if (aHTMLEditor && htmlEditor)
|
||||
htmlEditor->InsertHTML(aSignature);
|
||||
else if (textEditor)
|
||||
textEditor->InsertText(aSignature);
|
||||
m_editor->EndOfDocument();
|
||||
}
|
||||
|
||||
if (!aPrefix.IsEmpty())
|
||||
{
|
||||
if (aHTMLEditor && htmlEditor)
|
||||
@ -515,7 +529,7 @@ nsMsgCompose::ConvertAndLoadComposeWindow(nsString& aPrefix,
|
||||
|
||||
(void)TagEmbeddedObjects(mailEditor);
|
||||
|
||||
if (!aSignature.IsEmpty())
|
||||
if (!aSignature.IsEmpty() && !sigOnTop)
|
||||
{
|
||||
if (aHTMLEditor && htmlEditor)
|
||||
htmlEditor->InsertHTML(aSignature);
|
||||
@ -578,8 +592,6 @@ nsMsgCompose::ConvertAndLoadComposeWindow(nsString& aPrefix,
|
||||
m_editor->BeginningOfDocument();
|
||||
else
|
||||
{
|
||||
PRInt32 reply_on_top = 0;
|
||||
m_identity->GetReplyOnTop(&reply_on_top);
|
||||
switch (reply_on_top)
|
||||
{
|
||||
// This should set the cursor after the body but before the sig
|
||||
@ -2126,7 +2138,7 @@ NS_IMETHODIMP QuotingOutputStreamListener::OnStopRequest(nsIRequest *request, ns
|
||||
Recycle(target_charset);
|
||||
}
|
||||
|
||||
compose->ProcessSignature(mIdentity, &mSignature);
|
||||
compose->ProcessSignature(mIdentity, PR_TRUE, &mSignature);
|
||||
|
||||
nsCOMPtr<nsIEditor> editor;
|
||||
if (NS_SUCCEEDED(compose->GetEditor(getter_AddRefs(editor))) && editor)
|
||||
@ -3219,7 +3231,7 @@ nsMsgCompose::BuildQuotedMessageAndSignature(void)
|
||||
// will always append the results to the mMsgBody member variable.
|
||||
//
|
||||
nsresult
|
||||
nsMsgCompose::ProcessSignature(nsIMsgIdentity *identity, nsString *aMsgBody)
|
||||
nsMsgCompose::ProcessSignature(nsIMsgIdentity *identity, PRBool aQuoted, nsString *aMsgBody)
|
||||
{
|
||||
nsresult rv;
|
||||
|
||||
@ -3246,9 +3258,13 @@ nsMsgCompose::ProcessSignature(nsIMsgIdentity *identity, nsString *aMsgBody)
|
||||
PRBool imageSig = PR_FALSE;
|
||||
nsAutoString sigData;
|
||||
nsAutoString sigOutput;
|
||||
PRInt32 reply_on_top = 0;
|
||||
PRBool sig_bottom = PR_TRUE;
|
||||
|
||||
if (identity)
|
||||
{
|
||||
identity->GetReplyOnTop(&reply_on_top);
|
||||
identity->GetSigBottom(&sig_bottom);
|
||||
rv = identity->GetAttachSignature(&useSigFile);
|
||||
if (NS_SUCCEEDED(rv) && useSigFile)
|
||||
{
|
||||
@ -3331,7 +3347,8 @@ nsMsgCompose::ProcessSignature(nsIMsgIdentity *identity, nsString *aMsgBody)
|
||||
{
|
||||
sigOutput.AppendWithConversion(htmlBreak);
|
||||
sigOutput.AppendWithConversion(htmlsigopen);
|
||||
sigOutput.AppendWithConversion(dashes);
|
||||
if (reply_on_top != 1 || sig_bottom || !aQuoted)
|
||||
sigOutput.AppendWithConversion(dashes);
|
||||
sigOutput.AppendWithConversion(htmlBreak);
|
||||
sigOutput.Append(NS_LITERAL_STRING("<img src=\"file:///"));
|
||||
/* XXX pp This gives me 4 slashes on Unix, that's at least one to
|
||||
@ -3368,17 +3385,20 @@ nsMsgCompose::ProcessSignature(nsIMsgIdentity *identity, nsString *aMsgBody)
|
||||
else
|
||||
sigOutput.AppendWithConversion(CRLF);
|
||||
|
||||
nsDependentSubstring firstFourChars(sigData, 0, 4);
|
||||
|
||||
if (!(firstFourChars.Equals(NS_LITERAL_STRING("-- \n")) ||
|
||||
firstFourChars.Equals(NS_LITERAL_STRING("-- \r"))))
|
||||
if (reply_on_top != 1 || sig_bottom || !aQuoted)
|
||||
{
|
||||
sigOutput.AppendWithConversion(dashes);
|
||||
nsDependentSubstring firstFourChars(sigData, 0, 4);
|
||||
|
||||
if (!m_composeHTML || !htmlSig)
|
||||
sigOutput.AppendWithConversion(CRLF);
|
||||
else if (m_composeHTML)
|
||||
sigOutput.AppendWithConversion(htmlBreak);
|
||||
if (!(firstFourChars.Equals(NS_LITERAL_STRING("-- \n")) ||
|
||||
firstFourChars.Equals(NS_LITERAL_STRING("-- \r"))))
|
||||
{
|
||||
sigOutput.AppendWithConversion(dashes);
|
||||
|
||||
if (!m_composeHTML || !htmlSig)
|
||||
sigOutput.AppendWithConversion(CRLF);
|
||||
else if (m_composeHTML)
|
||||
sigOutput.AppendWithConversion(htmlBreak);
|
||||
}
|
||||
}
|
||||
|
||||
sigOutput.Append(sigData);
|
||||
@ -3450,7 +3470,7 @@ nsMsgCompose::BuildBodyMessageAndSignature()
|
||||
nsAutoString tSignature;
|
||||
|
||||
if (addSignature)
|
||||
ProcessSignature(m_identity, &tSignature);
|
||||
ProcessSignature(m_identity, PR_FALSE, &tSignature);
|
||||
|
||||
rv = ConvertAndLoadComposeWindow(empty, bodStr, tSignature,
|
||||
PR_FALSE, m_composeHTML);
|
||||
@ -4608,14 +4628,38 @@ nsresult nsMsgCompose::SetSignature(nsIMsgIdentity *identity)
|
||||
|
||||
//Then add the new one if needed
|
||||
nsAutoString aSignature;
|
||||
ProcessSignature(identity, &aSignature);
|
||||
|
||||
// No delimiter needed if not a compose window
|
||||
PRBool noDelimiter;
|
||||
switch (mType)
|
||||
{
|
||||
case nsIMsgCompType::New :
|
||||
case nsIMsgCompType::NewsPost :
|
||||
case nsIMsgCompType::MailToUrl :
|
||||
case nsIMsgCompType::ForwardAsAttachment :
|
||||
noDelimiter = PR_FALSE;
|
||||
break;
|
||||
default :
|
||||
noDelimiter = PR_TRUE;
|
||||
break;
|
||||
}
|
||||
|
||||
ProcessSignature(identity, noDelimiter, &aSignature);
|
||||
|
||||
if (!aSignature.IsEmpty())
|
||||
{
|
||||
TranslateLineEnding(aSignature);
|
||||
|
||||
m_editor->BeginTransaction();
|
||||
m_editor->EndOfDocument();
|
||||
PRInt32 reply_on_top = 0;
|
||||
PRBool sig_bottom = PR_TRUE;
|
||||
identity->GetReplyOnTop(&reply_on_top);
|
||||
identity->GetSigBottom(&sig_bottom);
|
||||
PRBool sigOnTop = (reply_on_top == 1 && !sig_bottom);
|
||||
if (sigOnTop && noDelimiter)
|
||||
m_editor->BeginningOfDocument();
|
||||
else
|
||||
m_editor->EndOfDocument();
|
||||
if (m_composeHTML)
|
||||
{
|
||||
nsCOMPtr<nsIHTMLEditor> htmlEditor (do_QueryInterface(m_editor));
|
||||
@ -4626,6 +4670,8 @@ nsresult nsMsgCompose::SetSignature(nsIMsgIdentity *identity)
|
||||
nsCOMPtr<nsIPlaintextEditor> textEditor (do_QueryInterface(m_editor));
|
||||
rv = textEditor->InsertText(aSignature);
|
||||
}
|
||||
if (sigOnTop && noDelimiter)
|
||||
m_editor->EndOfDocument();
|
||||
m_editor->EndTransaction();
|
||||
}
|
||||
|
||||
|
@ -312,6 +312,7 @@ pref("mail.identity.default.directoryServer","");
|
||||
pref("mail.identity.default.overrideGlobal_Pref", false);
|
||||
pref("mail.identity.default.auto_quote", true);
|
||||
pref("mail.identity.default.reply_on_top", 0); // 0=bottom 1=top 2=select
|
||||
pref("mail.identity.default.sig_bottom", true); // true=below quoted false=above quoted
|
||||
// Headers to always add to outgoing mail
|
||||
// examples: "header1,header2"
|
||||
// pref("mail.identity.id1.headers", "header1");
|
||||
|
@ -312,6 +312,7 @@ pref("mail.identity.default.directoryServer","");
|
||||
pref("mail.identity.default.overrideGlobal_Pref", false);
|
||||
pref("mail.identity.default.auto_quote", true);
|
||||
pref("mail.identity.default.reply_on_top", 0); // 0=bottom 1=top 2=select
|
||||
pref("mail.identity.default.sig_bottom", true); // true=below quoted false=above quoted
|
||||
// Headers to always add to outgoing mail
|
||||
// examples: "header1,header2"
|
||||
// pref("mail.identity.id1.headers", "header1");
|
||||
|
Loading…
Reference in New Issue
Block a user