Closed Bug 65677 Opened 24 years ago Closed 23 years ago

pref UI: if no spellchecker installed, pref should be disabled

Categories

(SeaMonkey :: MailNews: Message Display, defect)

defect
Not set
normal

Tracking

(Not tracked)

VERIFIED FIXED
mozilla0.9

People

(Reporter: bugzilla, Assigned: gerv)

Details

(Keywords: helpwanted, polish)

Attachments

(4 files)

pls pardon if this is a dup --couldn't find an existing bug on this. occurs on
all platforms.

0. make sure your installation doesn't include the spellchecker --ie, the
components/spellchecker/ dir should not exist.
1. start app, open Preferences dialog.
2. open the Mail and Newsgroups > Message Composition panel.

observe: under the Composing Messages section, the "Check spelling before
sending is enabled --ie, you can select and deselect the checkbox.

expected: if there's no spellchecker, this feature should greyed out [disabled].
QA Contact: esther → pmock
If someone said how to check whether the spellchecker was installed or not, I'm 
sure someone could insert the logic into the JS for this without too much 
trouble...

Gerv
gerv,

in nsMessengerMigrator.cpp I have code that sees if the 4.x addressbook upgrader
component is installed.

in C++, it's something like this:

nsCOMPtr <nsIAbUpgrader> abUpgrader = do_GetService(NS_AB4xUPGRADER_CONTRACTID,
&rv);
if (NS_FAILED(rv) || !abUpgrader) return;

you could do the same thing from JS for spell checker.

(see what they are doing in nsEditorShell::InitSpellChecker())
Seth, I have no idea how to express that idea in JS :-(

In all seriousness, surely this should just be disabled in Mozilla? If Netscape 
want to add a spell checker, they'll have to re-enable it in their builds. ;-)

For reference:
http://lxr.mozilla.org/seamonkey/source/mailnews/compose/prefs/resources/content
/pref-messages.xul#66
is the location of the XUL for the offending item.

(This file does not have an associated .js file so we'd have to create one to 
contain the logic if we greyed it out dynamically.)

Gerv
OK - patch coming up :-) It's five lines, and it really _should_ work, but I 
can't test it properly because I don't have access to a build with spellchecker 
installed :-)

Could I get some review, please? :-)

Gerv
Keywords: mozilla0.9, patch, review
Attached patch PatchSplinter Review
looking good.

two comments:

before setting disabled to false, I think you should QI to see that what you got 
really is an nsISpellChecker.

did you need help testing this code, to see if we do the right thing, when a 
spell checker is installed?
> before setting disabled to false, I think you should QI to see that what 
> you got really is an nsISpellChecker.

Can't I trust the call to return an nsISpellChecker or null? <shrug>. Could you
provide a sample line or a doc? I don't know much about QueryInterface...

> did you need help testing this code, to see if we do the right thing, 
> when a spell checker is installed?

Indeed. I cribbed the code from somewhere in Mail/News, so it really should
work, but whoever checks it in should probably test it first :-)

Gerv
here's how I'd alter your patch

var spellChecker;
try {
	spellChecker = Components.classes["@mozilla.org/
spellchecker;1"].QueryInterface(Components.interfaces.nsISpellChecker);
}
catch (ex) {
	spellChecker = null;
}

if (spellChecker) {
	// enable the UI
}

can you create a new patch, like that?

then I'll try it out my tree (with the spell checker built and installed, and 
without)

thanks work doing this, gerv.  do you want to re-assign the bug to you?
Attached patch 3rd attemptSplinter Review
Attempt 3 attached, incorporating comments from sspitzer. Give it a go :-)

Gerv
Assignee: sspitzer → gervase.markham
Target Milestone: --- → mozilla0.9
update:  sorry gerv, didn't get to it today.  I'll do it tomorrow (3/28)
note, I couldn't do a create instance, since nsISpellChecker is not scriptable.

but gerv's original way worked fine for now.  I've tested and it all works.

ideally, nsISpellChecker should be made scriptable.  I'll log another bug for
that.

thanks again gerv.
Status: NEW → RESOLVED
Closed: 23 years ago
Resolution: --- → FIXED
If you do that, and re-fix this, you'll also need to update the code in the 
place I nicked it from - I think it was the bit that enabled or disabled the 
SpellCheck button.

Gerv
verified because the pref is no longer visible when a spell checker is not
installed see bug 84607, verified on 3-29-2002.
Status: RESOLVED → VERIFIED
Product: Browser → Seamonkey
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: