зеркало из https://github.com/mozilla/pjs.git
Port vcard UI to thunderbird: Bug #221319.
This commit is contained in:
Родитель
5d7862c593
Коммит
b588387717
|
@ -40,12 +40,21 @@ var editCard;
|
|||
var gOnSaveListeners = new Array;
|
||||
var gOkCallback = null;
|
||||
var gAddressBookBundle;
|
||||
var gHideABPicker = false;
|
||||
|
||||
function OnLoadNewCard()
|
||||
{
|
||||
InitEditCard();
|
||||
|
||||
var cardproperty = Components.classes["@mozilla.org/addressbook/cardproperty;1"].createInstance(Components.interfaces.nsIAbCard);
|
||||
var cardproperty;
|
||||
|
||||
// if one is passed in, use it
|
||||
try {
|
||||
cardproperty = window.arguments[0].QueryInterface(Components.interfaces.nsIAbCard);
|
||||
}
|
||||
catch (ex) {
|
||||
cardproperty = Components.classes["@mozilla.org/addressbook/cardproperty;1"].createInstance(Components.interfaces.nsIAbCard);
|
||||
}
|
||||
|
||||
editCard.card = cardproperty;
|
||||
editCard.titleProperty = "newCardTitle";
|
||||
|
@ -94,6 +103,20 @@ function OnLoadNewCard()
|
|||
}
|
||||
if ("aimScreenName" in window.arguments[0])
|
||||
editCard.card.aimScreenName = window.arguments[0].aimScreenName;
|
||||
|
||||
if ("okCallback" in window.arguments[0])
|
||||
gOkCallback = window.arguments[0].okCallback;
|
||||
|
||||
if ("escapedVCardStr" in window.arguments[0]) {
|
||||
var addressbook = Components.classes["@mozilla.org/addressbook;1"].createInstance(Components.interfaces.nsIAddressBook);
|
||||
editCard.card = addressbook.escapedVCardToAbCard(window.arguments[0].escapedVCardStr);
|
||||
}
|
||||
|
||||
if ("titleProperty" in window.arguments[0])
|
||||
editCard.titleProperty = window.arguments[0].titleProperty;
|
||||
|
||||
if ("hideABPicker" in window.arguments[0])
|
||||
gHideABPicker = window.arguments[0].hideABPicker;
|
||||
}
|
||||
|
||||
// set popup with address book names
|
||||
|
@ -122,6 +145,14 @@ function OnLoadNewCard()
|
|||
}
|
||||
}
|
||||
|
||||
if (gHideABPicker && abPopup) {
|
||||
abPopup.hidden = true;
|
||||
var abPopupLabel = document.getElementById("abPopupLabel");
|
||||
abPopupLabel.hidden = true;
|
||||
}
|
||||
|
||||
SetCardDialogTitle(editCard.card.displayName);
|
||||
|
||||
GetCardValues(editCard.card, document);
|
||||
|
||||
// FIX ME - looks like we need to focus on both the text field and the tab widget
|
||||
|
@ -230,9 +261,8 @@ function OnLoadEditCard()
|
|||
|
||||
GetCardValues(editCard.card, document);
|
||||
|
||||
var displayName = editCard.card.displayName;
|
||||
top.window.title = gAddressBookBundle.getFormattedString(editCard.titleProperty,
|
||||
[ displayName ]);
|
||||
SetCardDialogTitle(editCard.card.displayName);
|
||||
|
||||
// check if selectedAB is a writeable
|
||||
// if not disable all the fields
|
||||
if ("arguments" in window && window.arguments[0])
|
||||
|
@ -324,6 +354,14 @@ function InitEditCard()
|
|||
|
||||
function NewCardOKButton()
|
||||
{
|
||||
if (gOkCallback)
|
||||
{
|
||||
SetCardValues(editCard.card, document);
|
||||
var addressbook = Components.classes["@mozilla.org/addressbook;1"].createInstance(Components.interfaces.nsIAddressBook);
|
||||
gOkCallback(addressbook.abCardToEscapedVCard(editCard.card));
|
||||
return true; // close the window
|
||||
}
|
||||
|
||||
var popup = document.getElementById('abPopup');
|
||||
if ( popup )
|
||||
{
|
||||
|
@ -517,8 +555,8 @@ function GenerateDisplayName()
|
|||
}
|
||||
|
||||
displayNameField.value = displayName;
|
||||
top.window.title = gAddressBookBundle.getFormattedString(editCard.titleProperty,
|
||||
[ displayName ]);
|
||||
|
||||
SetCardDialogTitle(displayName);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -527,9 +565,11 @@ function DisplayNameChanged()
|
|||
// turn off generateDisplayName if the user changes the display name
|
||||
editCard.generateDisplayName = false;
|
||||
|
||||
var displayName = document.getElementById('DisplayName').value;
|
||||
var title = gAddressBookBundle.getFormattedString(editCard.titleProperty,
|
||||
[ displayName ]);
|
||||
if ( top.window.title != title )
|
||||
top.window.title = title;
|
||||
var displayName = document.getElementById('DisplayName').value;
|
||||
SetCardDialogTitle(displayName);
|
||||
}
|
||||
|
||||
function SetCardDialogTitle(displayName)
|
||||
{
|
||||
top.window.title = displayName ? gAddressBookBundle.getFormattedString(editCard.titleProperty + "WithDisplayName", [displayName]) : gAddressBookBundle.getString(editCard.titleProperty);
|
||||
}
|
||||
|
|
|
@ -26,7 +26,6 @@
|
|||
xmlns:nc="http://home.netscape.com/NC-rdf#"
|
||||
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
|
||||
id="abcardDialog"
|
||||
title="&editcardWindow.title;"
|
||||
onload="OnLoadNewCard();"
|
||||
ondialogaccept="return NewCardOKButton();">
|
||||
|
||||
|
@ -40,7 +39,7 @@
|
|||
|
||||
<hbox align="center">
|
||||
|
||||
<label control="abPopup" value="&chooseAddressBook.label;" accesskey="&chooseAddressBook.accesskey;"/>
|
||||
<label id="abPopupLabel" control="abPopup" value="&chooseAddressBook.label;" accesskey="&chooseAddressBook.accesskey;"/>
|
||||
<menulist id="abPopup">
|
||||
<menupopup id="abPopup-menupopup"
|
||||
ref="moz-abdirectory://"
|
||||
|
|
|
@ -1,92 +0,0 @@
|
|||
<!-- Title -->
|
||||
<!ENTITY editcardWindow.title "New Card">
|
||||
|
||||
<!-- Labels -->
|
||||
<!ENTITY chooseAddressBook.label "Add to: ">
|
||||
<!ENTITY chooseAddressBook.accesskey "A">
|
||||
|
||||
<!-- Contact Tab -->
|
||||
<!ENTITY Contact.tab "Contact">
|
||||
<!ENTITY Name.box "Name">
|
||||
<!-- LOCALIZATION NOTE:
|
||||
NameField1, NameField2, PhoneticField1, PhoneticField2
|
||||
those fields are either LN or FN depends on the target country.
|
||||
"FirstName" and "LastName" can be swapped for id to change the order
|
||||
but they should not be translated (same applied to phonetic id).
|
||||
Make sure the translation of label corresponds to the order of id.
|
||||
-->
|
||||
<!-- LOCALIZATION NOTE (NameField1.id) : DONT_TRANSLATE -->
|
||||
<!ENTITY NameField1.id "FirstName">
|
||||
<!-- LOCALIZATION NOTE (NameField2.id) : DONT_TRANSLATE -->
|
||||
<!ENTITY NameField2.id "LastName">
|
||||
<!-- LOCALIZATION NOTE (PhoneticField1.id) : DONT_TRANSLATE -->
|
||||
<!ENTITY PhoneticField1.id "PhoneticFirstName">
|
||||
<!-- LOCALIZATION NOTE (PhoneticField2.id) : DONT_TRANSLATE -->
|
||||
<!ENTITY PhoneticField2.id "PhoneticLastName">
|
||||
<!ENTITY NameField1.label "First:">
|
||||
<!ENTITY NameField1.accesskey "F">
|
||||
<!ENTITY NameField2.label "Last:">
|
||||
<!ENTITY NameField2.accesskey "L">
|
||||
<!ENTITY PhoneticField1.label "Phonetic:">
|
||||
<!ENTITY PhoneticField2.label "Phonetic:">
|
||||
<!ENTITY DisplayName.label "Display:">
|
||||
<!ENTITY DisplayName.accesskey "D">
|
||||
<!ENTITY NickName.label "Nickname:">
|
||||
<!ENTITY NickName.accesskey "N">
|
||||
<!ENTITY Internet.box "Internet">
|
||||
<!ENTITY PrimaryEmail.label "Email:">
|
||||
<!ENTITY PrimaryEmail.accesskey "E">
|
||||
<!ENTITY SecondEmail.label "Additional Email:">
|
||||
<!ENTITY SecondEmail.accesskey "o">
|
||||
<!ENTITY PreferMailFormat.label "Prefers to receive messages formatted as:">
|
||||
<!ENTITY PreferMailFormat.accesskey "r">
|
||||
<!ENTITY PlainText.label "Plain Text">
|
||||
<!ENTITY HTML.label "HTML">
|
||||
<!ENTITY Unknown.label "Unknown">
|
||||
<!ENTITY ScreenName.label "Screen Name:">
|
||||
<!ENTITY ScreenName.accesskey "S">
|
||||
<!ENTITY Phones.box "Phones">
|
||||
<!ENTITY WorkPhone.label "Work:">
|
||||
<!ENTITY WorkPhone.accesskey "W">
|
||||
<!ENTITY HomePhone.label "Home:">
|
||||
<!ENTITY HomePhone.accesskey "H">
|
||||
<!ENTITY FaxNumber.label "Fax:">
|
||||
<!ENTITY FaxNumber.accesskey "x">
|
||||
<!ENTITY PagerNumber.label "Pager:">
|
||||
<!ENTITY PagerNumber.accesskey "P">
|
||||
<!ENTITY CellularNumber.label "Mobile:">
|
||||
<!ENTITY CellularNumber.accesskey "M">
|
||||
|
||||
<!-- Address Tab -->
|
||||
<!ENTITY Address.tab "Address">
|
||||
<!ENTITY Home.box "Home">
|
||||
<!ENTITY HomeAddress.label "Address:">
|
||||
<!ENTITY HomeAddress2.label "">
|
||||
<!ENTITY HomeCity.label "City:">
|
||||
<!ENTITY HomeState.label "State/Province:">
|
||||
<!ENTITY HomeZipCode.label "ZIP/Postal Code:">
|
||||
<!ENTITY HomeCountry.label "Country:">
|
||||
<!ENTITY HomeWebPage.label "Web Page:">
|
||||
<!ENTITY Work.box "Work">
|
||||
<!ENTITY JobTitle.label "Title:">
|
||||
<!ENTITY Department.label "Department:">
|
||||
<!ENTITY Company.label "Organization:">
|
||||
<!ENTITY WorkAddress.label "Address:">
|
||||
<!ENTITY WorkAddress2.label "">
|
||||
<!ENTITY WorkCity.label "City:">
|
||||
<!ENTITY WorkState.label "State/Province:">
|
||||
<!ENTITY WorkZipCode.label "ZIP/Postal Code:">
|
||||
<!ENTITY WorkCountry.label "Country:">
|
||||
<!ENTITY WorkWebPage.label "Web Page:">
|
||||
|
||||
<!-- Other Tab -->
|
||||
<!ENTITY Other.tab "Other">
|
||||
<!ENTITY Custom1.label "Custom 1:">
|
||||
<!ENTITY Custom1.accesskey "1">
|
||||
<!ENTITY Custom2.label "Custom 2:">
|
||||
<!ENTITY Custom2.accesskey "2">
|
||||
<!ENTITY Custom3.label "Custom 3:">
|
||||
<!ENTITY Custom3.accesskey "3">
|
||||
<!ENTITY Custom4.label "Custom 4:">
|
||||
<!ENTITY Custom4.accesskey "4">
|
||||
<!ENTITY Notes.box "Notes">
|
|
@ -94,6 +94,7 @@ var gCharsetConvertManager;
|
|||
|
||||
var gLastWindowToHaveFocus;
|
||||
var gReceiptOptionChanged;
|
||||
var gAttachVCardOptionChanged;
|
||||
|
||||
var gMailSession;
|
||||
|
||||
|
@ -138,6 +139,7 @@ function InitializeGlobalVariables()
|
|||
|
||||
gLastWindowToHaveFocus = null;
|
||||
gReceiptOptionChanged = false;
|
||||
gAttachVCardOptionChanged = false;
|
||||
}
|
||||
InitializeGlobalVariables();
|
||||
|
||||
|
@ -1241,6 +1243,8 @@ function ComposeStartup(recycled, aParams)
|
|||
}
|
||||
document.getElementById("returnReceiptMenu").setAttribute('checked',
|
||||
gMsgCompose.compFields.returnReceipt);
|
||||
document.getElementById("cmd_attachVCard").setAttribute('checked',
|
||||
gMsgCompose.compFields.attachVCard);
|
||||
|
||||
// If recycle, editor is already created
|
||||
if (!recycled)
|
||||
|
@ -1900,6 +1904,17 @@ function ToggleReturnReceipt(target)
|
|||
}
|
||||
}
|
||||
|
||||
function ToggleAttachVCard(target)
|
||||
{
|
||||
var msgCompFields = gMsgCompose.compFields;
|
||||
if (msgCompFields)
|
||||
{
|
||||
msgCompFields.attachVCard = ! msgCompFields.attachVCard;
|
||||
target.setAttribute('checked', msgCompFields.attachVCard);
|
||||
gAttachVCardOptionChanged = true;
|
||||
}
|
||||
}
|
||||
|
||||
function queryISupportsArray(supportsArray, iid) {
|
||||
var result = new Array;
|
||||
for (var i=0; i<supportsArray.Count(); i++) {
|
||||
|
@ -2351,11 +2366,6 @@ function AttachmentElementHasItems()
|
|||
return element ? element.childNodes.length : 0;
|
||||
}
|
||||
|
||||
function AttachVCard()
|
||||
{
|
||||
dump("AttachVCard()\n");
|
||||
}
|
||||
|
||||
function DetermineHTMLAction(convertible)
|
||||
{
|
||||
var obj;
|
||||
|
@ -2470,6 +2480,7 @@ function LoadIdentity(startup)
|
|||
var prevReplyTo = prevIdentity.replyTo;
|
||||
var prevBcc = "";
|
||||
var prevReceipt = prevIdentity.requestReturnReceipt;
|
||||
var prevAttachVCard = prevIdentity.attachVCard;
|
||||
|
||||
if (prevIdentity.doBcc)
|
||||
prevBcc += prevIdentity.doBccList;
|
||||
|
@ -2477,6 +2488,8 @@ function LoadIdentity(startup)
|
|||
var newReplyTo = gCurrentIdentity.replyTo;
|
||||
var newBcc = "";
|
||||
var newReceipt = gCurrentIdentity.requestReturnReceipt;
|
||||
var newAttachVCard = gCurrentIdentity.attachVCard;
|
||||
|
||||
if (gCurrentIdentity.doBcc)
|
||||
newBcc += gCurrentIdentity.doBccList;
|
||||
|
||||
|
@ -2491,6 +2504,13 @@ function LoadIdentity(startup)
|
|||
document.getElementById("returnReceiptMenu").setAttribute('checked',msgCompFields.returnReceipt);
|
||||
}
|
||||
|
||||
if (!gAttachVCardOptionChanged &&
|
||||
prevAttachVCard == msgCompFields.attachVCard &&
|
||||
prevAttachVCard != newAttachVCard)
|
||||
{
|
||||
msgCompFields.attachVCard = newAttachVCard;
|
||||
document.getElementById("cmd_attachVCard").setAttribute('checked',msgCompFields.attachVCard);
|
||||
}
|
||||
|
||||
if (newReplyTo != prevReplyTo)
|
||||
{
|
||||
|
|
|
@ -100,7 +100,8 @@
|
|||
<!-- File Menu -->
|
||||
<command id="cmd_new" oncommand="goDoCommand('cmd_newMessage')"/>
|
||||
<command id="cmd_attachFile" oncommand="goDoCommand('cmd_attachFile')"/>
|
||||
<command id="cmd_attachPage" oncommand="goDoCommand('cmd_attachPage')"/>
|
||||
<command id="cmd_attachPage" oncommand="goDoCommand('cmd_attachPage')"/>
|
||||
<command id="cmd_attachVCard" checked="false" oncommand="ToggleAttachVCard(event.target)"/>
|
||||
<command id="cmd_close" oncommand="goDoCommand('cmd_close')"/>
|
||||
<command id="cmd_saveDefault" oncommand="goDoCommand('cmd_saveDefault')"/>
|
||||
<command id="cmd_saveAsFile" oncommand="goDoCommand('cmd_saveAsFile')"/>
|
||||
|
@ -347,7 +348,9 @@
|
|||
<menuitem label="&checkSpellingCmd.label;" id="menu_checkspelling" accesskey="&checkSpellingCmd.accesskey;" key="key_checkspelling" command="cmd_spelling"/>
|
||||
<menuitem label=""eCmd.label;" accesskey=""eCmd.accesskey;" command="cmd_quoteMessage"/>
|
||||
<menuseparator/>
|
||||
<menuitem id="returnReceiptMenu" type="checkbox" label="&returnReceiptMenu.label;" accesskey="&returnReceiptMenu.accesskey;" checked="false" oncommand="ToggleReturnReceipt(event.target)"/>
|
||||
<menuitem id="returnReceiptMenu" type="checkbox" label="&returnReceiptMenu.label;" accesskey="&returnReceiptMenu.accesskey;" checked="false" oncommand="ToggleReturnReceipt(event.target)"/>
|
||||
<menuitem type="checkbox" label="&attachVCardMenu.label;" accesskey="&attachVCardMenu.accesskey;" command="cmd_attachVCard"/>
|
||||
<menuseparator/>
|
||||
<menu id="outputFormatMenu" label="&outputFormatMenu.label;" accesskey="&outputFormatMenu.accesskey;" oncommand="OutputFormatMenuSelect(event.target)">
|
||||
<menupopup>
|
||||
<menuitem type="radio" name="output_format" label="&autoFormatCmd.label;" accesskey="&autoFormatCmd.accesskey;" id="format_auto" checked="true"/>
|
||||
|
@ -469,7 +472,9 @@
|
|||
command="cmd_attachFile">
|
||||
<menupopup>
|
||||
<menuitem label="&attachFileButton.label;" accesskey="&attachFileCmd.accesskey;" command="cmd_attachFile"/>
|
||||
<menuitem label="&attachPageButton.label;" accesskey="&attachPageCmd.accesskey;" command="cmd_attachPage"/>
|
||||
<menuitem label="&attachPageButton.label;" accesskey="&attachPageCmd.accesskey;" command="cmd_attachPage"/>
|
||||
<menuseparator/>
|
||||
<menuitem type="checkbox" label="&attachVCardButton.label;" accesskey="&attachVCardCmd.accesskey;" command="cmd_attachVCard"/>
|
||||
</menupopup>
|
||||
</toolbarbutton>
|
||||
|
||||
|
|
|
@ -16,7 +16,11 @@
|
|||
<!ENTITY attachFileButton.label "File(s)...">
|
||||
<!ENTITY attachPageCmd.label "Attach Web Page...">
|
||||
<!ENTITY attachPageCmd.accesskey "W">
|
||||
<!ENTITY attachPageButton.label "Web Page...">
|
||||
<!ENTITY attachPageButton.label "Web Page...">
|
||||
<!ENTITY attachVCardCmd.accesskey "P">
|
||||
<!--LOCALIZATION NOTE attachVCardButton.label Don't translate the term 'vCard' -->
|
||||
<!ENTITY attachVCardButton.label "Personal Card (vCard)">
|
||||
|
||||
<!ENTITY closeCmd.label "Close">
|
||||
<!ENTITY closeCmd.key "W">
|
||||
<!ENTITY closeCmd.accesskey "c">
|
||||
|
@ -115,7 +119,12 @@
|
|||
<!ENTITY checkSpellingCmd.key2 "VK_F7">
|
||||
<!ENTITY checkSpellingCmd.accesskey "S">
|
||||
<!ENTITY quoteCmd.label "Quote Message">
|
||||
<!ENTITY quoteCmd.accesskey "Q">
|
||||
<!ENTITY quoteCmd.accesskey "Q">
|
||||
|
||||
<!--LOCALIZATION NOTE attachVCardCmd.label Don't translate the term 'vCard' -->
|
||||
<!ENTITY attachVCardMenu.label "Attach Personal Card (vCard)">
|
||||
<!ENTITY attachVCardMenu.accesskey "v">
|
||||
|
||||
<!ENTITY returnReceiptMenu.label "Return Receipt">
|
||||
<!ENTITY returnReceiptMenu.accesskey "t">
|
||||
<!ENTITY outputFormatMenu.label "Format">
|
||||
|
|
Загрузка…
Ссылка в новой задаче