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

This commit is contained in:
cmanske%netscape.com 2002-05-17 03:27:45 +00:00
Родитель e9a21ed5cb
Коммит 610ab07135
10 изменённых файлов: 162 добавлений и 102 удалений

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

@ -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()

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

@ -19,6 +19,7 @@
- Rights Reserved.
-
- Contributor(s):
- Charles Manske (cmanske@netscape.com)
-->
<?xml-stylesheet href="chrome://editor/skin/editor.css" type="text/css"?>
@ -44,16 +45,15 @@
<spacer id="location" offsetY="50" persist="offsetX offsetY"/>
<broadcaster id="args" value=""/>
<label value="&urlsNotFound.label;"/>
<label value="&notFoundKey.label;"/>
<tree id="NamedAnchorList" hidecolumnpicker="true"
style="min-height: 8em; min-width: 20em">
<treecols>
<treecol id="AnchorCol1" hideheader="true"/>
<treecol id="AnchorCol2" flex="1" hideheader="true"/>
</treecols>
<treechildren/>
</tree>
<spacer class="spacer"/>
<button id="ChangeURL" label="&changeUrlButton.label;" oncommand="ChangeUrl();"/>
<listbox rows="8" id="LinksList" class="MinWidth20" flex="1"/>
<hbox align="center">
<spacer class="bigspacer"/>
<image class="progressitem" progress="done"/>
<label value="&succeeded.label;"/>
<spacer class="bigspacer"/>
<spacer class="bigspacer"/>
<image class="progressitem" progress="failed"/>
<label value="&failed.label;"/>
</hbox>
<separator class="groove"/>
</dialog>

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

@ -60,16 +60,14 @@ function Startup()
if (ListElement)
globalElement = ListElement.cloneNode(false);
// Show extra options for changing entire list if we have one already.
// Radio button index is persistent
if (ListElement && gDialog.RadioGroup.getAttribute("index") == "1")
gDialog.RadioGroup.selectedItem = gDialog.ChangeSelectedRadio;
else
gDialog.RadioGroup.selectedItem = gDialog.ChangeAllRadio;
// Show extra options for changing entire list only if we already have a list
gDialog.RadioGroup.setAttribute("collapsed", ListElement ? "false" : "true");
if (ListElement)
{
// Radio button index is persistant
if (gDialog.RadioGroup.getAttribute("index") == "1")
gDialog.RadioGroup.selectedItem = gDialog.ChangeSelectedRadio;
else
gDialog.RadioGroup.selectedItem = gDialog.ChangeAllRadio;
}
InitDialog();

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

@ -18,7 +18,9 @@
- Copyright (C) 1998-1999 Netscape Communications Corporation. All
- Rights Reserved.
-
- Contributor(s):
- Contributor(s):
- Charles Manske (cmanske@netscape.com)
- Ryan Cassin (rcassin@supernova.org)
-->
<?xml-stylesheet href="chrome://editor/skin/editor.css" type="text/css"?>
@ -64,10 +66,9 @@
<hbox>
<label id="StartingNumberLabel" control="StartingNumber"
value="&startingNumber.label;" accesskey="&startingNumber.accessKey;"/>
<textbox class="narrow" id="StartingNumber" oninput="forceInteger(this.id)"/>
<textbox class="narrow" id="StartingNumber"/>
<spacer/>
</hbox>
<description id="StartExample" class="wrap" flex="1" style="width: 1em">&startingHelp.label;</description>
</groupbox>
<radiogroup id="RadioGroup" index="0" persist="index">
<radio id="ChangeAll" label="&changeEntireListRadio.label;" accesskey="&changeEntireListRadio.accessKey;"/>

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

@ -134,31 +134,17 @@ function InitLanguageMenu(curLang)
// Load the string bundles that will help us map
// RFC 1766 strings to UI strings.
var languageBundle;
// Load the language string bundle.
var languageBundle = document.getElementById("languageBundle");
var regionBundle;
// If we have a language string bundle, load the region string bundle.
if (languageBundle)
regionBundle = document.getElementById("regionBundle");
var menuStr2;
var isoStrArray;
var defaultIndex = 0;
var langId;
// Try to load the language string bundle.
try {
languageBundle = srGetStrBundle("chrome://global/locale/languageNames.properties");
} catch(ex) {
languageBundle = null;
}
// If we have a language string bundle, try to load the region string bundle.
if (languageBundle)
{
try {
regionBundle = srGetStrBundle("chrome://global/locale/regionNames.properties");
} catch(ex) {
regionBundle = null;
}
}
var i;
for (i = 0; i < dictList.length; i++)
{
@ -170,11 +156,11 @@ function InitLanguageMenu(curLang)
dictList[i][1] = langId; // second subarray element - language ID
if (languageBundle && isoStrArray[0])
dictList[i][0] = languageBundle.GetStringFromName(isoStrArray[0].toLowerCase());
dictList[i][0] = languageBundle.getString(isoStrArray[0].toLowerCase());
if (regionBundle && dictList[i][0] && isoStrArray.length > 1 && isoStrArray[1])
{
menuStr2 = regionBundle.GetStringFromName(isoStrArray[1].toLowerCase());
menuStr2 = regionBundle.getString(isoStrArray[1].toLowerCase());
if (menuStr2)
dictList[i][0] = dictList[i][0] + "/" + menuStr2;
}
@ -182,7 +168,7 @@ function InitLanguageMenu(curLang)
if (!dictList[i][0])
dictList[i][0] = dictList[i][1];
} catch (ex) {
// GetStringFromName throws an exception when
// GetString throws an exception when
// a key is not found in the bundle. In that
// case, just use the original dictList string.
@ -196,7 +182,7 @@ function InitLanguageMenu(curLang)
for (i = 0; i < dictList.length; i++)
{
AppendLabelAndValueToMenulist(gDialog.LanguageMenulist, dictList[i][0], dictList[i][1]);
gDialog.LanguageMenulist.appendItem(dictList[i][0], dictList[i][1]);
if (curLang && dictList[i][1] == curLang)
defaultIndex = i+2; //first two items are pre-populated and fixed
}

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

@ -42,6 +42,9 @@
<broadcaster id="args" value=""/>
<stringbundle id="languageBundle" src="chrome://global/locale/languageNames.properties"/>
<stringbundle id="regionBundle" src="chrome://global/locale/regionNames.properties"/>
<grid>
<columns>
<column class="spell-check"/>

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

@ -159,7 +159,7 @@ function Startup()
} catch (e) {}
gDialog.PageTitleInput.value = gPreviousTitle;
gDialog.FilenameInput.value = unescape(filename);
gDialog.FilenameInput.value = filename;
if (!addNewSite)
{
@ -188,6 +188,8 @@ function Startup()
gDialog.OtherDirRadiogroup.selectedItem = gDialog.UseSubdirRadio;
}
gDialog.PublishUrlInput.setAttribute("tooltiptext", "The FTP:// or HTTP:// address provided by\nyour ISP or web hosting service");
doEnabling();
SetWindowLocation();
@ -396,6 +398,8 @@ function ValidateSettings()
}
// Extract username and password while removing them from publishingUrl
/// XXX Problem: If username contains "@", StripUsernamePassword will not
// extract the username correctly
var urlUserObj = {};
var urlPassObj = {};
var publishUrl = StripUsernamePassword(gDialog.PublishUrlInput.value, urlUserObj, urlPassObj);

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

@ -30,6 +30,7 @@
<!DOCTYPE window SYSTEM "chrome://editor/locale/EditorPublish.dtd">
<dialog title="&windowTitle.label;"
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
onload="Startup()"
@ -49,6 +50,14 @@
<spacer id="location" offsetY="50" persist="offsetX offsetY"/>
<broadcaster id="args" value=""/>
<popupset id="tooltipSet">
<tooltip id="publishTooltip" noautohide="true">
<description width="200">
&siteNameTip.label;
</description>
</tooltip>
</popupset>
<tabbox>
<tabs flex="1">
<tab id="PublishTab" oncommand="SelectPublishTab()" label="&publishTab.label;"/>
@ -62,31 +71,36 @@
<columns><column/><column/><column/></columns>
<rows>
<row align="center">
<label value="&siteList.label;"/>
<label value="&siteName.label;"
accesskey="&siteNameList.accessKey;" control="SiteList"/>
<!-- Contents filled in at runtime -->
<menulist id="SiteList"
style="min-width:18em; max-width:18em;" crop="right"
oncommand="SelectSiteList();"/>
<hbox>
<button label="&newSiteButton.label;" oncommand="AddNewSite();"/>
<button label="&newSiteButton.label;"
accesskey="&newSiteButton.accessKey;" oncommand="AddNewSite();"/>
<spacer flex="1"/>
</hbox>
</row>
<spacer class="spacer"/>
<row align="center">
<label value="&pageTitle.label;"/>
<label value="&pageTitle.label;"
accesskey="&pageTitle.accessKey;" control="PageTitleInput"/>
<textbox id="PageTitleInput" class="minWidth15"/>
<label value="&pageTitleExample.label;"/>
</row>
<row align="center">
<label value="&filename.label;"/>
<label value="&filename.label;"
accesskey="&filename.accessKey;" control="FilenameInput"/>
<textbox id="FilenameInput" class="minWidth15"/>
<label value="&filenameExample.label;"/>
</row>
</rows>
</grid>
<spacer class="spacer"/>
<label value="&docDirList.label;"/>
<label value="&docDirList.label;"
accesskey="&docDirList.accessKey;" control="DocDirList"/>
<hbox align="center">
<!-- Contents filled in at runtime -->
<menulist id="DocDirList" class="minWidth20" editable="true" flex="1"
@ -98,17 +112,20 @@
<spacer class="spacer"/>
<groupbox>
<caption>
<checkbox id="OtherDirCheckbox" label="&publishImgCheckbox.label;" oncommand="doEnabling();"/>
<checkbox id="OtherDirCheckbox" label="&publishImgCheckbox.label;"
accesskey="&publishImgCheckbox.accessKey;" oncommand="doEnabling();"/>
</caption>
<vbox>
<radiogroup id="OtherDirRadiogroup">
<hbox>
<spacer class="checkbox-spacer"/>
<radio id="SameLocationRadio" label="&sameLocationRadio.label;" oncommand="doEnabling();"/>
<radio id="SameLocationRadio" label="&sameLocationRadio.label;"
accesskey="&sameLocationRadio.accessKey;" oncommand="doEnabling();"/>
</hbox>
<hbox>
<spacer class="checkbox-spacer"/>
<radio id="UseSubdirRadio" label="&useSubdirRadio.label;" oncommand="doEnabling();"/>
<radio id="UseSubdirRadio" label="&useSubdirRadio.label;"
accesskey="&useSubdirRadio.accessKey;" oncommand="doEnabling();"/>
</hbox>
</radiogroup>
</vbox>
@ -119,7 +136,8 @@
<menulist id="OtherDirList" class="minWidth20" editable="true" flex="1"
oninput="onInputSettings();"/>
<!--
<button label="&chooseDirButton.label;" oncommand="ChooseDir(gDialog.OtherDirList);" disabled="true"/>
<button label="&chooseDirButton.label;"
accesskey="&chooseDirButton.accessKey;" oncommand="ChooseDir(gDialog.OtherDirList);" disabled="true"/>
-->
</hbox>
</groupbox>

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

@ -34,14 +34,19 @@
<groupbox id="ServerSettingsBox">
<caption label="&serverInfo.label;"/>
<hbox align="center">
<label value="&siteName.label;"/>
<textbox id="SiteNameInput" class="MinWidth20em" oninput="onInputSettings();" flex="1"/>
<label value="&siteName.label;"
accesskey="&siteName.accessKey;" control="SiteNameInput"/>
<textbox id="SiteNameInput" class="MinWidth20em"
oninput="onInputSettings();" flex="1"
tooltip="publishTooltip" />
</hbox>
<spacer class="spacer"/>
<label value="&siteUrl.label;"/>
<label value="&siteUrl.label;"
accesskey="&siteUrl.accessKey;" control="PublishUrlInput"/>
<textbox id="PublishUrlInput" class="MinWidth20em" oninput="onInputSettings();"/>
<spacer class="spacer"/>
<label value="&browseUrl.label;"/>
<label value="&browseUrl.label;"
accesskey="&browseUrl.accessKey;" control="BrowseUrlInput"/>
<textbox id="BrowseUrlInput" class="MinWidth20em" oninput="onInputSettings();"/>
<spacer class="spacer"/>
</groupbox>
@ -51,14 +56,17 @@
<columns><column flex="1"/><column flex="3"/></columns>
<rows>
<row align="center">
<label value="&username.label;"/>
<label value="&username.label;"
accesskey="&username.accessKey;" control="UsernameInput"/>
<textbox id="UsernameInput" class="MinWidth10em" flex="1" oninput="onInputSettings();"/>
</row>
<row align="center">
<label value="&password.label;"/>
<label value="&password.label;"
accesskey="&password.accessKey;" control="PasswordInput"/>
<hbox>
<textbox id="PasswordInput" type="password" class="MinWidth5em" oninput="onInputSettings();"/>
<checkbox id="SavePassword" label="&savePassword.label;" oncommand="onInputSettings();"/>
<checkbox id="SavePassword" label="&savePassword.label;"
accesskey="&savePassword.accessKey;" oncommand="onInputSettings();"/>
</hbox>
</row>
</rows>

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

@ -51,16 +51,22 @@
<hbox id="SettingsPanel">
<groupbox align="center">
<caption label="&publishSites.label;"/>
<caption>
<label value="&publishSites.label;"
accesskey="&siteNameList.accessKey;" control="SiteList"/>
</caption>
<!-- XXX: If tree isn't wrapped in vbox, it appears BELOW next vbox -->
<vbox flex="1">
<listbox rows="4" id="SiteList" flex="1" onselect="SelectSiteList();"/>
</vbox>
<hbox pack="center">
<vbox>
<button id="NewSiteButton" label="&newSiteButton.label;" oncommand="AddNewSite();"/>
<button id="SetDefaultButton" label="&setDefaultButton.label;" oncommand="SetDefault();"/>
<button id="RemoveSiteButton" label="&removeButton.label;" oncommand="RemoveSite();"/>
<button id="NewSiteButton" label="&newSiteButton.label;"
accesskey="&newSiteButton.accessKey;" oncommand="AddNewSite();"/>
<button id="SetDefaultButton" label="&setDefaultButton.label;"
accesskey="&setDefaultButton.accessKey;" oncommand="SetDefault();"/>
<button id="RemoveSiteButton" label="&removeButton.label;"
accesskey="&removeButton.accessKey;" oncommand="RemoveSite();"/>
</vbox>
</hbox>
</groupbox>