I know this is possible because I am overriding the prompt service to use my own dialogs. However, I'm not sure what you are trying to accomplish. I have turned all prompts other than the one-button alert into a no-op, but I assume they are just falling through with their default reply, rather than trying to default to some other kind of response. I'm happy to post code, if there's something specific you are looking for.

J

On Mar 6, 2006, at 2:04 PM, Ben Hutchings wrote:

I'm trying to do batch processing of web pages using Mozilla, and
error dialogs are getting in the way of this.  I would like to
override the prompt service with one that answers questions
automatically.  I noticed a thread a little while back with the
subject "How do I override nsNSSDialogs with my own class?" in which
Barry Scott posted some code for overriding the prompt service.
Based on that, I've written the following:

class null_prompt_service : public nsIPromptService
{
public:
    static void install();

    NS_DECL_ISUPPORTS
    NS_DECL_NSIPROMPTSERVICE
};

NS_DEFINE_IID(prompt_service_iid, NS_IPROMPTSERVICE_IID);

// nsIPromptService implementation omitted

void null_prompt_service::install()
{
nsCOMPtr<nsIFactory> prompt_factory(new null_prompt_service_factory);
    check(nsComponentManager::RegisterFactory(
              prompt_service_iid,
              "Prompt Service",
              "@mozilla.org/embedcomp/prompt-service;1",
              prompt_factory,
              PR_TRUE)); // replace existing
}

(The check function used here converts throws an exception if its
argument represents an error.)

However, this doesn't seem to have any effect.  What am I doing wrong
here?  Can I solve this in version 1.7?

--
Ben Hutchings
We get into the habit of living before acquiring the habit of thinking. - Albert Camus
_______________________________________________
dev-embedding mailing list
[email protected]
https://lists.mozilla.org/listinfo/dev-embedding

_______________________________________________
dev-embedding mailing list
[email protected]
https://lists.mozilla.org/listinfo/dev-embedding

Reply via email to