Bug #226392 -> When displaying a vcard, hide fields in the address book card which

are not used by vcard
This commit is contained in:
scott%scott-macgregor.org 2003-11-25 02:28:10 +00:00
parent c94fc89bea
commit 4aaa6048ab
3 changed files with 34 additions and 15 deletions

View File

@ -108,6 +108,8 @@ function OnLoadNewCard()
gOkCallback = window.arguments[0].okCallback; gOkCallback = window.arguments[0].okCallback;
if ("escapedVCardStr" in window.arguments[0]) { if ("escapedVCardStr" in window.arguments[0]) {
// hide non vcard values
HideNonVcardFields();
var addressbook = Components.classes["@mozilla.org/addressbook;1"].createInstance(Components.interfaces.nsIAddressBook); var addressbook = Components.classes["@mozilla.org/addressbook;1"].createInstance(Components.interfaces.nsIAddressBook);
editCard.card = addressbook.escapedVCardToAbCard(window.arguments[0].escapedVCardStr); editCard.card = addressbook.escapedVCardToAbCard(window.arguments[0].escapedVCardStr);
} }
@ -449,6 +451,18 @@ function GetCardValues(cardproperty, doc)
} }
} }
// when the ab card dialog is being loaded to show a vcard, hide the fields which aren't supported
// by vcard so the user does not try to edit them.
function HideNonVcardFields()
{
document.getElementById('nickNameContainer').collapsed = true;
document.getElementById('secondaryEmailContainer').collapsed = true;
document.getElementById('screenNameContainer').collapsed = true;
document.getElementById('homeAddressGroup').collapsed = true;
document.getElementById('customFields').collapsed = true;
}
// Move the data from the dialog to the cardproperty to be stored in the database // Move the data from the dialog to the cardproperty to be stored in the database
function SetCardValues(cardproperty, doc) function SetCardValues(cardproperty, doc)
{ {
@ -569,7 +583,12 @@ function DisplayNameChanged()
SetCardDialogTitle(displayName); SetCardDialogTitle(displayName);
} }
function SetCardDialogTitle(displayName) function SetCardDialogTitle(displayName)
{ {
top.window.title = displayName ? gAddressBookBundle.getFormattedString(editCard.titleProperty + "WithDisplayName", [displayName]) : gAddressBookBundle.getString(editCard.titleProperty); top.window.title = displayName ? gAddressBookBundle.getFormattedString(editCard.titleProperty + "WithDisplayName", [displayName]) : gAddressBookBundle.getString(editCard.titleProperty);
} }

View File

@ -97,7 +97,7 @@
<textbox id="DisplayName" flex="1" oninput="DisplayNameChanged()" disableforreadonly="true"/> <textbox id="DisplayName" flex="1" oninput="DisplayNameChanged()" disableforreadonly="true"/>
</hbox> </hbox>
</hbox> </hbox>
<hbox> <hbox id="nickNameContainer">
<spacer flex="1"/> <spacer flex="1"/>
<label control="NickName" value="&NickName.label;" accesskey="&NickName.accesskey;" class="CardEditLabel"/> <label control="NickName" value="&NickName.label;" accesskey="&NickName.accesskey;" class="CardEditLabel"/>
<hbox class="CardEditWidth"> <hbox class="CardEditWidth">
@ -117,7 +117,7 @@
<textbox id="PrimaryEmail" flex="1" disableforreadonly="true" class="uri-element"/> <textbox id="PrimaryEmail" flex="1" disableforreadonly="true" class="uri-element"/>
</hbox> </hbox>
</hbox> </hbox>
<hbox> <hbox id="secondaryEmailContainer">
<spacer flex="1"/> <spacer flex="1"/>
<label control="SecondEmail" value="&SecondEmail.label;" accesskey="&SecondEmail.accesskey;" class="CardEditLabel"/> <label control="SecondEmail" value="&SecondEmail.label;" accesskey="&SecondEmail.accesskey;" class="CardEditLabel"/>
<hbox class="CardEditWidth"> <hbox class="CardEditWidth">
@ -136,7 +136,7 @@
</menupopup> </menupopup>
</menulist> </menulist>
</hbox> </hbox>
<hbox> <hbox id="screenNameContainer">
<spacer flex="1"/> <spacer flex="1"/>
<label control="ScreenName" value="&ScreenName.label;" accesskey="&ScreenName.accesskey;" class="CardEditLabel"/> <label control="ScreenName" value="&ScreenName.label;" accesskey="&ScreenName.accesskey;" class="CardEditLabel"/>
<hbox class="CardEditWidth"> <hbox class="CardEditWidth">
@ -190,7 +190,7 @@
<!-- Address Tab --> <!-- Address Tab -->
<vbox index="address" flex="1"> <vbox index="address" flex="1">
<groupbox flex="1"> <groupbox id="homeAddressGroup" flex="1">
<caption class="tab-caption" label="&Home.box;"/> <caption class="tab-caption" label="&Home.box;"/>
<vbox> <vbox>
<hbox> <hbox>
@ -316,7 +316,7 @@
<!-- Other Tab --> <!-- Other Tab -->
<vbox index="other" flex="1"> <vbox index="other" flex="1">
<vbox class="alignBoxWithFieldset"> <vbox id="customFields" class="alignBoxWithFieldset">
<hbox> <hbox>
<label control="Custom1" value="&Custom1.label;" accesskey="&Custom1.accesskey;" class="CardEditLabel"/> <label control="Custom1" value="&Custom1.label;" accesskey="&Custom1.accesskey;" class="CardEditLabel"/>
<textbox id="Custom1" flex="1" disableforreadonly="true"/> <textbox id="Custom1" flex="1" disableforreadonly="true"/>

View File

@ -124,7 +124,7 @@
<textbox id="DisplayName" flex="1" oninput="DisplayNameChanged()" disableforreadonly="true"/> <textbox id="DisplayName" flex="1" oninput="DisplayNameChanged()" disableforreadonly="true"/>
</hbox> </hbox>
</hbox> </hbox>
<hbox> <hbox id="nickNameContainer">
<spacer flex="1"/> <spacer flex="1"/>
<label control="NickName" value="&NickName.label;" accesskey="&NickName.accesskey;" class="CardEditLabel"/> <label control="NickName" value="&NickName.label;" accesskey="&NickName.accesskey;" class="CardEditLabel"/>
<hbox class="CardEditWidth"> <hbox class="CardEditWidth">
@ -144,7 +144,7 @@
<textbox id="PrimaryEmail" flex="1" disableforreadonly="true" class="uri-element"/> <textbox id="PrimaryEmail" flex="1" disableforreadonly="true" class="uri-element"/>
</hbox> </hbox>
</hbox> </hbox>
<hbox> <hbox id="secondaryEmailContainer">
<spacer flex="1"/> <spacer flex="1"/>
<label control="SecondEmail" value="&SecondEmail.label;" accesskey="&SecondEmail.accesskey;" class="CardEditLabel"/> <label control="SecondEmail" value="&SecondEmail.label;" accesskey="&SecondEmail.accesskey;" class="CardEditLabel"/>
<hbox class="CardEditWidth"> <hbox class="CardEditWidth">
@ -163,7 +163,7 @@
</menupopup> </menupopup>
</menulist> </menulist>
</hbox> </hbox>
<hbox> <hbox id="screenNameContainer">
<spacer flex="1"/> <spacer flex="1"/>
<label control="ScreenName" value="&ScreenName.label;" accesskey="&ScreenName.accesskey;" class="CardEditLabel"/> <label control="ScreenName" value="&ScreenName.label;" accesskey="&ScreenName.accesskey;" class="CardEditLabel"/>
<hbox class="CardEditWidth"> <hbox class="CardEditWidth">
@ -217,7 +217,7 @@
<!-- Address Tab --> <!-- Address Tab -->
<vbox index="address" flex="1"> <vbox index="address" flex="1">
<groupbox flex="1"> <groupbox id="homeAddressGroup" flex="1">
<caption class="tab-caption" label="&Home.box;"/> <caption class="tab-caption" label="&Home.box;"/>
<vbox> <vbox>
<hbox> <hbox>
@ -343,7 +343,7 @@
<!-- Other Tab --> <!-- Other Tab -->
<vbox index="other" flex="1"> <vbox index="other" flex="1">
<vbox class="alignBoxWithFieldset"> <vbox id="customFields" class="alignBoxWithFieldset">
<hbox> <hbox>
<label control="Custom1" value="&Custom1.label;" accesskey="&Custom1.accesskey;" class="CardEditLabel"/> <label control="Custom1" value="&Custom1.label;" accesskey="&Custom1.accesskey;" class="CardEditLabel"/>
<textbox id="Custom1" flex="1" disableforreadonly="true"/> <textbox id="Custom1" flex="1" disableforreadonly="true"/>