Bug 688860 - Cannot switch spell check language with multiple compose windows open. r=Standard8

This commit is contained in:
Jesper Kristensen 2011-11-29 20:20:22 +00:00
Родитель f8265617d4
Коммит d25dc606fd
3 изменённых файлов: 10 добавлений и 24 удалений

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

@ -561,13 +561,7 @@ function ExitSpellChecker()
{
try
{
var curLang = gSpellChecker.GetCurrentDictionary();
gSpellChecker.UninitSpellChecker();
if ("@mozilla.org/spellchecker;1" in Components.classes) {
var spellChecker = Components.classes["@mozilla.org/spellchecker/engine;1"]
.getService(Components.interfaces.mozISpellCheckingEngine);
spellChecker.dictionary = curLang;
}
// now check the document over again with the new dictionary
// if we have an inline spellchecker
if (("InlineSpellCheckerUI" in window.opener) &&

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

@ -2541,7 +2541,8 @@ function InitLanguageMenu()
function OnShowDictionaryMenu(aTarget)
{
InitLanguageMenu();
var curLang = getPref("spellchecker.dictionary", true);
var spellChecker = gSpellChecker.mInlineSpellChecker.spellChecker;
var curLang = spellChecker.GetCurrentDictionary();
var languages = aTarget.getElementsByAttribute("value", curLang);
if (languages.length > 0)
languages[0].setAttribute("checked", true);
@ -2552,18 +2553,10 @@ function ChangeLanguage(event)
// We need to change the dictionary language and if we are using inline spell check,
// recheck the message
var spellChecker = Components.classes['@mozilla.org/spellchecker/engine;1']
.getService(mozISpellCheckingEngine);
if (spellChecker.dictionary != event.target.value)
var spellChecker = gSpellChecker.mInlineSpellChecker.spellChecker;
if (spellChecker.GetCurrentDictionary() != event.target.value)
{
spellChecker.dictionary = event.target.value;
var str = Components.classes["@mozilla.org/supports-string;1"]
.createInstance(nsISupportsString);
str.data = event.target.value;
var branch = Components.classes["@mozilla.org/preferences-service;1"]
.getService(Components.interfaces.nsIPrefBranch);
branch.setComplexValue("spellchecker.dictionary", nsISupportsString, str);
spellChecker.SetCurrentDictionary(event.target.value);
// now check the document over again with the new dictionary
if (gSpellChecker.enabled)

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

@ -2204,7 +2204,8 @@ function InitLanguageMenu()
function OnShowDictionaryMenu(aTarget)
{
InitLanguageMenu();
var curLang = GetStringPref("spellchecker.dictionary");
var spellChecker = gSpellChecker.mInlineSpellChecker.spellChecker;
var curLang = spellChecker.GetCurrentDictionary();
var languages = aTarget.getElementsByAttribute("value", curLang);
if (languages.length > 0)
languages[0].setAttribute("checked", true);
@ -2215,12 +2216,10 @@ function ChangeLanguage(event)
// We need to change the dictionary language and if we are using inline spell check,
// recheck the message
var spellChecker = Components.classes["@mozilla.org/spellchecker/engine;1"]
.getService(mozISpellCheckingEngine);
if (spellChecker.dictionary != event.target.value)
var spellChecker = gSpellChecker.mInlineSpellChecker.spellChecker;
if (spellChecker.GetCurrentDictionary() != event.target.value)
{
spellChecker.dictionary = event.target.value;
SetStringPref("spellchecker.dictionary", event.target.value);
spellChecker.SetCurrentDictionary(event.target.value);
// now check the document and the subject over again with the new dictionary
if (InlineSpellCheckerUI.enabled)