mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-16 14:55:47 +00:00
Added charset feedback UI and some localizability works, bug 20249, r=ducarroz.
This commit is contained in:
parent
c46c0ab7a8
commit
3ec5b20b44
@ -355,6 +355,7 @@ function SetDocumentCharacterSet(aCharset)
|
||||
if (msgCompose) {
|
||||
msgCompose.SetDocumentCharset(aCharset);
|
||||
currentMailSendCharset = aCharset;
|
||||
SetComposeWindowTitle(13);
|
||||
}
|
||||
else
|
||||
dump("Compose has not been created!\n");
|
||||
@ -431,6 +432,48 @@ function InitCharsetMenuCheckMark()
|
||||
SetDocumentCharacterSet(send_default_charset);
|
||||
}
|
||||
|
||||
function GetCharsetUIString()
|
||||
{
|
||||
try {
|
||||
prefs = Components.classes['component://netscape/preferences'];
|
||||
prefs = prefs.getService();
|
||||
prefs = prefs.QueryInterface(Components.interfaces.nsIPref);
|
||||
}
|
||||
catch (ex) {
|
||||
dump("failed to get prefs service!\n");
|
||||
prefs = null;
|
||||
}
|
||||
|
||||
var send_default_charset = prefs.CopyCharPref("mailnews.send_default_charset");
|
||||
var charset = msgCompose.compFields.GetCharacterSet();
|
||||
|
||||
charset = charset.toUpperCase();
|
||||
if (charset == "US-ASCII")
|
||||
charset = "ISO-8859-1";
|
||||
|
||||
if (charset != send_default_charset) {
|
||||
var charsetTitle = "";
|
||||
try {
|
||||
var ccm = Components.classes['component://netscape/charset-converter-manager'];
|
||||
ccm = ccm.getService();
|
||||
ccm = ccm.QueryInterface(Components.interfaces.nsICharsetConverterManager2);
|
||||
}
|
||||
catch (ex) {
|
||||
dump("failed to get charset-converter-manager service!\n");
|
||||
ccm = null;
|
||||
}
|
||||
|
||||
// get a localized string
|
||||
var charsetAtom = ccm.GetCharsetAtom(charset);
|
||||
charsetTitle = ccm.GetCharsetTitle(charsetAtom);
|
||||
dump(charsetTitle);
|
||||
|
||||
return " - " + charsetTitle;
|
||||
}
|
||||
|
||||
return "";
|
||||
}
|
||||
|
||||
function GenericSendMessage( msgType )
|
||||
{
|
||||
dump("GenericSendMessage from XUL\n");
|
||||
@ -748,11 +791,12 @@ function SetComposeWindowTitle(event)
|
||||
/* dump("newTitle = " + newTitle + "\n"); */
|
||||
|
||||
if (newTitle == "" ) {
|
||||
/* i18N todo: this should not be hard coded */
|
||||
newTitle = '(no subject)';
|
||||
newTitle = Bundle.GetStringFromName("defaultSubject");
|
||||
}
|
||||
/* i18N todo: this should not be hard coded, either */
|
||||
window.title = "Compose: "+ newTitle;
|
||||
|
||||
newTitle += GetCharsetUIString();
|
||||
|
||||
window.title = Bundle.GetStringFromName("windowTitlePrefix") + " " + newTitle;
|
||||
}
|
||||
|
||||
// Check for changes to document and allow saving before closing
|
||||
|
@ -176,3 +176,10 @@ saveDlogMessage=Message has not been Sent. Do you want to save the message in th
|
||||
saveDlogSaveBtn=Save
|
||||
saveDlogDontSaveBtn=Don't Save
|
||||
saveDlogCancelBtn=Cancel
|
||||
|
||||
##
|
||||
defaultSubject=(no subject)
|
||||
|
||||
##
|
||||
windowTitlePrefix=Compose:
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user