mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-26 14:22:01 +00:00
Bug #226392 -> When displaying a vcard, hide fields in the address book card which
are not used by vcard
This commit is contained in:
parent
c94fc89bea
commit
4aaa6048ab
@ -108,6 +108,8 @@ function OnLoadNewCard()
|
||||
gOkCallback = window.arguments[0].okCallback;
|
||||
|
||||
if ("escapedVCardStr" in window.arguments[0]) {
|
||||
// hide non vcard values
|
||||
HideNonVcardFields();
|
||||
var addressbook = Components.classes["@mozilla.org/addressbook;1"].createInstance(Components.interfaces.nsIAddressBook);
|
||||
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
|
||||
function SetCardValues(cardproperty, doc)
|
||||
{
|
||||
@ -568,8 +582,13 @@ function DisplayNameChanged()
|
||||
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);
|
||||
}
|
||||
|
||||
|
||||
function SetCardDialogTitle(displayName)
|
||||
|
||||
{
|
||||
|
||||
top.window.title = displayName ? gAddressBookBundle.getFormattedString(editCard.titleProperty + "WithDisplayName", [displayName]) : gAddressBookBundle.getString(editCard.titleProperty);
|
||||
|
||||
}
|
||||
|
||||
|
@ -97,7 +97,7 @@
|
||||
<textbox id="DisplayName" flex="1" oninput="DisplayNameChanged()" disableforreadonly="true"/>
|
||||
</hbox>
|
||||
</hbox>
|
||||
<hbox>
|
||||
<hbox id="nickNameContainer">
|
||||
<spacer flex="1"/>
|
||||
<label control="NickName" value="&NickName.label;" accesskey="&NickName.accesskey;" class="CardEditLabel"/>
|
||||
<hbox class="CardEditWidth">
|
||||
@ -117,7 +117,7 @@
|
||||
<textbox id="PrimaryEmail" flex="1" disableforreadonly="true" class="uri-element"/>
|
||||
</hbox>
|
||||
</hbox>
|
||||
<hbox>
|
||||
<hbox id="secondaryEmailContainer">
|
||||
<spacer flex="1"/>
|
||||
<label control="SecondEmail" value="&SecondEmail.label;" accesskey="&SecondEmail.accesskey;" class="CardEditLabel"/>
|
||||
<hbox class="CardEditWidth">
|
||||
@ -136,7 +136,7 @@
|
||||
</menupopup>
|
||||
</menulist>
|
||||
</hbox>
|
||||
<hbox>
|
||||
<hbox id="screenNameContainer">
|
||||
<spacer flex="1"/>
|
||||
<label control="ScreenName" value="&ScreenName.label;" accesskey="&ScreenName.accesskey;" class="CardEditLabel"/>
|
||||
<hbox class="CardEditWidth">
|
||||
@ -190,7 +190,7 @@
|
||||
|
||||
<!-- Address Tab -->
|
||||
<vbox index="address" flex="1">
|
||||
<groupbox flex="1">
|
||||
<groupbox id="homeAddressGroup" flex="1">
|
||||
<caption class="tab-caption" label="&Home.box;"/>
|
||||
<vbox>
|
||||
<hbox>
|
||||
@ -316,7 +316,7 @@
|
||||
|
||||
<!-- Other Tab -->
|
||||
<vbox index="other" flex="1">
|
||||
<vbox class="alignBoxWithFieldset">
|
||||
<vbox id="customFields" class="alignBoxWithFieldset">
|
||||
<hbox>
|
||||
<label control="Custom1" value="&Custom1.label;" accesskey="&Custom1.accesskey;" class="CardEditLabel"/>
|
||||
<textbox id="Custom1" flex="1" disableforreadonly="true"/>
|
||||
|
@ -124,7 +124,7 @@
|
||||
<textbox id="DisplayName" flex="1" oninput="DisplayNameChanged()" disableforreadonly="true"/>
|
||||
</hbox>
|
||||
</hbox>
|
||||
<hbox>
|
||||
<hbox id="nickNameContainer">
|
||||
<spacer flex="1"/>
|
||||
<label control="NickName" value="&NickName.label;" accesskey="&NickName.accesskey;" class="CardEditLabel"/>
|
||||
<hbox class="CardEditWidth">
|
||||
@ -144,7 +144,7 @@
|
||||
<textbox id="PrimaryEmail" flex="1" disableforreadonly="true" class="uri-element"/>
|
||||
</hbox>
|
||||
</hbox>
|
||||
<hbox>
|
||||
<hbox id="secondaryEmailContainer">
|
||||
<spacer flex="1"/>
|
||||
<label control="SecondEmail" value="&SecondEmail.label;" accesskey="&SecondEmail.accesskey;" class="CardEditLabel"/>
|
||||
<hbox class="CardEditWidth">
|
||||
@ -163,7 +163,7 @@
|
||||
</menupopup>
|
||||
</menulist>
|
||||
</hbox>
|
||||
<hbox>
|
||||
<hbox id="screenNameContainer">
|
||||
<spacer flex="1"/>
|
||||
<label control="ScreenName" value="&ScreenName.label;" accesskey="&ScreenName.accesskey;" class="CardEditLabel"/>
|
||||
<hbox class="CardEditWidth">
|
||||
@ -217,7 +217,7 @@
|
||||
|
||||
<!-- Address Tab -->
|
||||
<vbox index="address" flex="1">
|
||||
<groupbox flex="1">
|
||||
<groupbox id="homeAddressGroup" flex="1">
|
||||
<caption class="tab-caption" label="&Home.box;"/>
|
||||
<vbox>
|
||||
<hbox>
|
||||
@ -343,7 +343,7 @@
|
||||
|
||||
<!-- Other Tab -->
|
||||
<vbox index="other" flex="1">
|
||||
<vbox class="alignBoxWithFieldset">
|
||||
<vbox id="customFields" class="alignBoxWithFieldset">
|
||||
<hbox>
|
||||
<label control="Custom1" value="&Custom1.label;" accesskey="&Custom1.accesskey;" class="CardEditLabel"/>
|
||||
<textbox id="Custom1" flex="1" disableforreadonly="true"/>
|
||||
|
Loading…
Reference in New Issue
Block a user