178328 - combine bcc settings in mail account manager copies and folders panel. r=cavin, sr=sspitzer.

This commit is contained in:
shliang%netscape.com 2003-03-26 01:54:29 +00:00
Родитель d8caa04d2a
Коммит 088d5783b7
7 изменённых файлов: 116 добавлений и 83 удалений

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

@ -60,9 +60,10 @@ function onInit() {
tmplAccountPickerId,
"identity.stationeryFolder",
tmplFolderPickerId);
initBccSelf();
setupBccTextbox();
setupFccItems();
setupBCCTextbox();
SetSpecialFolderNamesWithDelims();
}
@ -164,29 +165,6 @@ function InitFolderDisplay(fieldname, pickerId) {
SetFolderPicker(uri,pickerId);
}
function initBccSelf() {
var bccValue = document.getElementById("identity.email").getAttribute("value");
setDivText("identity.bccSelf",bccValue);
}
function setDivText(divid, str) {
var divtag = document.getElementById(divid);
var newstr="";
if (divtag) {
if (divtag.getAttribute("before"))
newstr += divtag.getAttribute("before");
newstr += str;
if (divtag.getAttribute("after"))
newstr += divtag.getAttribute("after");
divtag.setAttribute("label", newstr);
}
}
// Capture any menulist changes
function noteSelectionChange(radioItemId)
{
@ -325,12 +303,12 @@ function setupFccItems()
}
// Disable BCC textbox if BCC checkbox is not checked
function setupBCCTextbox()
function setupBccTextbox()
{
var BCCChecked = document.getElementById("identity.bccOthers").checked;
var BCCTextbox = document.getElementById("identity.bccList");
var bccChecked = document.getElementById("identity.doBcc").checked;
var bccTextbox = document.getElementById("identity.doBccList");
BCCTextbox.disabled = !BCCChecked;
bccTextbox.disabled = !bccChecked;
}
// Set up picker settings for Sent Folder

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

@ -29,7 +29,6 @@
pref="true" preftype="string" prefattribute="value"
prefstring="mail.identity.%identitykey%.stationary_folder"/>
<label hidden="true" wsm_persist="true" id="identity.email"/>
<label hidden="true" wsm_persist="true" id="identity.fccFolderPickerMode"
pref="true" preftype="int" prefattribute="value"
prefstring="mail.identity.%identitykey%.fcc_folder_picker_mode"/>
@ -81,20 +80,13 @@
</radiogroup>
<hbox align="center">
<checkbox wsm_persist="true" id="identity.bccSelf"
before="&bccAccount.label; &lt;" after="&gt;"
prefattribute="value" flex="1"
prefstring="mail.identity.%identitykey%.bcc_self"/>
</hbox>
<hbox align="center">
<checkbox wsm_persist="true" id="identity.bccOthers" label="&bccAddress.label;"
oncommand="setupBCCTextbox();"
<checkbox wsm_persist="true" id="identity.doBcc" label="&bccAddress.label;"
oncommand="setupBccTextbox();"
prefattribute="value"
prefstring="mail.identity.%identitykey%.bcc_other"/>
prefstring="mail.identity.%identitykey%.doBcc"/>
<textbox wsm_persist="true" id="identity.bccList" flex="1"
prefstring="mail.identity.%identitykey%.bcc_other_list" class="uri-element"/>
<textbox wsm_persist="true" id="identity.doBccList" flex="1"
prefstring="mail.identity.%identitykey%.doBccList" class="uri-element"/>
</hbox>
</groupbox>

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

@ -4,10 +4,8 @@
<!ENTITY sendingPrefix.label "When sending messages, automatically: ">
<!ENTITY fccMailFolder.label "Place a copy in:">
<!ENTITY chooseFolderButton.label "Choose Folder...">
<!-- LOCALIZATION NOTE (bccAccount.label): do not translate "Bcc" in below line -->
<!ENTITY bccAccount.label "Bcc ">
<!-- LOCALIZATION NOTE (bccAddress.label): do not translate "Bcc" in below line -->
<!ENTITY bccAddress.label "Bcc another address:">
<!ENTITY bccAddress.label "Bcc these email addresses:">
<!ENTITY specialFolderTitle.label "Special Folders">
<!ENTITY draftMailFolder.label "Keep message drafts in:">
<!ENTITY templateMailFolder.label "Keep message templates in:">

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

@ -98,10 +98,17 @@ interface nsIMsgIdentity : nsISupports {
attribute string draftsFolderPickerMode;
attribute string tmplFolderPickerMode;
// Don't call bccSelf, bccOthers, and bccList directly, they are
// only used for migration and backward compatability. Use doBcc
// and doBccList instead.
attribute boolean bccSelf;
attribute boolean bccOthers;
attribute string bccList;
attribute boolean doBcc;
attribute string doBccList;
attribute string draftFolder;
attribute string stationeryFolder;
attribute boolean showSaveMsgDlg;

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

@ -474,6 +474,92 @@ NS_IMPL_IDPREF_BOOL(BccSelf, "bcc_self");
NS_IMPL_IDPREF_BOOL(BccOthers, "bcc_other");
NS_IMPL_IDPREF_STR (BccList, "bcc_other_list");
NS_IMETHODIMP
nsMsgIdentity::GetDoBcc(PRBool *aValue)
{
nsresult rv = getPrefService();
NS_ENSURE_SUCCESS(rv,rv);
char *prefName = getPrefName(m_identityKey, "doBcc");
rv = m_prefBranch->GetBoolPref(prefName, aValue);
PR_Free(prefName);
if (NS_SUCCEEDED(rv))
return GetBoolAttribute("doBcc", aValue);
PRBool bccSelf = PR_FALSE;
rv = GetBccSelf(&bccSelf);
NS_ENSURE_SUCCESS(rv,rv);
PRBool bccOthers = PR_FALSE;
rv = GetBccOthers(&bccOthers);
NS_ENSURE_SUCCESS(rv,rv);
nsXPIDLCString others;
rv = GetBccList(getter_Copies(others));
NS_ENSURE_SUCCESS(rv,rv);
*aValue = bccSelf || (bccOthers && !others.IsEmpty());
return SetDoBcc(*aValue);
}
NS_IMETHODIMP
nsMsgIdentity::SetDoBcc(PRBool aValue)
{
return SetBoolAttribute("doBcc", aValue);
}
NS_IMETHODIMP
nsMsgIdentity::GetDoBccList(char **aValue)
{
nsresult rv = getPrefService();
NS_ENSURE_SUCCESS(rv,rv);
char *prefName = getPrefName(m_identityKey, "doBccList");
rv = m_prefBranch->GetCharPref(prefName, aValue);
PR_Free(prefName);
if (NS_SUCCEEDED(rv))
return GetCharAttribute("doBccList", aValue);
nsCAutoString result;
PRBool bccSelf = PR_FALSE;
rv = GetBccSelf(&bccSelf);
NS_ENSURE_SUCCESS(rv,rv);
if (bccSelf) {
nsXPIDLCString email;
GetEmail(getter_Copies(email));
result += email;
}
PRBool bccOthers = PR_FALSE;
rv = GetBccOthers(&bccOthers);
NS_ENSURE_SUCCESS(rv,rv);
nsXPIDLCString others;
rv = GetBccList(getter_Copies(others));
NS_ENSURE_SUCCESS(rv,rv);
if (bccOthers && !others.IsEmpty()) {
if (bccSelf)
result += ",";
result += others;
}
*aValue = ToNewCString(result);
return SetDoBccList(*aValue);
}
NS_IMETHODIMP
nsMsgIdentity::SetDoBccList(const char *aValue)
{
return SetCharAttribute("doBccList", aValue);
}
NS_IMPL_FOLDERPREF_STR (DraftFolder, "draft_folder");
NS_IMPL_FOLDERPREF_STR (StationeryFolder, "stationery_folder");

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

@ -2387,26 +2387,15 @@ function LoadIdentity(startup)
var prevReplyTo = prevIdentity.replyTo;
var prevBcc = "";
var prevReceipt = prevIdentity.requestReturnReceipt;
if (prevIdentity.bccSelf)
prevBcc += prevIdentity.email;
if (prevIdentity.bccOthers)
{
if (prevBcc != "")
prevBcc += ","
prevBcc += prevIdentity.bccList;
}
if (prevIdentity.doBcc)
prevBcc += prevIdentity.doBccList;
var newReplyTo = gCurrentIdentity.replyTo;
var newBcc = "";
var newReceipt = gCurrentIdentity.requestReturnReceipt;
if (gCurrentIdentity.bccSelf)
newBcc += gCurrentIdentity.email;
if (gCurrentIdentity.bccOthers)
{
if (newBcc != "")
newBcc += ","
newBcc += gCurrentIdentity.bccList;
}
if (gCurrentIdentity.doBcc)
newBcc += gCurrentIdentity.doBccList;
var needToCleanUp = false;
var msgCompFields = gMsgCompose.compFields;

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

@ -1412,41 +1412,24 @@ nsresult nsMsgCompose::CreateMessage(const char * originalMsgURI,
}
/* Setup bcc field */
PRBool bccSelf, bccOthers;
m_identity->GetBccSelf(&bccSelf);
m_identity->GetBccOthers(&bccOthers);
if (bccSelf || bccOthers)
PRBool doBcc;
m_identity->GetDoBcc(&doBcc);
if (doBcc)
{
nsXPIDLCString bccStr;
bccStr.Assign(m_compFields->GetBcc());
if (bccSelf)
{
bccStr.BeginReading(start);
bccStr.EndReading(end);
nsXPIDLCString email;
m_identity->GetEmail(getter_Copies(email));
if (FindInReadable(email, start, end) == PR_FALSE) {
if (bccStr.Length() > 0)
bccStr.Append(',');
bccStr.Append(email);
}
}
if (bccOthers)
{
bccStr.BeginReading(start);
bccStr.EndReading(end);
nsXPIDLCString bccList;
m_identity->GetBccList(getter_Copies(bccList));
m_identity->GetDoBccList(getter_Copies(bccList));
if (FindInReadable(bccList, start, end) == PR_FALSE) {
if (bccStr.Length() > 0)
bccStr.Append(',');
bccStr.Append(bccList);
}
}
m_compFields->SetBcc(bccStr.get());
}
}