[Bug 399575] Modernize askSendFormat. p=��iga Sancin <bisi@pikslar.com>,

r=mnyromyr and me, sr=mscott
This commit is contained in:
mkmelin+mozilla%iki.fi 2007-12-31 09:17:21 +00:00
Родитель c31a3d29f4
Коммит 1cdf0781cc
11 изменённых файлов: 175 добавлений и 157 удалений

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

@ -3,23 +3,14 @@
<!ENTITY recipient.label "Some of the recipients are not listed as being able to receive HTML mail.">
<!ENTITY convertibleDefault.label "">
<!ENTITY convertibleYes.label "Your message can be converted to plain text without losing information.">
<!ENTITY convertibleAltering.label "Your message can be converted to plain text without losing important information. However, the plain text version might look different from what you saw in the composer.">
<!ENTITY convertibleNo.label "However, you used formatting (e.g. colors) that will not be converted to plain text.">
<!ENTITY question.label "Would you like to convert the message to plain text or send it in HTML anyway?">
<!ENTITY plainTextAndHtml.label "Send in Plain Text and HTML">
<!ENTITY plainTextAndHtml.accesskey "a">
<!ENTITY plainTextOnly.label "Send in Plain Text Only">
<!ENTITY plainTextOnly.accesskey "P">
<!ENTITY htmlOnly.label "Send in HTML Only">
<!ENTITY plainTextAndHtmlRecommended.label "Send in Plain Text and HTML (recommended)">
<!ENTITY plainTextOnlyRecommended.label "Send in Plain Text Only (recommended)">
<!ENTITY htmlOnlyRecommended.label "Send in HTML Only (recommended)">
<!ENTITY recommended.label "(recommended)">
<!ENTITY htmlOnly.accesskey "H">
<!ENTITY send.label "Send">
<!ENTITY cancel.label "Cancel">
<!ENTITY recipients.label "Recipients...">
<!ENTITY help.label "Help">
<!ENTITY send.accesskey "S">

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

@ -0,0 +1,4 @@
convertibleYes=Your message can be converted to plain text without losing information.
convertibleAltering=Your message can be converted to plain text without losing important information. However, the plain text version might look different from what you saw in the composer.
convertibleNo=However, you used formatting (e.g. colors) that will not be converted to plain text.
recommended=(recommended)

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

@ -101,6 +101,7 @@
locale/@AB_CD@/messenger/messengercompose/messengercompose.dtd (%chrome/messenger/messengercompose/messengercompose.dtd)
locale/@AB_CD@/messenger/messengercompose/addressingWidgetOverlay.dtd (%chrome/messenger/messengercompose/addressingWidgetOverlay.dtd)
locale/@AB_CD@/messenger/messengercompose/askSendFormat.dtd (%chrome/messenger/messengercompose/askSendFormat.dtd)
locale/@AB_CD@/messenger/messengercompose/askSendFormat.properties (%chrome/messenger/messengercompose/askSendFormat.properties)
locale/@AB_CD@/messenger/messengercompose/sendProgress.dtd (%chrome/messenger/messengercompose/sendProgress.dtd)
locale/@AB_CD@/messenger/messengercompose/sendProgress.properties (%chrome/messenger/messengercompose/sendProgress.properties)
locale/@AB_CD@/messenger/messengercompose/composeMsgs.properties (%chrome/messenger/messengercompose/composeMsgs.properties)

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

@ -78,10 +78,7 @@ menu.push[disabled="true"]:hover:active {
-moz-box-align: start;
}
#convertYes {
list-style-image:url("chrome://global/skin/icons/Question.png");
}
#convertYes,
#convertAltering {
list-style-image:url("chrome://global/skin/icons/Question.png");
}

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

@ -1,141 +1,168 @@
/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is mozilla.org code.
*
* The Initial Developer of the Original Code is
* Netscape Communications Corporation.
* Portions created by the Initial Developer are Copyright (C) 2000
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Jean-Francois Ducarroz <ducarroz@netscape.com>
* Ben Bucksch <mozilla.BenB@bucksch.org>
* Ian Neal <bugzilla@arlen.demon.co.uk>
* Žiga Sancin <bisi@pikslar.com>
*
* Alternatively, the contents of this file may be used under the terms of
* either of the GNU General Public License Version 2 or later (the "GPL"),
* or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
var msgCompSendFormat = Components.interfaces.nsIMsgCompSendFormat;
var msgCompConvertible = Components.interfaces.nsIMsgCompConvertible;
var param = null;
/* There is 3 preferences that let you customize the behavior of this dialog
/* There are 3 preferences that let you customize the behavior of this dialog
1. pref("mail.asksendformat.default", 1); //1=plaintext, 2=html, 3=both
This define the default action selected when the dialog open. This could be overwritten by the preference
mail.asksendformat.recommended_as_default (described here after)
This defines the default action selected when the dialog opens. It can be overwritten by the preference
mail.asksendformat.recommended_as_default
2. pref("mail.asksendformat.recommended_as_default", true);
If you set this preference to true and we have a recommended action, this action will be selected by default.
In this case, we ignore the preference mail.asksendformat.default
3. pref("mail.asksendformat.display_recommendation", true);
When this preference is set to false, the recommended action label will not be displayed next to the action
radio button. However, the default action might be change to the recommended one if the preference
radio button. However, the default action might change to the recommended one if the preference
mail.asksendformat.recommended_as_default is set.
*/
var defaultAction = msgCompSendFormat.PlainText;
var recommended_as_default = true;
var display_recommendation = true;
var useDefault =false;
var useDefault = false;
var prefs = Components.classes["@mozilla.org/preferences-service;1"].getService();
if (prefs) {
if (prefs)
{
prefs = prefs.QueryInterface(Components.interfaces.nsIPrefBranch);
if (prefs) {
try {
if (prefs)
{
try
{
defaultAction = prefs.getIntPref("mail.asksendformat.default");
useDefault = true;
} catch (ex) {}
try {
}
catch (ex) {}
try
{
recommended_as_default = prefs.getBoolPref("mail.asksendformat.recommended_as_default");
} catch (ex) {}
try {
}
catch (ex) {}
try
{
display_recommendation = prefs.getBoolPref("mail.asksendformat.display_recommendation");
} catch (ex) {}
}
catch (ex) {}
}
}
function Startup()
{
if (window.arguments && window.arguments[0])
{
{
var askSendFormatStringBundle = document.getElementById("askSendFormatStringBundle");
param = window.arguments[0];
param.abort = true; //if the user hit the close box, we will abort.
// If the user hits the close box, we will abort.
param.abort = true;
if (param.action)
{
// Set the question label
var labeldeck = document.getElementById("mailSendFormatExplanation");
var mailSendFormatExplanation = document.getElementById("mailSendFormatExplanation");
var icon = document.getElementById("convertDefault");
switch (param.convertible)
{
case msgCompConvertible.Plain:
// We shouldn't be here at all
labeldeck.setAttribute("selectedIndex", 1);
mailSendFormatExplanation.textContent = askSendFormatStringBundle.getString("convertibleYes");
// No icon
break;
case msgCompConvertible.Yes:
labeldeck.setAttribute("selectedIndex", 1);
mailSendFormatExplanation.textContent = askSendFormatStringBundle.getString("convertibleYes");
icon.setAttribute("id", "convertYes");
break;
case msgCompConvertible.Altering:
labeldeck.setAttribute("selectedIndex", 2);
mailSendFormatExplanation.textContent = askSendFormatStringBundle.getString("convertibleAltering");
icon.setAttribute("id", "convertAltering");
break;
case msgCompConvertible.No:
labeldeck.setAttribute("selectedIndex", 3);
mailSendFormatExplanation.textContent = askSendFormatStringBundle.getString("convertibleNo");
icon.setAttribute("id", "convertNo");
break;
}
// Set the default radio array value and recommendation
var group = document.getElementById("mailDefaultHTMLAction");
var recommlabels = document.getElementById("hiddenLabels");
var label;
var radio;
var radioButtons = group.getElementsByTagName("radio");
var haveRecommendation = false;
var format = (useDefault) ? defaultAction : param.action;
switch (format)
{
case msgCompSendFormat.AskUser:
//haveRecommendation = false;
// haveRecommendation = false;
break;
case msgCompSendFormat.PlainText:
//label = recommlabels.getAttribute("plainTextOnlyRecommendedLabel");
label = document.getElementById("plainTextOnlyRecommended");
// elements for "recommended" are a workaround for bug 49623
radio = radioButtons[1];
haveRecommendation = true;
break;
case msgCompSendFormat.Both:
//label = recommlabels.getAttribute("plainTextAndHtmlRecommendedLabel");
label = document.getElementById("plainTextAndHtmlRecommended");
radio = radioButtons[0];
haveRecommendation = true;
break;
case msgCompSendFormat.HTML:
//label = recommlabels.getAttribute("htmlOnlyRecommendedLabel");
label = document.getElementById("htmlOnlyRecommended");
radio = radioButtons[2];
haveRecommendation = true;
break;
}
if (haveRecommendation)
{
if (display_recommendation)
{
/*
dump(element.getAttribute("value"));
element.setAttribute("value", label);
element.setAttribute("value", "foo");
dump(element.getAttribute("value"));
*/
label.removeAttribute("hidden");
}
radio.label += " " + askSendFormatStringBundle.getString("recommended");
if (recommended_as_default)
{
group.value = format;
}
}
if (!haveRecommendation || !recommended_as_default)
{
group.value = defaultAction;
}
//change the button label
var buttonlabels = document.getElementById("hiddenLabels");
var sendButton = document.documentElement.getButton("accept");
sendButton.setAttribute("label", buttonlabels.getAttribute("sendLabel"));
/*
var recipientsButton = document.documentElement.getButton("disclosure");
recipientsButton.setAttribute("value", buttonlabels.getAttribute("recipientsLabel"));
recipientsButton.setAttribute("disabled", "true");
*/
if (!haveRecommendation || !recommended_as_default)
group.value = defaultAction;
}
}
else
@ -161,13 +188,3 @@ function Cancel()
param.abort = true;
return true;
}
function Recipients()
{
return false;
}
function Help()
{
return false;
}

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

@ -1,65 +1,81 @@
<?xml version="1.0"?><!-- -*- Mode: SGML; tab-width: 4; indent-tabs-mode: nil; -*- -->
<?xml version="1.0"?>
<!-- ***** BEGIN LICENSE BLOCK *****
- Version: MPL 1.1/GPL 2.0/LGPL 2.1
-
- The contents of this file are subject to the Mozilla Public License Version
- 1.1 (the "License"); you may not use this file except in compliance with
- the License. You may obtain a copy of the License at
- http://www.mozilla.org/MPL/
-
- Software distributed under the License is distributed on an "AS IS" basis,
- WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
- for the specific language governing rights and limitations under the
- License.
-
- The Original Code is mozilla.org code.
-
- The Initial Developer of the Original Code is
- Netscape Communications Corporation.
- Portions created by the Initial Developer are Copyright (C) 2000
- the Initial Developer. All Rights Reserved.
-
- Contributor(s):
- Jean-Francois Ducarroz <ducarroz@netscape.com>
- Ben Bucksch <mozilla.BenB@bucksch.org>
- Ian Neal <bugzilla@arlen.demon.co.uk>
- Žiga Sancin <bisi@pikslar.com>
-
- Alternatively, the contents of this file may be used under the terms of
- either of the GNU General Public License Version 2 or later (the "GPL"),
- or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
- in which case the provisions of the GPL or the LGPL are applicable instead
- of those above. If you wish to allow use of your version of this file only
- under the terms of either the GPL or the LGPL, and not to allow others to
- use your version of this file under the terms of the MPL, indicate your
- decision by deleting the provisions above and replace them with the notice
- and other provisions required by the GPL or the LGPL. If you do not delete
- the provisions above, a recipient may use your version of this file under
- the terms of any one of the MPL, the GPL or the LGPL.
-
- ***** END LICENSE BLOCK ***** -->
<?xml-stylesheet href="chrome://messenger/skin/dialogs.css" type="text/css"?>
<!DOCTYPE dialog SYSTEM "chrome://messenger/locale/messengercompose/askSendFormat.dtd">
<dialog id="askSendFormat"
title="&windowTitle.label;"
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
buttonpack="center"
onload="Startup()"
ondialogaccept="return Send();"
ondialogdisclosure="return Recipients();"
ondialoghelp="return Help();"
ondialogcancel="return Cancel();">
title="&windowTitle.label;"
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
buttonpack="center"
onload="Startup();"
ondialogaccept="return Send();"
ondialogcancel="return Cancel();"
buttonlabelaccept="&send.label;"
buttonaccesskeyaccept="&send.accesskey;">
<script type="application/x-javascript" src="chrome://messenger/content/messengercompose/askSendFormat.js"/>
<script type="application/javascript"
src="chrome://messenger/content/messengercompose/askSendFormat.js"/>
<spacer style="height:0.5em"/>
<stringbundle id="askSendFormatStringBundle"
src="chrome://messenger/locale/messengercompose/askSendFormat.properties"/>
<separator class="thin"/>
<hbox>
<spacer style="width:10px"/>
<vbox id="askImageBox">
<image id="convertDefault" />
</vbox>
<spacer style="width:10px"/>
<vbox flex="1">
<description>&recipient.label;</description>
<deck id="mailSendFormatExplanation">
<vbox><description>&convertibleDefault.label;</description></vbox> <!-- Hack: <vbox> is a workaround for bug 44513. -->
<vbox><description>&convertibleYes.label;</description></vbox>
<vbox><description>&convertibleAltering.label;</description></vbox>
<vbox><description>&convertibleNo.label;</description></vbox>
</deck>
<description>&question.label;</description>
<spacer style="height:1em"/>
<radiogroup id="mailDefaultHTMLAction">
<hbox>
<radio value="3" label="&plainTextAndHtml.label;"/>
<description id="plainTextAndHtmlRecommended" hidden="true" style="margin-top: 4px;">&recommended.label;</description>
<!-- Hack: box and html are workarounds for bug 49623 -->
</hbox>
<hbox>
<radio value="1" label="&plainTextOnly.label;"/>
<description id="plainTextOnlyRecommended" hidden="true" style="margin-top: 4px;">&recommended.label;</description>
</hbox>
<hbox>
<radio value="2" label="&htmlOnly.label;"/>
<description id="htmlOnlyRecommended" hidden="true" style="margin-top: 4px;">&recommended.label;</description>
</hbox>
</radiogroup>
</vbox>
<spacer style="width:10px"/>
<separator orient="vertical"/>
<vbox id="askImageBox">
<image id="convertDefault"/>
</vbox>
<separator orient="vertical"/>
<vbox flex="1">
<description>&recipient.label;</description>
<description id="mailSendFormatExplanation"/>
<description>&question.label;</description>
<separator/>
<radiogroup id="mailDefaultHTMLAction">
<radio value="3" label="&plainTextAndHtml.label;" accesskey="&plainTextAndHtml.accesskey;"/>
<radio value="1" label="&plainTextOnly.label;" accesskey="&plainTextOnly.accesskey;"/>
<radio value="2" label="&htmlOnly.label;" accesskey="&htmlOnly.accesskey;"/>
</radiogroup>
</vbox>
</hbox>
<data id="hiddenLabels"
sendLabel="&send.label;"
recipientsLabel="&recipients.label;"
plainTextAndHtmlRecommendedLabel="&plainTextAndHtmlRecommended.label;"
plainTextOnlyRecommendedLabel="&plainTextOnlyRecommended.label;"
htmlOnlyRecommendedLabel="&htmlOnlyRecommended.label;"
/>
</dialog>

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

@ -3,21 +3,14 @@
<!ENTITY recipient.label "Some of the recipients are not listed as being able to receive HTML mail.">
<!ENTITY convertibleDefault.label "">
<!ENTITY convertibleYes.label "Your message can be converted to plain text without losing information.">
<!ENTITY convertibleAltering.label "Your message can be converted to plain text without losing important information. However, the plain text version might look different from what you saw in the composer.">
<!ENTITY convertibleNo.label "However, you used formatting (e.g. colors) that will not be converted to plain text.">
<!ENTITY question.label "Would you like to convert the message to plain text or send it in HTML anyway?">
<!ENTITY plainTextAndHtml.label "Send in Plain Text and HTML">
<!ENTITY plainTextAndHtml.accesskey "a">
<!ENTITY plainTextOnly.label "Send in Plain Text Only">
<!ENTITY plainTextOnly.accesskey "P">
<!ENTITY htmlOnly.label "Send in HTML Only">
<!ENTITY plainTextAndHtmlRecommended.label "Send in Plain Text and HTML (recommended)">
<!ENTITY plainTextOnlyRecommended.label "Send in Plain Text Only (recommended)">
<!ENTITY htmlOnlyRecommended.label "Send in HTML Only (recommended)">
<!ENTITY recommended.label "(recommended)">
<!ENTITY htmlOnly.accesskey "H">
<!ENTITY send.label "Send">
<!ENTITY recipients.label "Recipients...">
<!ENTITY send.accesskey "S">

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

@ -0,0 +1,4 @@
convertibleYes=Your message can be converted to plain text without losing information.
convertibleAltering=Your message can be converted to plain text without losing important information. However, the plain text version might look different from what you saw in the composer.
convertibleNo=However, you used formatting (e.g. colors) that will not be converted to plain text.
recommended=(recommended)

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

@ -249,6 +249,7 @@
locale/@AB_CD@/messenger/messenger.properties (%chrome/mailnews/messenger.properties)
locale/@AB_CD@/messenger/messengercompose/addressingWidgetOverlay.dtd (%chrome/mailnews/compose/addressingWidgetOverlay.dtd)
locale/@AB_CD@/messenger/messengercompose/askSendFormat.dtd (%chrome/mailnews/compose/askSendFormat.dtd)
locale/@AB_CD@/messenger/messengercompose/askSendFormat.properties (%chrome/mailnews/compose/askSendFormat.properties)
locale/@AB_CD@/messenger/messengercompose/composeMsgs.properties (%chrome/mailnews/compose/composeMsgs.properties)
locale/@AB_CD@/messenger/messengercompose/mailComposeEditorOverlay.dtd (%chrome/mailnews/compose/mailComposeEditorOverlay.dtd)
locale/@AB_CD@/messenger/messengercompose/messengercompose.dtd (%chrome/mailnews/compose/messengercompose.dtd)

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

@ -75,10 +75,7 @@ menu.push[disabled="true"]:hover:active {
-moz-box-align: start;
}
#convertYes {
list-style-image:url("chrome://global/skin/icons/alert-question.gif");
}
#convertYes,
#convertAltering {
list-style-image:url("chrome://global/skin/icons/alert-question.gif");
}

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

@ -100,10 +100,7 @@ treecell.importsampledata {
-moz-box-align: start;
}
#convertYes {
list-style-image: url("chrome://global/skin/icons/alert-question.gif");
}
#convertYes,
#convertAltering {
list-style-image: url("chrome://global/skin/icons/alert-question.gif");
}