Bug 141531 move quote reply pref (reply below/above) to account settings p=bugzilla@arlen.demon.co.uk r=me sr=bienvenu a=asa

This commit is contained in:
neil%parkwaycc.co.uk 2003-08-12 12:33:04 +00:00
Родитель 08560c4e86
Коммит 119060f0df
14 изменённых файлов: 183 добавлений и 124 удалений

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

@ -136,6 +136,9 @@ function verifyAccounts(wizardcallback) {
try {
var am = Components.classes[accountManagerContractID].getService(Components.interfaces.nsIMsgAccountManager);
// migrate quoting preferences from global to per account
migrateGlobalQuotingPrefs(am.allIdentities);
var accounts = am.accounts;
// as long as we have some accounts, we're fine.
@ -251,3 +254,39 @@ function loadInboxForNewAccount()
gNewAccountToLoad = null;
}
}
function migrateGlobalQuotingPrefs(allIdentities)
{
// if reply_on_top and auto_quote exist then, if non-default
// migrate and delete, if default just delete.
var reply_on_top = 0;
var auto_quote = true;
var quotingPrefs = 0;
try {
var prefService = Components.classes["@mozilla.org/preferences-service;1"]
.getService(Components.interfaces.nsIPrefService);
var pref = prefService.getBranch(null);
quotingPrefs = pref.getIntPref("mailnews.quotingPrefs.version");
} catch (ex) {}
// If the quotingPrefs version is 0 then we need to migrate our preferences
if (quotingPrefs == 0) {
try {
reply_on_top = pref.getIntPref("mailnews.reply_on_top");
auto_quote = pref.getBoolPref("mail.auto_quote");
} catch (ex) {}
if (!auto_quote || reply_on_top) {
var numIdentities = allIdentities.Count();
var identity = null;
for (var j = 0; j < numIdentities; j++) {
identity = allIdentities.QueryElementAt(j, Components.interfaces.nsIMsgIdentity);
if (identity.valid) {
identity.autoQuote = auto_quote;
identity.replyOnTop = reply_on_top;
}
}
}
pref.setIntPref("mailnews.quotingPrefs.version", 1);
}
}

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

@ -11,6 +11,7 @@ function onInit()
{
setupDirectoriesList();
enabling();
quoteEnabling();
}
function onPreInit(account, accountValues)
@ -101,3 +102,18 @@ function onSave()
break;
}
}
function quoteEnabling()
{
var quotebox = document.getElementById("thenBox");
var quotecheck = document.getElementById("identity.autoQuote");
if (quotecheck.checked && !quotecheck.disabled) {
quotebox.firstChild.removeAttribute("disabled");
quotebox.lastChild.removeAttribute("disabled");
}
else {
quotebox.firstChild.setAttribute("disabled", "true");
quotebox.lastChild.setAttribute("disabled", "true");
}
}

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

@ -47,6 +47,7 @@ Contributors:
<separator class="thin"/>
<groupbox>
<caption label="&addressingGroupTitle.label;"/>
<description>&addressingText.label;</description>
<radiogroup class="indent" id="ldapAutocomplete" wsm_persist="true" oncommand="enabling();">
<observes element="identity.overrideGlobalPref" attribute="disabled"/>
@ -61,4 +62,35 @@ Contributors:
</radiogroup>
</groupbox>
<separator class="thin"/>
<groupbox>
<caption label="&compositionGroupTitle.label;"/>
<hbox align="center">
<checkbox wsm_persist="true" id="identity.composeHtml" label="&useHtml.label;"
prefattribute="value"
prefstring="mail.identity.%identitykey%.compose_html"/>
</hbox>
<separator class="thin"/>
<hbox align="center">
<checkbox wsm_persist="true" id="identity.autoQuote" label="&autoQuote.label;"
oncommand="quoteEnabling();" accesskey="&autoQuote.accesskey;"
pref="true" preftype="bool" prefattribute="value"
prefstring="mail.identity.%identitykey%.auto_quote"/>
</hbox>
<hbox class="indent" align="center" id="thenBox">
<label value="&then.label;" accesskey="&then.accesskey;" control="quoteList"/>
<menulist wsm_persist="true" id="identity.replyOnTop"
pref="true" preftype="int" prefattribute="value"
prefstring="mail.identity.%identitykey%.reply_on_top">
<menupopup>
<menuitem value="1" label="&aboveQuote.label;" accesskey="&aboveQuote.accesskey;"/>
<menuitem value="0" label="&belowQuote.label;" accesskey="&belowQuote.accesskey;"/>
<menuitem value="2" label="&selectAndQuote.label;" accesskey="&selectAndQuote.accesskey;"/>
</menupopup>
</menulist>
</hbox>
</groupbox>
</page>

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

@ -79,14 +79,6 @@
<separator class="thin"/>
<hbox align="center">
<checkbox wsm_persist="true" id="identity.composeHtml" label="&useHtml.label;"
prefattribute="value"
prefstring="mail.identity.%identitykey%.compose_html"/>
</hbox>
<separator class="thin"/>
<hbox>
<spacer flex="1"/>
<button oncommand="onAdvanced();" label="&advancedButton.label;"

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

@ -1,6 +1,7 @@
<!-- extracted from am-addressing.xul -->
<!ENTITY addressing.label "Addressing">
<!ENTITY addressing.label "Addressing &amp; Composition">
<!ENTITY addressingGroupTitle.label "Addressing">
<!ENTITY addressingText.label "When looking up addresses:">
<!-- LOCALIZATION NOTE (override.label) : do not translate "LDAP" in below line -->
<!ENTITY useGlobal.label "Use my global LDAP server preferences for this account">
@ -12,3 +13,18 @@
<!-- LOCALIZATION NOTE : this is part of an inline-style attribute on the directoriesList
drop down List box, which specifies the width of the dropdown listbox. -->
<!ENTITY directoriesList.width "512">
<!ENTITY compositionGroupTitle.label "Composition">
<!-- LOCALIZATION NOTE (useHtml.label) : do not translate "html" in below line -->
<!ENTITY useHtml.label "Compose messages in HTML format">
<!ENTITY autoQuote.label "Automatically quote the original message when replying">
<!ENTITY autoQuote.accesskey "A">
<!-- LOCALIZATION NOTE (then.label): This will concatenate with the 4 strings that follow. -->
<!ENTITY then.label "Then,">
<!ENTITY then.accesskey "t">
<!ENTITY aboveQuote.label "start my reply above the quoted text">
<!ENTITY aboveQuote.accesskey "v">
<!ENTITY belowQuote.label "start my reply below the quoted text">
<!ENTITY belowQuote.accesskey "b">
<!ENTITY selectAndQuote.label "select the quoted text">
<!ENTITY selectAndQuote.accesskey "e">

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

@ -18,8 +18,6 @@
<!ENTITY sampleSig1.label "Sample Signature 1">
<!ENTITY sampleSig2.label "Sample Signature 2">
<!ENTITY sampleSig3.label "Sample Signature 3">
<!-- LOCALIZATION NOTE (useHtml.label) : do not translate "html" in below line -->
<!ENTITY useHtml.label "Compose messages in HTML format">
<!-- LOCALIZATION NOTE (attachVCard.label) : do not translate "vCard" in below line -->
<!ENTITY attachVCard.label "Attach my vCard to messages">
<!ENTITY advancedButton.label "Advanced...">

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

@ -63,7 +63,7 @@ prefPanel-server=Server Settings
prefPanel-copies=Copies & Folders
prefPanel-offline-and-diskspace=Offline & Disk Space
prefPanel-diskspace=Disk Space
prefPanel-addressing=Addressing
prefPanel-addressing=Addressing & Composition
prefPanel-advanced=Advanced
## LOCALIZATION NOTE (prefPanel-smtp): Don't translate "SMTP"
prefPanel-smtp=Outgoing Server (SMTP)

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

@ -82,6 +82,12 @@ interface nsIMsgIdentity : nsISupports {
/* should we attach a vcard by default? */
attribute boolean attachVCard;
/* should we automatically quote the original message? */
attribute boolean autoQuote;
/* what should our quoting preference be? */
attribute long replyOnTop;
/* the current signature */
/* after PR1, let's make this a real object */
/* attribute nsIMsgSignature signature; */

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

@ -461,6 +461,9 @@ NS_IMPL_IDPREF_BOOL(ComposeHtml, "compose_html");
NS_IMPL_IDPREF_BOOL(AttachVCard, "attach_vcard");
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_INT(SignatureDate,"sig_date");
NS_IMPL_IDPREF_BOOL(DoFcc, "fcc");
@ -789,6 +792,8 @@ nsMsgIdentity::Copy(nsIMsgIdentity *identity)
COPY_IDENTITY_STR_VALUE(identity,GetStationeryFolder,SetStationeryFolder)
COPY_IDENTITY_BOOL_VALUE(identity,GetAttachSignature,SetAttachSignature)
COPY_IDENTITY_FILE_VALUE(identity,GetSignature,SetSignature)
COPY_IDENTITY_BOOL_VALUE(identity,GetAutoQuote,SetAutoQuote)
COPY_IDENTITY_INT_VALUE(identity,GetReplyOnTop,SetReplyOnTop)
COPY_IDENTITY_INT_VALUE(identity,GetSignatureDate,SetSignatureDate)
return NS_OK;

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

@ -15,7 +15,7 @@
<script type="application/x-javascript">
<![CDATA[
var _elementIDs = ["forwardMessageMode", "autoQuote", "replyOnTop", "spellCheckBeforeSend", "strictlyMime",
var _elementIDs = ["forwardMessageMode", "spellCheckBeforeSend", "strictlyMime",
"wrapLength", "sendDefaultCharsetList", "mailWarnOnSendAccelKey",
"FontSelect", "fontSizeSelect", "textColor", "backgroundColor"];
var observerService = Components.classes["@mozilla.org/observer-service;1"].getService(Components.interfaces.nsIObserverService);
@ -28,22 +28,6 @@
getColorFromWellAndSetValue("textColorButton");
getColorFromWellAndSetValue("backgroundColorButton");
doEnabling();
}
function doEnabling()
{
var quotebox = document.getElementById("thenBox");
var quotecheck = document.getElementById("autoQuote");
if( quotecheck.checked && !quotecheck.disabled ) {
quotebox.firstChild.removeAttribute("disabled");
quotebox.lastChild.removeAttribute("disabled");
}
else {
quotebox.firstChild.setAttribute("disabled","true");
quotebox.lastChild.setAttribute("disabled","true");
}
}
function setColorWell(aPicker)
@ -93,22 +77,6 @@
</menupopup>
</menulist>
</hbox>
<hbox align="center">
<checkbox id="autoQuote" label="&autoQuote.label;"
prefstring="mail.auto_quote"
oncommand="doEnabling();"
accesskey="&autoQuote.accesskey;"/>
</hbox>
<hbox class="indent" align="center" id="thenBox">
<label value="&then.label;" accesskey="&then.accesskey;" control="replyOnTop"/>
<menulist id="replyOnTop" preftype="int" prefstring="mailnews.reply_on_top">
<menupopup>
<menuitem value="1" label="&aboveQuote.label;" accesskey="&aboveQuote.accesskey;"/>
<menuitem value="0" label="&belowQuote.label;" accesskey="&belowQuote.accesskey;"/>
<menuitem value="2" label="&selectAndQuote.label;" accesskey="&selectAndQuote.accesskey;"/>
</menupopup>
</menulist>
</hbox>
</groupbox>
<!-- Composing Mail -->

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

@ -20,7 +20,7 @@ Rights Reserved.
<!ENTITY pane.title "Composition">
<!ENTITY pane.description "Composing mail messages">
<!ENTITY forwardReply.label "Forwarding and Replying to Messages">
<!ENTITY forwardReply.label "Forwarding Messages">
<!ENTITY forwardMsg.label "Forward messages:">
<!ENTITY forwardMsg.accesskey "f">
<!ENTITY inline.label "Inline">
@ -29,17 +29,7 @@ Rights Reserved.
<!ENTITY quoted.accesskey "q">
<!ENTITY asAttachment.label "As Attachment">
<!ENTITY asAttachment.accesskey "A">
<!ENTITY autoQuote.label "Automatically quote the original message when replying">
<!ENTITY autoQuote.accesskey "A">
<!-- LOCALIZATION NOTE (then.label): This will concatenate with the 4 strings that follow. -->
<!ENTITY then.label "Then,">
<!ENTITY then.accesskey "t">
<!ENTITY aboveQuote.label "start my reply above the quoted text">
<!ENTITY aboveQuote.accesskey "v">
<!ENTITY belowQuote.label "start my reply below the quoted text">
<!ENTITY belowQuote.accesskey "b">
<!ENTITY selectAndQuote.label "select the quoted text">
<!ENTITY selectAndQuote.accesskey "e">
<!ENTITY warnOnSendAccelKey.label "Confirm when using keyboard shortcut to send message">
<!ENTITY warnOnSendAccelKey.accesskey "C">

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

@ -119,15 +119,6 @@
// Defines....
static NS_DEFINE_CID(kDateTimeFormatCID, NS_DATETIMEFORMAT_CID);
static PRInt32 GetReplyOnTop()
{
PRInt32 reply_on_top = 1;
nsCOMPtr<nsIPref> prefs (do_GetService(NS_PREF_CONTRACTID));
if (prefs)
prefs->GetIntPref("mailnews.reply_on_top", &reply_on_top);
return reply_on_top;
}
static nsresult GetReplyHeaderInfo(PRInt32* reply_header_type,
PRUnichar** reply_header_locale,
PRUnichar** reply_header_authorwrote,
@ -586,59 +577,63 @@ nsMsgCompose::ConvertAndLoadComposeWindow(nsString& aPrefix,
if (aBuf.IsEmpty())
m_editor->BeginningOfDocument();
else
switch (GetReplyOnTop())
{
// This should set the cursor after the body but before the sig
case 0 :
{
PRInt32 reply_on_top = 0;
m_identity->GetReplyOnTop(&reply_on_top);
switch (reply_on_top)
{
if (!textEditor)
// This should set the cursor after the body but before the sig
case 0 :
{
m_editor->BeginningOfDocument();
if (!textEditor)
{
m_editor->BeginningOfDocument();
break;
}
nsCOMPtr<nsISelection> selection = nsnull;
nsCOMPtr<nsIDOMNode> parent = nsnull;
PRInt32 offset;
nsresult rv;
// get parent and offset of mailcite
rv = GetNodeLocation(nodeInserted, address_of(parent), &offset);
if (NS_FAILED(rv) || (!parent))
{
m_editor->BeginningOfDocument();
break;
}
// get selection
m_editor->GetSelection(getter_AddRefs(selection));
if (!selection)
{
m_editor->BeginningOfDocument();
break;
}
// place selection after mailcite
selection->Collapse(parent, offset+1);
// insert a break at current selection
textEditor->InsertLineBreak();
// i'm not sure if you need to move the selection back to before the
// break. expirement.
selection->Collapse(parent, offset+1);
break;
}
nsCOMPtr<nsISelection> selection = nsnull;
nsCOMPtr<nsIDOMNode> parent = nsnull;
PRInt32 offset;
nsresult rv;
// get parent and offset of mailcite
rv = GetNodeLocation(nodeInserted, address_of(parent), &offset);
if (NS_FAILED(rv) || (!parent))
{
m_editor->BeginningOfDocument();
break;
}
// get selection
m_editor->GetSelection(getter_AddRefs(selection));
if (!selection)
{
m_editor->BeginningOfDocument();
break;
}
// place selection after mailcite
selection->Collapse(parent, offset+1);
// insert a break at current selection
textEditor->InsertLineBreak();
// i'm not sure if you need to move the selection back to before the
// break. expirement.
selection->Collapse(parent, offset+1);
case 2 :
{
m_editor->SelectAll();
break;
}
case 2 :
{
m_editor->SelectAll();
break;
// This should set the cursor to the top!
default : m_editor->BeginningOfDocument(); break;
}
// This should set the cursor to the top!
default : m_editor->BeginningOfDocument(); break;
}
nsCOMPtr<nsISelectionController> selCon;
@ -1724,7 +1719,9 @@ QuotingOutputStreamListener::QuotingOutputStreamListener(const char * originalMs
}
}
if (GetReplyOnTop() == 1)
PRInt32 reply_on_top = 0;
mIdentity->GetReplyOnTop(&reply_on_top);
if (reply_on_top == 1)
mCitePrefix += NS_LITERAL_STRING("<br><br>");
@ -2414,9 +2411,7 @@ nsMsgCompose::QuoteOriginalMessage(const char *originalMsgURI, PRInt32 what) //
return NS_ERROR_FAILURE;
PRBool bAutoQuote = PR_TRUE;
nsCOMPtr<nsIPref> prefs (do_GetService(NS_PREF_CONTRACTID));
if (prefs)
prefs->GetBoolPref("mail.auto_quote", &bAutoQuote);
m_identity->GetAutoQuote(&bAutoQuote);
// Create the consumer output stream.. this will receive all the HTML from libmime
mQuoteStreamListener =
@ -3232,8 +3227,8 @@ nsMsgCompose::ProcessSignature(nsIMsgIdentity *identity, nsString *aMsgBody)
// for all sorts of user defined stuff, like signatures and editor
// types and the like!
//
// user_pref(".....signature_file", "y:\\sig.html");
// user_pref(".....use_signature_file", true);
// user_pref(".....sig_file", "y:\\sig.html");
// user_pref(".....attach_signature", true);
//
// Note: We will have intelligent signature behavior in that we
// look at the signature file first...if the extension is .htm or

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

@ -107,7 +107,6 @@ pref("mail.check_time", 10);
pref("mail.pop_name", "");
pref("mail.remember_password", false);
pref("mail.pop_password", "");
pref("mail.auto_quote", true);
pref("mail.fixed_width_messages", true);
pref("mail.citation_color", ""); // quoted color
pref("mail.quoted_style", 0); // 0=plain, 1=bold, 2=italic, 3=bolditalic
@ -174,8 +173,6 @@ pref("news.mark_old_read", false);
pref("mailnews.wraplength", 72);
pref("mail.compose.wrap_to_window_width", false);
pref("mailnews.reply_on_top", 0); // 0=bottom 1=top 2=select+bottom 3=select+top
// 0=no header, 1="<author> wrote:", 2="On <date> <author> wrote:", 3="<author> wrote On <date>:", 4=user specified
pref("mailnews.reply_header_type", 1);
// locale which affects date format, set empty string to use application default locale
@ -206,6 +203,8 @@ pref("mailnews.search_date_separator", "chrome://messenger/locale/messenger.
pref("mailnews.language_sensitive_font", true);
pref("mailnews.quotingPrefs.version", 0); // used to decide whether to migrate global quoting prefs
pref("offline.news.download.unread_only", true);
pref("offline.news.download.by_date", true);
pref("offline.news.download.days", 30); // days
@ -311,6 +310,8 @@ pref("mail.identity.default.draft_folder","mailbox://nobody@Local%20Folders/Draf
pref("mail.identity.default.stationery_folder","mailbox://nobody@Local%20Folders/Templates");
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
// Headers to always add to outgoing mail
// examples: "header1,header2"
// pref("mail.identity.id1.headers", "header1");

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

@ -107,7 +107,6 @@ pref("mail.check_time", 10);
pref("mail.pop_name", "");
pref("mail.remember_password", false);
pref("mail.pop_password", "");
pref("mail.auto_quote", true);
pref("mail.fixed_width_messages", true);
pref("mail.citation_color", ""); // quoted color
pref("mail.quoted_style", 0); // 0=plain, 1=bold, 2=italic, 3=bolditalic
@ -174,8 +173,6 @@ pref("news.mark_old_read", false);
pref("mailnews.wraplength", 72);
pref("mail.compose.wrap_to_window_width", false);
pref("mailnews.reply_on_top", 0); // 0=bottom 1=top 2=select+bottom 3=select+top
// 0=no header, 1="<author> wrote:", 2="On <date> <author> wrote:", 3="<author> wrote On <date>:", 4=user specified
pref("mailnews.reply_header_type", 1);
// locale which affects date format, set empty string to use application default locale
@ -206,6 +203,8 @@ pref("mailnews.search_date_separator", "chrome://messenger/locale/messenger.
pref("mailnews.language_sensitive_font", true);
pref("mailnews.quotingPrefs.version", 0); // used to decide whether to migrate global quoting prefs
pref("offline.news.download.unread_only", true);
pref("offline.news.download.by_date", true);
pref("offline.news.download.days", 30); // days
@ -311,6 +310,8 @@ pref("mail.identity.default.draft_folder","mailbox://nobody@Local%20Folders/Draf
pref("mail.identity.default.stationery_folder","mailbox://nobody@Local%20Folders/Templates");
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
// Headers to always add to outgoing mail
// examples: "header1,header2"
// pref("mail.identity.id1.headers", "header1");