Bug #378795 --> When the user installs a dictionary for the first time, we don't automatically use it for inline spell check. The user must manually choose the dictionary.sr=neil

This commit is contained in:
scott@scott-macgregor.org 2007-04-27 11:42:09 -07:00
parent a42fbeb92f
commit f27f31f117

View File

@ -182,19 +182,16 @@ nsEditorSpellCheck::InitSpellChecker(nsIEditor* aEditor, PRBool aEnableSelection
nsCOMPtr<nsIPrefBranch> prefBranch = nsCOMPtr<nsIPrefBranch> prefBranch =
do_GetService(NS_PREFSERVICE_CONTRACTID, &rv); do_GetService(NS_PREFSERVICE_CONTRACTID, &rv);
PRBool hasPreference = PR_FALSE;
if (NS_SUCCEEDED(rv) && prefBranch) { if (NS_SUCCEEDED(rv) && prefBranch) {
nsCOMPtr<nsISupportsString> prefString; nsCOMPtr<nsISupportsString> prefString;
rv = prefBranch->GetComplexValue("spellchecker.dictionary", rv = prefBranch->GetComplexValue("spellchecker.dictionary",
NS_GET_IID(nsISupportsString), NS_GET_IID(nsISupportsString),
getter_AddRefs(prefString)); getter_AddRefs(prefString));
if (NS_SUCCEEDED(rv) && prefString) { if (NS_SUCCEEDED(rv) && prefString)
hasPreference = PR_TRUE; prefString->GetData(dictName);
prefString->ToString(getter_Copies(dictName));
}
} }
if (! hasPreference || dictName.IsEmpty()) if (dictName.IsEmpty())
{ {
// Prefs didn't give us a dictionary name, so just get the current // Prefs didn't give us a dictionary name, so just get the current
// locale and use that as the default dictionary name! // locale and use that as the default dictionary name!
@ -217,13 +214,10 @@ nsEditorSpellCheck::InitSpellChecker(nsIEditor* aEditor, PRBool aEnableSelection
setDictionary = PR_TRUE; setDictionary = PR_TRUE;
} }
// If there was no preference and setting it to the locale dictionary didn't // If there was no dictionary specified by spellchecker.dictionary and setting it to the
// work, try to use the first dictionary we find. This helps when the first // locale dictionary didn't work, try to use the first dictionary we find. This helps when
// dictionary is installed - it will get set as the default. If there was // the first dictionary is installed
// a preference but we can't set the dictionary to that preference, don't do if (! setDictionary) {
// anything. If the user's selected dictionary went missing, we don't want to
// set it to a random dictionary.
if (! hasPreference && ! setDictionary) {
nsStringArray dictList; nsStringArray dictList;
rv = mSpellChecker->GetDictionaryList(&dictList); rv = mSpellChecker->GetDictionaryList(&dictList);
NS_ENSURE_SUCCESS(rv, rv); NS_ENSURE_SUCCESS(rv, rv);