Clean up new/rename folder dialogs in mail/news (bug 60642), give focus to textfield (bug 60476) and fix warning (bug 60644), r=racham, a=ben, many thanks to Fabian for his help in writing these patches

This commit is contained in:
disttsc%bart.nl 2000-12-16 00:42:48 +00:00
Родитель 626434ad55
Коммит e8fc5aa2d2
14 изменённых файлов: 437 добавлений и 50 удалений

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

@ -288,7 +288,7 @@ function GetNextNMessages(folder)
dump("### nodeList is invalid\n");
}
function CreateNewSubfolder(chromeWindowURL,windowTitle, preselectedMsgFolder,
function CreateNewSubfolder(chromeWindowURL, preselectedMsgFolder,
dualUseFolders)
{
var preselectedURI;
@ -305,9 +305,9 @@ function CreateNewSubfolder(chromeWindowURL,windowTitle, preselectedMsgFolder,
chromeWindowURL,
"",
"chrome,titlebar,modal",
{preselectedURI:preselectedURI, title:windowTitle,
dualUseFolders:dualUseFolders,
okCallback:NewFolder});
{preselectedURI:preselectedURI,
dualUseFolders:dualUseFolders,
okCallback:NewFolder});
}
function NewFolder(name,uri)
@ -333,7 +333,7 @@ function NewFolder(name,uri)
}
}
function Subscribe(windowTitle, preselectedMsgFolder)
function Subscribe(preselectedMsgFolder)
{
var preselectedURI;
@ -347,8 +347,8 @@ function Subscribe(windowTitle, preselectedMsgFolder)
window.openDialog("chrome://messenger/content/subscribe.xul",
"subscribe", "chrome,modal,titlebar,resizable=yes",
{preselectedURI:preselectedURI, title:windowTitle,
okCallback:SubscribeOKCallback});
{preselectedURI:preselectedURI,
okCallback:SubscribeOKCallback});
}
function SubscribeOKCallback(changeTable)

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

@ -413,7 +413,6 @@ function MsgHome(url)
function MsgNewFolder()
{
var windowTitle = Bundle.GetStringFromName("newFolderDialogTitle");
var preselectedFolder = GetFirstSelectedMsgFolder();
var dualUseFolders = true;
var server = null;
@ -437,7 +436,7 @@ function MsgNewFolder()
}
}
CreateNewSubfolder("chrome://messenger/content/newFolderNameDialog.xul",windowTitle, destinationFolder, dualUseFolders);
CreateNewSubfolder("chrome://messenger/content/newFolderDialog.xul", destinationFolder, dualUseFolders);
}
@ -487,9 +486,8 @@ function getDestinationFolder(preselectedFolder, server)
function MsgSubscribe()
{
var windowTitle = Bundle.GetStringFromName("subscribeDialogTitle");
var preselectedFolder = GetFirstSelectedMsgFolder();
Subscribe(windowTitle, preselectedFolder);
Subscribe(preselectedFolder);
}
function MsgSaveAsFile()

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

@ -23,7 +23,6 @@
var pickerBundle = srGetStrBundle("chrome://messenger/locale/messenger.properties");
// call this from dialog onload() to set the menu item to the correct value
function MsgFolderPickerOnLoad(pickerID)
{
@ -79,28 +78,30 @@ function SetFolderPicker(uri,pickerID)
if (!msgfolder) return;
var selectedValue = null;
var serverName;
if (msgfolder.isServer)
selectedValue = msgfolder.name;
else {
if (msgfolder.server)
serverName = msgfolder.server.prettyName;
else {
dump("Cant' find server for " + uri + "\n");
serverName = "???";
}
serverName = msgfolder.server.prettyName;
else {
dump("Cant' find server for " + uri + "\n");
serverName = "???";
}
selectedValue =
pickerBundle.formatStringFromName("verboseFolderFormat",
[ msgfolder.name,
serverName ], 2);
selectedValue = pickerBundle.GetStringFromName("verboseFolderFormat")
.replace(/%folderName%/, msgfolder.name)
.replace(/%serverName%/, serverName);
}
picker.setAttribute("value",selectedValue);
picker.setAttribute("uri",uri);
if (pickerID == "msgNewFolderPicker") {
window.resizeTo(0,0);
window.sizeToContent();
}
if (pickerID == "msgNewFolderPicker") {
// XXX Ugly hack to make sizeToContent work, see bug 62987
window.resizeTo(0,0);
window.sizeToContent();
}
}

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

@ -0,0 +1,111 @@
/* -*- Mode: Java; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
*
* The contents of this file are subject to the Netscape Public
* License Version 1.1 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.mozilla.org/NPL/
*
* Software distributed under the License is distributed on an "AS
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
* implied. See the License for the specific language governing
* rights and limitations under the License.
*
* The Original Code is Mozilla Communicator client code, released
* March 31, 1998.
*
* The Initial Developer of the Original Code is Netscape
* Communications Corporation. Portions created by Netscape are
* Copyright (C) 1998-1999 Netscape Communications Corporation. All
* Rights Reserved.
*
* Contributor(s):
* Fabian Guisset <hidday@geocities.com>
*/
const FOLDERS = 1;
const MESSAGES = 2;
var dialog;
function onLoad()
{
var arguments = window.arguments[0];
dialog = {};
dialog.OKButton = document.getElementById("ok");
dialog.nameField = document.getElementById("name");
dialog.nameField.focus();
// call this when OK is pressed
dialog.okCallback = arguments.okCallback;
// pre select the folderPicker, based on what they selected in the folder pane
dialog.picker = document.getElementById("msgNewFolderPicker");
MsgFolderPickerOnLoad("msgNewFolderPicker");
// can folders contain both folders and messages?
if (arguments.dualUseFolders) {
dialog.folderType = FOLDERS | MESSAGES;
} else {
// set our folder type by calling the default selected type's oncommand
var selectedFolderType = document.getElementById("folderGroup").selectedItem;
eval(selectedFolderType.getAttribute("oncommand"));
// show the section which allows us to select the folder type to create
var newFolderTypeBox = document.getElementById("newFolderTypeBox");
newFolderTypeBox.setAttribute("hidden", "false");
}
// XXX Ugly hack to make sizeToContent work, see bug 62987
window.resizeTo(0, 0);
window.sizeToContent();
moveToAlertPosition();
doEnabling();
doSetOKCancel(onOK, onCancel);
}
function onOK()
{
var name = dialog.nameField.value;
var uri = dialog.picker.getAttribute("uri");
// do name validity check?
// make sure name ends in "/" if folder to create can only contain folders
if ((dialog.folderType == FOLDERS) && name.charAt(name.length-1) != "/")
dialog.okCallback(name + "/", uri);
else
dialog.okCallback(name, uri);
return true;
}
function onCancel()
{
// close the window
return true;
}
function onFoldersOnly()
{
dialog.folderType = FOLDERS;
}
function onMessagesOnly()
{
dialog.folderType = MESSAGES;
}
function doEnabling()
{
if (dialog.nameField.value && dialog.picker.getAttribute("uri")) {
if (dialog.OKButton.disabled)
dialog.OKButton.disabled = false;
} else {
if (!dialog.OKButton.disabled)
dialog.OKButton.disabled = true;
}
}

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

@ -0,0 +1,86 @@
<?xml version="1.0"?>
<!--
- The contents of this file are subject to the Netscape Public
- License Version 1.1 (the "License"); you may not use this file
- except in compliance with the License. You may obtain a copy of
- the License at http://www.mozilla.org/NPL/
-
- Software distributed under the License is distributed on an "AS
- IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
- implied. See the License for the specific language governing
- rights and limitations under the License.
-
- The Original Code is Mozilla Communicator client code, released
- March 31, 1998.
-
- The Initial Developer of the Original Code is Netscape
- Communications Corporation. Portions created by Netscape are
- Copyright (C) 1998-1999 Netscape Communications Corporation. All
- Rights Reserved.
-
- Contributor(s):
- Fabian Guisset <hidday@geocities.com>
-->
<?xml-stylesheet href="chrome://messenger/skin/messenger.css" type="text/css"?>
<?xul-overlay href="chrome://global/content/dialogOverlay.xul"?>
<?xul-overlay href="chrome://messenger/content/msgFolderPickerOverlay.xul"?>
<!DOCTYPE window SYSTEM "chrome://messenger/locale/newFolderDialog.dtd">
<window xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
title="&newFolderDialog.title;"
align="vertical"
class="dialog"
onload="onLoad();">
<script type="text/javascript" src="chrome://global/content/strres.js"/>
<script type="text/javascript" src="chrome://messenger/content/mailCommands.js"/>
<script type="text/javascript" src="chrome://messenger/content/newFolderDialog.js"/>
<keyset id="keyset"/>
<box align="vertical">
<spring flex="1"/>
<text value="&name.label;" class="label" accesskey="&name.accesskey;" for="name"/>
<textfield tabindex="0" id="name" oninput="doEnabling();"/>
<separator/>
<text value="&description.label;" class="label" accesskey="&description.accesskey;" for="msgNewFolderPicker"/>
<box align="horizontal">
<menu id="msgNewFolderPicker" oncommand="doEnabling(); window.sizeToContent();"/>
<spring flex="1"/>
</box>
<box align="vertical" orient="vertical" hidden="true" id="newFolderTypeBox">
<separator class="thin"/>
<text value="&folderRestriction1.label;"/>
<text value="&folderRestriction2.label;"/>
<separator class="thin"/>
<radiogroup id="folderGroup">
<radio group="folderGroup" oncommand="onFoldersOnly();" value="&foldersOnly.label;"/>
<radio group="folderGroup" oncommand="onMessagesOnly();" value="&messagesOnly.label;" checked="true"/>
<spring flex="100%"/>
</radiogroup>
</box>
<spring flex="1"/>
<separator/>
<box id="okCancelButtonsRight"/>
</box>
</window>

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

@ -0,0 +1,75 @@
/* -*- Mode: Java; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
*
* The contents of this file are subject to the Netscape Public
* License Version 1.1 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.mozilla.org/NPL/
*
* Software distributed under the License is distributed on an "AS
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
* implied. See the License for the specific language governing
* rights and limitations under the License.
*
* The Original Code is Mozilla Communicator client code, released
* March 31, 1998.
*
* The Initial Developer of the Original Code is Netscape
* Communications Corporation. Portions created by Netscape are
* Copyright (C) 1998-1999 Netscape Communications Corporation. All
* Rights Reserved.
*
* Contributor(s):
* Fabian Guisset <hidday@geocities.com>
*/
var dialog;
function onLoad()
{
var arguments = window.arguments[0];
dialog = {};
dialog.OKButton = document.getElementById("ok");
dialog.nameField = document.getElementById("name");
dialog.nameField.value = arguments.name;
dialog.nameField.select();
dialog.nameField.focus();
// call this when OK is pressed
dialog.okCallback = arguments.okCallback;
// pre select the folderPicker, based on what they selected in the folder pane
dialog.preselectedFolderURI = arguments.preselectedURI;
window.sizeToContent();
moveToAlertPosition();
doEnabling();
doSetOKCancel(onOK, onCancel);
}
function onOK()
{
dialog.okCallback(dialog.nameField.value, dialog.preselectedFolderURI);
return true;
}
function onCancel()
{
// close the window
return true;
}
function doEnabling()
{
if (dialog.nameField.value) {
if (dialog.OKButton.disabled)
dialog.OKButton.disabled = false;
} else {
if (!dialog.OKButton.disabled)
dialog.OKButton.disabled = true;
}
}

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

@ -0,0 +1,58 @@
<?xml version="1.0"?> <!-- -*- Mode: xml; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- -->
<!--
- The contents of this file are subject to the Netscape Public
- License Version 1.1 (the "License"); you may not use this file
- except in compliance with the License. You may obtain a copy of
- the License at http://www.mozilla.org/NPL/
-
- Software distributed under the License is distributed on an "AS
- IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
- implied. See the License for the specific language governing
- rights and limitations under the License.
-
- The Original Code is Mozilla Communicator client code, released
- March 31, 1998.
-
- The Initial Developer of the Original Code is Netscape
- Communications Corporation. Portions created by Netscape are
- Copyright (C) 1998-1999 Netscape Communications Corporation. All
- Rights Reserved.
-
- Contributor(s):
- Fabian Guisset <hidday@geocities.com>
-->
<?xml-stylesheet href="chrome://messenger/skin/messenger.css" type="text/css"?>
<?xul-overlay href="chrome://global/content/dialogOverlay.xul"?>
<?xul-overlay href="chrome://messenger/content/msgFolderPickerOverlay.xul"?>
<!DOCTYPE window SYSTEM "chrome://messenger/locale/renameFolderDialog.dtd">
<window xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
title="&renameFolderDialog.title;"
align="vertical"
class="dialog"
onload="onLoad();">
<script type="text/javascript" src="chrome://global/content/strres.js"/>
<script type="text/javascript" src="chrome://messenger/content/mailCommands.js"/>
<script type="text/javascript" src="chrome://messenger/content/renameFolderDialog.js"/>
<keyset id="keyset"/>
<box align="vertical">
<spring flex="100%"/>
<text value="&rename.label;" class="label" accesskey="&rename.accesskey;" for="name"/>
<textfield tabindex="0" id="name" oninput="doEnabling();"/>
<spring flex="100%"/>
<box id="okCancelButtons"/>
</box>
</window>

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

@ -29,6 +29,7 @@ Rights Reserved.
<window xmlns:NC="http://home.netscape.com/NC-rdf#"
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
title="subscribeDialog.title;"
orient="vertical"
class="dialog"
width="500"

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

@ -40,8 +40,6 @@ function ConvertDOMListToResourceArray(nodeList)
return result;
}
function GetSelectedFolderURI()
{
var uri = null;
@ -85,13 +83,12 @@ function MsgRenameFolder()
var name = GetFolderNameFromUri(preselectedURI, folderTree);
dump("preselectedURI = " + preselectedURI + "\n");
var windowTitle = Bundle.GetStringFromName("renameFolderDialogTitle");
var dialog = window.openDialog(
"chrome://messenger/content/renameFolderNameDialog.xul",
"newFolder",
"chrome,titlebar,modal",
{preselectedURI:preselectedURI, title:windowTitle,
okCallback:RenameFolder, name:name});
"chrome://messenger/content/renameFolderDialog.xul",
"newFolder",
"chrome,titlebar,modal",
{preselectedURI: preselectedURI,
okCallback: RenameFolder, name: name});
}
function RenameFolder(name,uri)

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

@ -22,9 +22,6 @@
#
# The following are used by the messenger application
#
newFolderDialogTitle=New Folder
subscribeDialogTitle=Subscribe
renameFolderDialogTitle=Rename Folder
renameAccount=Rename Account...
renameNewsAccount=Rename News Account...
renameFolder=Rename Folder...
@ -60,7 +57,8 @@ saveMessageFailed=Unable to save the message. Please check your file name and tr
notDownloaded=(Not Downloaded)
fileExists=%S already exists. Do you want to replace it?
verboseFolderFormat=%S on %S
# LOCALIZATION NOTES(verboseFolderFormat): Do not translate "%folderName%" nor "%serverName%" in the line below
verboseFolderFormat=%folderName% on %serverName%
defaultServerTag=(Default)
useDefaultServer=Use default server

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

@ -0,0 +1,33 @@
<!--
- The contents of this file are subject to the Netscape Public
- License Version 1.1 (the "License"); you may not use this file
- except in compliance with the License. You may obtain a copy of
- the License at http://www.mozilla.org/NPL/
-
- Software distributed under the License is distributed on an "AS
- IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
- implied. See the License for the specific language governing
- rights and limitations under the License.
-
- The Original Code is Mozilla Communicator client code, released
- March 31, 1998.
-
- The Initial Developer of the Original Code is Netscape
- Communications Corporation. Portions created by Netscape are
- Copyright (C) 1998-1999 Netscape Communications Corporation. All
- Rights Reserved.
-
- Contributor(s):
- Fabian Guisset <hidday@geocities.com>
-->
<!-- Labels -->
<!ENTITY newFolderDialog.title "New Folder">
<!ENTITY name.label "Name:">
<!ENTITY name.accesskey "n">
<!ENTITY description.label "Create as a subfolder of:">
<!ENTITY description.accesskey "c">
<!ENTITY folderRestriction1.label "This server restricts folders to two special kinds.">
<!ENTITY folderRestriction2.label "Allow your new folder to contain:">
<!ENTITY foldersOnly.label "Folders Only">
<!ENTITY messagesOnly.label "Messages Only">

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

@ -0,0 +1,26 @@
<!--
- The contents of this file are subject to the Netscape Public
- License Version 1.1 (the "License"); you may not use this file
- except in compliance with the License. You may obtain a copy of
- the License at http://www.mozilla.org/NPL/
-
- Software distributed under the License is distributed on an "AS
- IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
- implied. See the License for the specific language governing
- rights and limitations under the License.
-
- The Original Code is Mozilla Communicator client code, released
- March 31, 1998.
-
- The Initial Developer of the Original Code is Netscape
- Communications Corporation. Portions created by Netscape are
- Copyright (C) 1998-1999 Netscape Communications Corporation. All
- Rights Reserved.
-
- Contributor(s):
- Fabian Guisset <hidday@geocities.com>
-->
<!ENTITY renameFolderDialog.title "Rename Folder">
<!ENTITY rename.label "Enter the new name for your folder:">
<!ENTITY rename.accesskey "e">

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

@ -18,10 +18,11 @@ Communications Corporation. Portions created by Netscape are
Rights Reserved.
-->
<!ENTITY subscribeButton.label "Subscribe">
<!ENTITY unsubscribeButton.label "Unsubscribe">
<!ENTITY subscribeDialog.title "Subscribe">
<!ENTITY subscribeButton.label "Subscribe">
<!ENTITY unsubscribeButton.label "Unsubscribe">
<!ENTITY refreshButton.label "Refresh">
<!ENTITY stopButton.label "Stop">
<!ENTITY server.label "Server:">
<!ENTITY subscribedHeader.label "Subscribe">
<!ENTITY subscribedHeader.label "Subscribe">
<!ENTITY messagesHeader.label "Messages">

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

@ -1,7 +1,7 @@
messenger.jar:
content/messenger/contents.rdf (base/resources/content/contents.rdf)
content/messenger/addressbook/pref-addressing.xul (addrbook/prefs/resources/content/pref-addressing.xul)
content/messenger/addressbook/pref-addressbookOverlay.xul (addrbook/prefs/resources/content/pref-addressbookOverlay.xul)
content/messenger/addressbook/pref-addressing.xul (addrbook/prefs/resources/content/pref-addressing.xul)
content/messenger/addressbook/pref-addressbookOverlay.xul (addrbook/prefs/resources/content/pref-addressbookOverlay.xul)
content/messenger/addressbook/abAddressBookNameDialog.js (addrbook/resources/content/abAddressBookNameDialog.js)
content/messenger/addressbook/abAddressBookNameDialog.xul (addrbook/resources/content/abAddressBookNameDialog.xul)
content/messenger/addressbook/abCardOverlay.js (addrbook/resources/content/abCardOverlay.js)
@ -95,14 +95,15 @@ messenger.jar:
content/messenger/subscribe.xul (base/resources/content/subscribe.xul)
content/messenger/subscribe.js (base/resources/content/subscribe.js)
content/messenger/sidebar-messenger.rdf (base/resources/content/sidebar-messenger.rdf)
content/messenger/newFolderNameDialog.xul (base/resources/content/newFolderNameDialog.xul)
content/messenger/newFolderNameDialog.js (base/resources/content/newFolderNameDialog.js)
content/messenger/newFolderDialog.xul (base/resources/content/newFolderDialog.xul)
content/messenger/newFolderDialog.js (base/resources/content/newFolderDialog.js)
content/messenger/msgViewNavigation.js (base/resources/content/msgViewNavigation.js)
content/messenger/msgMail3PaneWindow.js (base/resources/content/msgMail3PaneWindow.js)
content/messenger/mail3PaneWindowCommands.js (base/resources/content/mail3PaneWindowCommands.js)
content/messenger/msgFolderPickerOverlay.js (base/resources/content/msgFolderPickerOverlay.js)
content/messenger/msgFolderPickerOverlay.xul (base/resources/content/msgFolderPickerOverlay.xul)
content/messenger/renameFolderNameDialog.xul (base/resources/content/renameFolderNameDialog.xul)
content/messenger/renameFolderDialog.xul (base/resources/content/renameFolderDialog.xul)
content/messenger/renameFolderDialog.js (base/resources/content/renameFolderDialog.js)
content/messenger/messengerdnd.js (base/resources/content/messengerdnd.js)
content/messenger/mailContextMenus.js (base/resources/content/mailContextMenus.js)
content/messenger/msgPrintEngine.js (base/resources/content/msgPrintEngine.js)
@ -151,10 +152,10 @@ messenger.jar:
content/messenger/downloadheaders.xul (news/resources/content/downloadheaders.xul)
content/messenger/imapTest.js (base/resources/content/imapTest.js)
content/messenger/imapTest.xul (base/resources/content/imapTest.xul)
content/messenger/popTest.js (base/resources/content/popTest.js)
content/messenger/popTest.xul (base/resources/content/popTest.xul)
content/messenger/pref-advanced_overlay.xul (base/prefs/resources/content/pref-advanced_overlay.xul)
content/messenger/pref-appearance_overlay.xul (base/prefs/resources/content/pref-appearance_overlay.xul)
content/messenger/popTest.js (base/resources/content/popTest.js)
content/messenger/popTest.xul (base/resources/content/popTest.xul)
content/messenger/pref-advanced_overlay.xul (base/prefs/resources/content/pref-advanced_overlay.xul)
content/messenger/pref-appearance_overlay.xul (base/prefs/resources/content/pref-appearance_overlay.xul)
en-US.jar:
locale/en-US/messenger/contents.rdf (base/resources/locale/en-US/contents.rdf)
@ -172,8 +173,9 @@ en-US.jar:
locale/en-US/messenger/messenger.properties (base/resources/locale/en-US/messenger.properties)
locale/en-US/messenger/threadpane.dtd (base/resources/locale/en-US/threadpane.dtd)
locale/en-US/messenger/folderpane.dtd (base/resources/locale/en-US/folderpane.dtd)
locale/en-US/messenger/newFolderDialog.dtd (base/resources/locale/en-US/newFolderDialog.dtd)
locale/en-US/messenger/renameFolderDialog.dtd (base/resources/locale/en-US/renameFolderDialog.dtd)
locale/en-US/messenger/folderProps.dtd (base/resources/locale/en-US/folderProps.dtd)
locale/en-US/messenger/newFolderNameDialog.dtd (base/resources/locale/en-US/newFolderNameDialog.dtd)
locale/en-US/messenger/subscribe.dtd (base/resources/locale/en-US/subscribe.dtd)
locale/en-US/messenger/subscribe.properties (base/resources/locale/en-US/subscribe.properties)
locale/en-US/messenger/sidebar-messenger.dtd (base/resources/locale/en-US/sidebar-messenger.dtd)