From baf7a7898695a3ea63dad59999055719e2888082 Mon Sep 17 00:00:00 2001 From: "cmanske%netscape.com" Date: Fri, 17 May 2002 03:27:45 +0000 Subject: [PATCH] Fixed spell check bugs 142597 (dictionary names not localized, r=andreww, sr=hewitt) and 112732 (added accesskeys, r=neil@parkwaycc.co.uk, sr=hewitt) EdSpellCheck.xul EdSpellCheck.js EdDictionary.xul EdDictionary.js --- editor/ui/dialogs/content/EdLinkChecker.js | 102 ++++++++++++------ editor/ui/dialogs/content/EdLinkChecker.xul | 24 ++--- editor/ui/dialogs/content/EdListProps.js | 16 ++- editor/ui/dialogs/content/EdListProps.xul | 7 +- editor/ui/dialogs/content/EdSpellCheck.js | 34 ++---- editor/ui/dialogs/content/EdSpellCheck.xul | 3 + editor/ui/dialogs/content/EditorPublish.js | 6 +- editor/ui/dialogs/content/EditorPublish.xul | 36 +++++-- .../dialogs/content/EditorPublishOverlay.xul | 22 ++-- .../dialogs/content/EditorPublishSettings.xul | 14 ++- 10 files changed, 162 insertions(+), 102 deletions(-) diff --git a/editor/ui/dialogs/content/EdLinkChecker.js b/editor/ui/dialogs/content/EdLinkChecker.js index 808f94aafd4..880348778ad 100644 --- a/editor/ui/dialogs/content/EdLinkChecker.js +++ b/editor/ui/dialogs/content/EdLinkChecker.js @@ -24,8 +24,8 @@ // Variables used across all the links being checked: var gNumLinksToCheck = 0; // The number of nsILinkCheckers -var gLinksBeingChecked = {}; // Array of nsIURICheckers -var gURIRefObjects = {}; // Array of nsIURIRefObjects +var gLinksBeingChecked = []; // Array of nsIURICheckers +var gURIRefObjects = []; // Array of nsIURIRefObjects var gNumLinksCalledBack = 0; var gStartedAllChecks = false; var gLinkCheckTimerID = 0; @@ -64,8 +64,12 @@ function Startup() if (!InitEditorShell()) return; + gDialog.LinksList = document.getElementById("LinksList"); + gDialog.Close = document.documentElement.getButton("cancel"); + // Set window location relative to parent window (based on persisted attributes) SetWindowLocation(); + // Get all objects that refer to other locations var objects = editorShell.GetLinkedObjects(); @@ -89,16 +93,17 @@ function Startup() = Components.classes["@mozilla.org/network/urichecker;1"] .createInstance() .QueryInterface(Components.interfaces.nsIURIChecker); - - // XXX Calling this is related to crash deleting gLinksBeingChecked when dialog is closed - // (if this isn't called, no crash) gLinksBeingChecked[gNumLinksToCheck].asyncCheckURI(uri, gRequestObserver, null, Components.interfaces.nsIRequest.LOAD_NORMAL); + + // Add item + var linkChecker = gLinksBeingChecked[gNumLinksToCheck].QueryInterface(Components.interfaces.nsIURIChecker); + SetItemStatus(linkChecker.name, "busy"); +dump(" *** Linkcount = "+gNumLinksToCheck+"\n"); gNumLinksToCheck++; + }; - } catch (e) { -dump(" Exception ERROR in Link checker. e.result="+e.result+", gNumLinksToCheck="+gNumLinksToCheck+"\n"); - } + } catch (e) { dump (" *** EXCEPTION\n");} } } // Done with the loop, now we can be prepared for the finish: @@ -106,6 +111,7 @@ dump(" Exception ERROR in Link checker. e.result="+e.result+", gNumLinksToCheck= // Start timer to limit how long we wait for link checking gLinkCheckTimerID = setTimeout("LinkCheckTimeOut()", 5000); + window.sizeToContent(); } function LinkCheckTimeOut() @@ -115,40 +121,70 @@ function LinkCheckTimeOut() return; gLinkCheckTimerID = 0; -dump("*** LinkCheckTimeout: Heard from " + gNumLinksCalledBack + " of "+gNumLinksToCheck + "\n"); - gNumLinksToCheck = 0; gStartedAllChecks = false; - if ("length" in gLinksBeingChecked) + for (var i=0; i < gLinksBeingChecked.length; i++) { - for (var i=0; i < gLinksBeingChecked.length; i++) + var linkChecker = gLinksBeingChecked[i].QueryInterface(Components.interfaces.nsIURIChecker); + // nsIURIChecker status values: + // NS_BINDING_SUCCEEDED link is valid + // NS_BINDING_FAILED link is invalid (gave an error) + // NS_BINDING_ABORTED timed out, or cancelled + switch (linkChecker.status) { - var linkChecker = gLinksBeingChecked[i].QueryInterface(Components.interfaces.nsIURIChecker); - // nsIURIChecker status values: - // NS_BINDING_SUCCEEDED link is valid - // NS_BINDING_FAILED link is invalid (gave an error) - // NS_BINDING_ABORTED timed out, or cancelled - switch (linkChecker.status) + case 0: // NS_BINDING_SUCCEEDED + SetItemStatus(linkChecker.name, "done"); + break; + case 0x804b0001: // NS_BINDING_FAILED + dump(">> " + linkChecker.name + " is broken\n"); + case 0x804b0002: // NS_BINDING_ABORTED +// dump(">> " + linkChecker.name + " timed out\n"); + default: +// dump(">> " + linkChecker.name + " not checked\n"); + SetItemStatus(linkChecker.name, "failed"); + break; + } + } + gDialog.Close.setAttribute("label", GetString("Close")); +} + +// Add url to list of links to check +// or set status for file already in the list +// Returns true if url was in the list +function SetItemStatus(url, status) +{ + if (!url) + return false; + + if (!status) + status = "busy"; + + // Just set attribute for status icon + // if we already have this url + var listitems = document.getElementsByTagName("listitem"); + if (listitems) + { + for (var i=0; i < listitems.length; i++) + { + if (listitems[i].getAttribute("label") == url) { - case 0: // NS_BINDING_SUCCEEDED - dump(" " + linkChecker.name + " OK!\n"); - break; - case 0x804b0001: // NS_BINDING_FAILED - dump(">> " + linkChecker.name + " is broken\n"); - break; - case 0x804b0002: // NS_BINDING_ABORTED - dump(">> " + linkChecker.name + " timed out\n"); - break; - default: - dump(">> " + linkChecker.name + " not checked\n"); - break; + listitems[i].setAttribute("progress", status); + return true; } } } -} -function ChangeUrl() -{ + // We're adding a new item to list + var listitem = document.createElementNS(XUL_NS, "listitem"); + if (listitem) + { + listitem.setAttribute("class", "listitem-iconic progressitem"); + // This triggers CSS to show icon for each status state + listitem.setAttribute("progress", status); + listitem.setAttribute("label", url); + gDialog.LinksList.appendChild(listitem); + } + return false; } function onAccept() diff --git a/editor/ui/dialogs/content/EdLinkChecker.xul b/editor/ui/dialogs/content/EdLinkChecker.xul index 1dd7ff54cec..72649b6ab41 100644 --- a/editor/ui/dialogs/content/EdLinkChecker.xul +++ b/editor/ui/dialogs/content/EdLinkChecker.xul @@ -19,6 +19,7 @@ - Rights Reserved. - - Contributor(s): + - Charles Manske (cmanske@netscape.com) --> @@ -44,16 +45,15 @@ -