From 8f0d5cc4cfd143af11c961a2dad4a50fea4890ce Mon Sep 17 00:00:00 2001 From: "neil%parkwaycc.co.uk" Date: Tue, 12 Aug 2003 12:33:04 +0000 Subject: [PATCH] Bug 141531 move quote reply pref (reply below/above) to account settings p=bugzilla@arlen.demon.co.uk r=me sr=bienvenu a=asa git-svn-id: svn://10.0.0.236/trunk@145912 18797224-902f-48f8-a5cc-f745e15eee43 --- .../prefs/resources/content/accountUtils.js | 39 ++++++ .../prefs/resources/content/am-addressing.js | 16 +++ .../prefs/resources/content/am-addressing.xul | 32 +++++ .../base/prefs/resources/content/am-main.xul | 8 -- .../resources/locale/en-US/am-addressing.dtd | 18 ++- .../prefs/resources/locale/en-US/am-main.dtd | 2 - .../resources/locale/en-US/prefs.properties | 2 +- .../mailnews/base/public/nsIMsgIdentity.idl | 6 + mozilla/mailnews/base/util/nsMsgIdentity.cpp | 5 + .../content/pref-composing_messages.xul | 34 +---- .../locale/en-US/pref-composing_messages.dtd | 14 +-- mozilla/mailnews/compose/src/nsMsgCompose.cpp | 117 +++++++++--------- mozilla/mailnews/mailnews.js | 7 +- mozilla/modules/libpref/src/init/mailnews.js | 7 +- 14 files changed, 183 insertions(+), 124 deletions(-) diff --git a/mozilla/mailnews/base/prefs/resources/content/accountUtils.js b/mozilla/mailnews/base/prefs/resources/content/accountUtils.js index 04928d550eb..943f3a9004e 100644 --- a/mozilla/mailnews/base/prefs/resources/content/accountUtils.js +++ b/mozilla/mailnews/base/prefs/resources/content/accountUtils.js @@ -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); + } +} diff --git a/mozilla/mailnews/base/prefs/resources/content/am-addressing.js b/mozilla/mailnews/base/prefs/resources/content/am-addressing.js index dc1b6c0de20..96d16361ae7 100644 --- a/mozilla/mailnews/base/prefs/resources/content/am-addressing.js +++ b/mozilla/mailnews/base/prefs/resources/content/am-addressing.js @@ -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"); + } +} + diff --git a/mozilla/mailnews/base/prefs/resources/content/am-addressing.xul b/mozilla/mailnews/base/prefs/resources/content/am-addressing.xul index 226a52aaa06..fe764ca8712 100644 --- a/mozilla/mailnews/base/prefs/resources/content/am-addressing.xul +++ b/mozilla/mailnews/base/prefs/resources/content/am-addressing.xul @@ -47,6 +47,7 @@ Contributors: + &addressingText.label; @@ -61,4 +62,35 @@ Contributors: + + + + + + + + + + + + + + + + diff --git a/mozilla/mailnews/base/prefs/resources/content/am-main.xul b/mozilla/mailnews/base/prefs/resources/content/am-main.xul index 31fd3645458..7ad0fdf08c8 100644 --- a/mozilla/mailnews/base/prefs/resources/content/am-main.xul +++ b/mozilla/mailnews/base/prefs/resources/content/am-main.xul @@ -79,14 +79,6 @@ - - - - - -