Bug 183632 Improve error dialog from Address Selection for card without email address

r=neil sr=bienvenu patch by Mark Banner <mark@standard8.demon.co.uk>
This commit is contained in:
cbiesinger%web.de 2004-12-28 14:20:43 +00:00
Родитель 47d7110411
Коммит 12dedfb94b
2 изменённых файлов: 36 добавлений и 24 удалений

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

@ -45,6 +45,7 @@ var msgCompFields = 0;
var editCardCallback = 0;
var gAddressBookBundle;
var gPromptService = GetPromptService();
var gSearchInput;
var gSearchTimer = null;
@ -164,6 +165,7 @@ function AddAddressFromComposeWindow(addresses, prefix)
function SelectAddressOKButton()
{
// Empty email checks are now done in AddAddressIntoBucket below.
var body = document.getElementById('bucketBody');
var item, row, cell, prefix, address, email;
var toAddress="", ccAddress="", bccAddress="", emptyEmail="";
@ -201,21 +203,9 @@ function SelectAddressOKButton()
break;
}
}
if(!email)
{
if (emptyEmail)
emptyEmail +=", ";
emptyEmail += text.substring(prefixTo.length, text.length-2);
}
}
}
}
if(emptyEmail)
{
var alertText = gAddressBookBundle.getString("emptyEmailCard");
alert(alertText + emptyEmail);
return false;
}
// reset the UI in compose window
msgCompFields.to = toAddress;
msgCompFields.cc = ccAddress;
@ -266,19 +256,29 @@ function AddCardIntoBucket(prefix, card)
function AddAddressIntoBucket(prefix, address, email)
{
var body = document.getElementById("bucketBody");
if (email == "")
{
if (gPromptService)
gPromptService.alert(window,
gAddressBookBundle.getString("emptyEmailAddCardTitle"),
gAddressBookBundle.getString("emptyEmailAddCard"));
}
else
{
var body = document.getElementById("bucketBody");
var item = document.createElement('treeitem');
var row = document.createElement('treerow');
var cell = document.createElement('treecell');
cell.setAttribute('label', prefix + address);
cell.setAttribute('prefix', prefix);
cell.setAttribute('address', address);
cell.setAttribute('email', email);
var item = document.createElement('treeitem');
var row = document.createElement('treerow');
var cell = document.createElement('treecell');
cell.setAttribute('label', prefix + address);
cell.setAttribute('prefix', prefix);
cell.setAttribute('address', address);
cell.setAttribute('email', email);
row.appendChild(cell);
item.appendChild(row);
body.appendChild(item);
row.appendChild(cell);
item.appendChild(row);
body.appendChild(item);
}
}
function RemoveSelectedFromBucket()
@ -465,3 +465,14 @@ function DirPaneSelectionChangeMenulist()
ChangeDirectoryByURI(abList.selectedItem.id);
}
}
function GetPromptService()
{
try {
return Components.classes["@mozilla.org/embedcomp/prompt-service;1"]
.getService(Components.interfaces.nsIPromptService);
}
catch (e) {
return null;
}
}

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

@ -99,7 +99,8 @@ stateZipSeparator=
prefixTo=To
prefixCc=Cc
prefixBcc=Bcc
emptyEmailCard=Please remove the following cards with no email address :
emptyEmailAddCard=You cannot add a card that has no primary email address
emptyEmailAddCardTitle=Cannot Add Card
addressBook=Address Book
# mailnews.js