diff --git a/mozilla/editor/base/nsEditorEventListeners.cpp b/mozilla/editor/base/nsEditorEventListeners.cpp index 6f1b4c20474..e57f35454f8 100644 --- a/mozilla/editor/base/nsEditorEventListeners.cpp +++ b/mozilla/editor/base/nsEditorEventListeners.cpp @@ -559,6 +559,7 @@ nsTextEditorMouseListener::MouseClick(nsIDOMEvent* aMouseEvent) nsresult nsTextEditorMouseListener::MouseDblClick(nsIDOMEvent* aMouseEvent) { + // TODO: MOVE THIS TO ::MouseUp and test for click count to detect double click nsCOMPtr htmlEditor = do_QueryInterface(mEditor); if (htmlEditor) { diff --git a/mozilla/editor/base/nsEditorShell.cpp b/mozilla/editor/base/nsEditorShell.cpp index a645c23c199..3bba1eb0bfe 100644 --- a/mozilla/editor/base/nsEditorShell.cpp +++ b/mozilla/editor/base/nsEditorShell.cpp @@ -2445,7 +2445,21 @@ nsEditorShell::Confirm(const nsString& aTitle, const nsString& aQuestion) return result; } -void +NS_IMETHODIMP +nsEditorShell::AlertWithTitle(const PRUnichar *aTitle, const PRUnichar *aMsg) +{ + if (!aTitle || !aMsg) + return NS_ERROR_NULL_POINTER; + + nsresult rv = NS_ERROR_FAILURE; + NS_WITH_SERVICE(nsICommonDialogs, dialog, kCommonDialogsCID, &rv); + if (NS_SUCCEEDED(rv) && dialog) + rv = dialog->Alert(mContentWindow, aTitle, aMsg); + + return rv; +} + +void nsEditorShell::Alert(const nsString& aTitle, const nsString& aMsg) { nsresult rv; diff --git a/mozilla/editor/composer/src/nsEditorShell.cpp b/mozilla/editor/composer/src/nsEditorShell.cpp index a645c23c199..3bba1eb0bfe 100644 --- a/mozilla/editor/composer/src/nsEditorShell.cpp +++ b/mozilla/editor/composer/src/nsEditorShell.cpp @@ -2445,7 +2445,21 @@ nsEditorShell::Confirm(const nsString& aTitle, const nsString& aQuestion) return result; } -void +NS_IMETHODIMP +nsEditorShell::AlertWithTitle(const PRUnichar *aTitle, const PRUnichar *aMsg) +{ + if (!aTitle || !aMsg) + return NS_ERROR_NULL_POINTER; + + nsresult rv = NS_ERROR_FAILURE; + NS_WITH_SERVICE(nsICommonDialogs, dialog, kCommonDialogsCID, &rv); + if (NS_SUCCEEDED(rv) && dialog) + rv = dialog->Alert(mContentWindow, aTitle, aMsg); + + return rv; +} + +void nsEditorShell::Alert(const nsString& aTitle, const nsString& aMsg) { nsresult rv; diff --git a/mozilla/editor/idl/nsIEditorShell.idl b/mozilla/editor/idl/nsIEditorShell.idl index 497b836b85d..de3848ddee2 100644 --- a/mozilla/editor/idl/nsIEditorShell.idl +++ b/mozilla/editor/idl/nsIEditorShell.idl @@ -96,6 +96,9 @@ interface nsIEditorShell : nsISupports void Init(); + /* Access for the common alert dialog */ + void AlertWithTitle(in wstring title, in wstring msg); + /* check a particular window's URL to see if it matches the given URL */ boolean checkOpenWindowForURLMatch( in wstring inFileURL, in nsIDOMWindow inCheckWindow); diff --git a/mozilla/editor/libeditor/text/nsEditorEventListeners.cpp b/mozilla/editor/libeditor/text/nsEditorEventListeners.cpp index 6f1b4c20474..e57f35454f8 100644 --- a/mozilla/editor/libeditor/text/nsEditorEventListeners.cpp +++ b/mozilla/editor/libeditor/text/nsEditorEventListeners.cpp @@ -559,6 +559,7 @@ nsTextEditorMouseListener::MouseClick(nsIDOMEvent* aMouseEvent) nsresult nsTextEditorMouseListener::MouseDblClick(nsIDOMEvent* aMouseEvent) { + // TODO: MOVE THIS TO ::MouseUp and test for click count to detect double click nsCOMPtr htmlEditor = do_QueryInterface(mEditor); if (htmlEditor) { diff --git a/mozilla/editor/ui/composer/content/EditorCommands.js b/mozilla/editor/ui/composer/content/EditorCommands.js index b531764a457..4b146343297 100644 --- a/mozilla/editor/ui/composer/content/EditorCommands.js +++ b/mozilla/editor/ui/composer/content/EditorCommands.js @@ -1131,23 +1131,34 @@ function CheckSpelling() // Start the spell checker module. Return is first misspelled word try { firstMisspelledWord = spellChecker.StartSpellChecking(); - dump(firstMisspelledWord+"\n"); - if( firstMisspelledWord == "") - { - spellChecker.CloseSpellChecking(); - - // No misspelled word - tell user - editorShell.Alert(editorShell.GetString("CheckSpelling"), editorShell.GetString("NoMisspelledWord")); - } else { - dump("We found a MISSPELLED WORD\n"); - // Set spellChecker variable on window - window.spellChecker = spellChecker; - window.openDialog("chrome://editor/content/EdSpellCheck.xul", "_blank", "chrome,close,titlebar,modal", "", firstMisspelledWord); - editorShell.Alert(editorShell.GetString("CheckSpelling"), editorShell.GetString("CheckSpellingDone")); - } } - catch(ex) { - dump("*** Exception error from Spell Checker\n"); + catch(ex) { + dump("*** Exception error: StartSpellChecking\n"); + return; + } + if( firstMisspelledWord == "") + { + try { + spellChecker.CloseSpellChecking(); + } + catch(ex) { + dump("*** Exception error: CloseSpellChecking\n"); + return; + } + // No misspelled word - tell user + editorShell.AlertWithTitle(editorShell.GetString("CheckSpelling"), editorShell.GetString("NoMisspelledWord")); + } else { + // Set spellChecker variable on window + window.spellChecker = spellChecker; + try { + window.openDialog("chrome://editor/content/EdSpellCheck.xul", "_blank", "chrome,close,titlebar,modal", "", firstMisspelledWord); + } + catch(ex) { + dump("*** Exception error: SpellChecker Dialog Closing\n"); + return; + } +// We might want to use this: +// editorShell.AlertWithTitle(editorShell.GetString("CheckSpelling"), editorShell.GetString("CheckSpellingDone")); } } contentWindow.focus(); diff --git a/mozilla/editor/ui/dialogs/content/EdSpellCheck.js b/mozilla/editor/ui/dialogs/content/EdSpellCheck.js index b83a425308b..dab73884c4c 100644 --- a/mozilla/editor/ui/dialogs/content/EdSpellCheck.js +++ b/mozilla/editor/ui/dialogs/content/EdSpellCheck.js @@ -192,7 +192,6 @@ function SelectLanguage() function Close() { - dump("SpellCheck: Spell Checker is closing...\n"); // Shutdown the spell check and close the dialog spellChecker.CloseSpellChecking(); window.close();