Bug 397194 Make the local address book properties (new/edit) dialogs stand-alone (Thunderbird part). r/sr=mscott

git-svn-id: svn://10.0.0.236/trunk@239067 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
bugzilla%standard8.plus.com
2007-11-09 16:51:01 +00:00
parent b149db31bc
commit f2e3294ccd
6 changed files with 10 additions and 174 deletions

View File

@@ -1,57 +0,0 @@
var okCallback = 0;
var gCanRename = true;
var gOkButton;
var gNameInput;
function abNameOnLoad()
{
var abName = "";
gOkButton = document.documentElement.getButton('accept');
// look in arguments[0] for parameters
if ("arguments" in window && window.arguments[0])
{
if ("title" in window.arguments[0])
document.title = window.arguments[0].title;
if ("okCallback" in window.arguments[0])
top.okCallback = window.arguments[0].okCallback;
if ("name" in window.arguments[0])
abName = window.arguments[0].name;
if ("canRename" in window.arguments[0])
gCanRename = window.arguments[0].canRename;
}
// focus on input
gNameInput = document.getElementById('name');
if (gNameInput) {
if (abName)
gNameInput.value = abName;
if (gCanRename)
gNameInput.focus();
else
gNameInput.disabled = true;
}
abNameDoOkEnabling()
moveToAlertPosition();
}
function abNameOKButton()
{
if (top.okCallback && gCanRename)
top.okCallback(gNameInput.value.replace(/^\s+|\s+$/g, ''));
return true;
}
function abNameDoOkEnabling()
{
gOkButton.disabled = !/\S/.test(gNameInput.value);
}

View File

@@ -1,57 +0,0 @@
<?xml version="1.0"?>
# ***** BEGIN LICENSE BLOCK *****
# Version: MPL 1.1/GPL 2.0/LGPL 2.1
#
# The contents of this file are subject to the Mozilla 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/MPL/
#
# 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 the Initial Developer are Copyright (C) 1998-1999
# the Initial Developer. All Rights Reserved.
#
# Contributor(s):
#
# Alternatively, the contents of this file may be used under the terms of
# either the GNU General Public License Version 2 or later (the "GPL"), or
# the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
# in which case the provisions of the GPL or the LGPL are applicable instead
# of those above. If you wish to allow use of your version of this file only
# under the terms of either the GPL or the LGPL, and not to allow others to
# use your version of this file under the terms of the MPL, indicate your
# decision by deleting the provisions above and replace them with the notice
# and other provisions required by the GPL or the LGPL. If you do not delete
# the provisions above, a recipient may use your version of this file under
# the terms of any one of the MPL, the GPL or the LGPL.
#
# ***** END LICENSE BLOCK *****
<?xml-stylesheet href="chrome://messenger/skin/" type="text/css"?>
<!DOCTYPE dialog SYSTEM "chrome://messenger/locale/addressbook/abAddressBookNameDialog.dtd">
<dialog xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
title="&name.label;"
onload="abNameOnLoad();"
ondialogaccept="return abNameOKButton();">
<script type="application/x-javascript" src="chrome://messenger/content/addressbook/abAddressBookNameDialog.js"/>
<hbox align="center">
<label control="name" value="&name.label;"/>
<textbox tabindex="0" oninput="abNameDoOkEnabling();" id="name"/>
</hbox>
</dialog>

View File

@@ -298,7 +298,10 @@ function AbEditSelectedDirectory()
"editDirectory", "chrome,modal=yes,resizable=no,centerscreen", { selectedDirectory: directory });
}
else {
AbRenameAddressBook();
window.openDialog(
"chrome://messenger/content/addressbook/abAddressBookNameDialog.xul",
"", "chrome,modal=yes,resizable=no,centerscreen",
{selectedDirectory: directory});
}
}
}

View File

@@ -347,63 +347,9 @@ function AbNewLDAPDirectory()
function AbNewAddressBook()
{
var strBundleService = Components.classes["@mozilla.org/intl/stringbundle;1"].
getService(Components.interfaces.nsIStringBundleService);
var bundle = strBundleService.createBundle("chrome://messenger/locale/addressbook/addressBook.properties");
var dialogTitle = bundle.GetStringFromName('newAddressBookTitle');
var dialog = window.openDialog(
window.openDialog(
"chrome://messenger/content/addressbook/abAddressBookNameDialog.xul",
"", "chrome,modal=yes,resizable=no,centerscreen", {title: dialogTitle, okCallback:AbOnCreateNewAddressBook});
}
function AbRenameAddressBook()
{
var selectedABURI = GetSelectedDirectory();
// the rdf service
var RDF = Components.classes["@mozilla.org/rdf/rdf-service;1"].getService(Components.interfaces.nsIRDFService);
// the RDF resource URI for LDAPDirectory will be like: "moz-abmdbdirectory://abook-3.mab"
var selectedABDirectory = RDF.GetResource(selectedABURI).QueryInterface(Components.interfaces.nsIAbDirectory);
var strBundleService = Components.classes["@mozilla.org/intl/stringbundle;1"].
getService(Components.interfaces.nsIStringBundleService);
var bundle = strBundleService.createBundle("chrome://messenger/locale/addressbook/addressBook.properties");
var dialogTitle = bundle.GetStringFromName('renameAddressBookTitle');
// you can't rename the PAB or the CAB
var canRename = (selectedABURI != kCollectedAddressbookURI && selectedABURI != kPersonalAddressbookURI);
var dialog = window.openDialog(
"chrome://messenger/content/addressbook/abAddressBookNameDialog.xul",
"", "chrome,modal=yes,resizable=no,centerscreen", {title: dialogTitle, canRename: canRename, name: selectedABDirectory.dirName,
okCallback:AbOnRenameAddressBook});
}
function AbOnCreateNewAddressBook(aName)
{
Components.classes["@mozilla.org/addressbook;1"]
.createInstance(Components.interfaces.nsIAddressBook)
.newAddressBook(aName, "", kPABDirectory);
}
function AbOnRenameAddressBook(aName)
{
var selectedABURI = GetSelectedDirectory();
// the rdf service
var RDF = Components.classes["@mozilla.org/rdf/rdf-service;1"].getService(Components.interfaces.nsIRDFService);
// get the datasource for the addressdirectory
var addressbookDS = RDF.GetDataSource("rdf:addressdirectory");
// moz-abdirectory:// is the RDF root to get all types of addressbooks.
var parentDir = RDF.GetResource("moz-abdirectory://").QueryInterface(Components.interfaces.nsIAbDirectory);
// the RDF resource URI for LDAPDirectory will be like: "moz-abmdbdirectory://abook-3.mab"
var selectedABDirectory = RDF.GetResource(selectedABURI).QueryInterface(Components.interfaces.nsIAbDirectory);
selectedABDirectory.dirName = aName;
"", "chrome,modal=yes,resizable=no,centerscreen", null);
}
function AbPrintCardInternal(doPrintPreview, msgType)

View File

@@ -4,8 +4,6 @@ messenger.jar:
* content/messenger/addressbook/addressbook.xul (content/addressbook.xul)
* content/messenger/addressbook/abCommon.js (content/abCommon.js)
* content/messenger/addressbook/abCardOverlay.js (content/abCardOverlay.js)
content/messenger/addressbook/abAddressBookNameDialog.js (content/abAddressBookNameDialog.js)
* content/messenger/addressbook/abAddressBookNameDialog.xul (content/abAddressBookNameDialog.xul)
* content/messenger/addressbook/abEditListDialog.xul (content/abEditListDialog.xul)
* content/messenger/addressbook/abMailListDialog.xul (content/abMailListDialog.xul)
* content/messenger/addressbook/abContactsPanel.xul (content/abContactsPanel.xul)
@@ -14,6 +12,8 @@ messenger.jar:
content/messenger/addressbook/pref-directory-add.js (/mailnews/addrbook/prefs/resources/content/pref-directory-add.js)
content/messenger/addressbook/pref-directory-add.xul (/mailnews/addrbook/prefs/resources/content/pref-directory-add.xul)
content/messenger/addressbook/pref-editdirectories.xul (/mailnews/addrbook/prefs/resources/content/pref-editdirectories.xul)
content/messenger/addressbook/abAddressBookNameDialog.js (/mailnews/addrbook/resources/content/abAddressBookNameDialog.js)
content/messenger/addressbook/abAddressBookNameDialog.xul (/mailnews/addrbook/resources/content/abAddressBookNameDialog.xul)
content/messenger/addressbook/abNewCardDialog.xul (/mailnews/addrbook/resources/content/abNewCardDialog.xul)
content/messenger/addressbook/abEditCardDialog.xul (/mailnews/addrbook/resources/content/abEditCardDialog.xul)
content/messenger/addressbook/abCardOverlay.xul (/mailnews/addrbook/resources/content/abCardOverlay.xul)

View File

@@ -36,4 +36,5 @@
***** END LICENSE BLOCK ***** -->
<!-- Labels -->
<!ENTITY name.label "Address Book Name">
<!ENTITY name.label "Address Book Name:">
<!ENTITY name.accesskey "A">