Bug 349882 r=ben No way to download dictionaries when no dictionary is installed.

This commit is contained in:
brettw%gmail.com 2006-08-23 22:10:16 +00:00
Родитель 54fe81481a
Коммит 2bcf4bf151
2 изменённых файлов: 18 добавлений и 1 удалений

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

@ -241,6 +241,10 @@
type="checkbox" type="checkbox"
accesskey="&spellEnable.accesskey;" accesskey="&spellEnable.accesskey;"
oncommand="InlineSpellCheckerUI.toggleEnabled();"/> oncommand="InlineSpellCheckerUI.toggleEnabled();"/>
<menuitem id="spell-add-dictionaries-main"
label="&spellAddDictionaries.label;"
accesskey="&spellAddDictionaries.accesskey;"
oncommand="gContextMenu.addDictionaries();"/>
<menu id="spell-dictionaries" <menu id="spell-dictionaries"
label="&spellDictionaries.label;" label="&spellDictionaries.label;"
accesskey="&spellDictionaries.accesskey;"> accesskey="&spellDictionaries.accesskey;">

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

@ -4323,6 +4323,7 @@ function nsContextMenu( xulMenu ) {
this.inDirList = false; this.inDirList = false;
this.shouldDisplay = true; this.shouldDisplay = true;
this.isDesignMode = false; this.isDesignMode = false;
this.possibleSpellChecking = false;
// Initialize new menu. // Initialize new menu.
this.initMenu( xulMenu ); this.initMenu( xulMenu );
@ -4470,7 +4471,7 @@ nsContextMenu.prototype = {
var canSpell = InlineSpellCheckerUI.canSpellCheck; var canSpell = InlineSpellCheckerUI.canSpellCheck;
var onMisspelling = InlineSpellCheckerUI.overMisspelling; var onMisspelling = InlineSpellCheckerUI.overMisspelling;
this.showItem("spell-check-enabled", canSpell); this.showItem("spell-check-enabled", canSpell);
this.showItem("spell-separator", canSpell); this.showItem("spell-separator", canSpell || this.possibleSpellChecking);
if (canSpell) if (canSpell)
document.getElementById("spell-check-enabled").setAttribute("checked", document.getElementById("spell-check-enabled").setAttribute("checked",
InlineSpellCheckerUI.enabled); InlineSpellCheckerUI.enabled);
@ -4493,6 +4494,14 @@ nsContextMenu.prototype = {
var dictMenu = document.getElementById("spell-dictionaries-menu"); var dictMenu = document.getElementById("spell-dictionaries-menu");
var dictSep = document.getElementById("spell-language-separator"); var dictSep = document.getElementById("spell-language-separator");
InlineSpellCheckerUI.addDictionaryListToMenu(dictMenu, dictSep); InlineSpellCheckerUI.addDictionaryListToMenu(dictMenu, dictSep);
this.showItem("spell-add-dictionaries-main", false);
} else if (this.possibleSpellChecking) {
// when there is no spellchecker but we might be able to spellcheck
// add the add to dictionaries item. This will ensure that people
// with no dictionaries will be able to download them
this.showItem("spell-add-dictionaries-main", true);
} else {
this.showItem("spell-add-dictionaries-main", false);
} }
}, },
initClipboardItems : function () { initClipboardItems : function () {
@ -4562,6 +4571,7 @@ nsContextMenu.prototype = {
this.inFrame = false; this.inFrame = false;
this.hasBGImage = false; this.hasBGImage = false;
this.bgImageURL = ""; this.bgImageURL = "";
this.possibleSpellChecking = false;
// Clear any old spellchecking items from the menu, this used to // Clear any old spellchecking items from the menu, this used to
// be in the menu hiding code but wasn't getting called in all // be in the menu hiding code but wasn't getting called in all
@ -4598,6 +4608,7 @@ nsContextMenu.prototype = {
this.onTextInput = this.isTargetATextBox(this.target); this.onTextInput = this.isTargetATextBox(this.target);
// allow spellchecking UI on all writable text boxes except passwords // allow spellchecking UI on all writable text boxes except passwords
if (this.onTextInput && ! this.target.readOnly && this.target.type != "password") { if (this.onTextInput && ! this.target.readOnly && this.target.type != "password") {
this.possibleSpellChecking = true;
InlineSpellCheckerUI.init(this.target.QueryInterface(Components.interfaces.nsIDOMNSEditableElement).editor); InlineSpellCheckerUI.init(this.target.QueryInterface(Components.interfaces.nsIDOMNSEditableElement).editor);
InlineSpellCheckerUI.initFromEvent(rangeParent, rangeOffset); InlineSpellCheckerUI.initFromEvent(rangeParent, rangeOffset);
} }
@ -4605,6 +4616,7 @@ nsContextMenu.prototype = {
} else if ( this.target instanceof HTMLTextAreaElement ) { } else if ( this.target instanceof HTMLTextAreaElement ) {
this.onTextInput = true; this.onTextInput = true;
if (! this.target.readOnly) { if (! this.target.readOnly) {
this.possibleSpellChecking = true;
InlineSpellCheckerUI.init(this.target.QueryInterface(Components.interfaces.nsIDOMNSEditableElement).editor); InlineSpellCheckerUI.init(this.target.QueryInterface(Components.interfaces.nsIDOMNSEditableElement).editor);
InlineSpellCheckerUI.initFromEvent(rangeParent, rangeOffset); InlineSpellCheckerUI.initFromEvent(rangeParent, rangeOffset);
} }
@ -4760,6 +4772,7 @@ nsContextMenu.prototype = {
this.inFrame = false; this.inFrame = false;
this.hasBGImage = false; this.hasBGImage = false;
this.isDesignMode = true; this.isDesignMode = true;
this.possibleSpellChecking = true;
InlineSpellCheckerUI.init(editingSession.getEditorForWindow(win)); InlineSpellCheckerUI.init(editingSession.getEditorForWindow(win));
var canSpell = InlineSpellCheckerUI.canSpellCheck; var canSpell = InlineSpellCheckerUI.canSpellCheck;
InlineSpellCheckerUI.initFromEvent(rangeParent, rangeOffset); InlineSpellCheckerUI.initFromEvent(rangeParent, rangeOffset);