Adds a display name field in the add contact form.

cusax-fix
Yana Stamcheva 15 years ago
parent ae262a2560
commit 5c731298ec

@ -151,6 +151,7 @@ service.gui.DATE=Date
service.gui.DELETE=Delete
service.gui.DESKTOP_SHARING_WARNING=<b>Are you sure you want to start screen sharing?</b> <br> Clicking OK will let people on this call see your screen.
service.gui.DIALPAD=Dialpad
service.gui.DISPLAY_NAME=Display name
service.gui.DISCONNECTED_STATUS=Disconnected
service.gui.DND_STATUS=Do not disturb
service.gui.DO_NOT_ASK_AGAIN=Don't ask again

@ -58,8 +58,14 @@ public class AddContactDialog
GuiActivator.getResources().getI18NString(
"service.gui.CONTACT_NAME") + ": ");
private final JLabel displayNameLabel = new JLabel(
GuiActivator.getResources().getI18NString(
"service.gui.DISPLAY_NAME") + ": ");
private final JTextField contactAddressField = new JTextField();
private final JTextField displayNameField = new JTextField();
private final JButton addButton = new JButton(
GuiActivator.getResources().getI18NString("service.gui.ADD"));
@ -105,6 +111,7 @@ public AddContactDialog(MainFrame parentWindow, MetaContact metaContact)
this.metaContact = metaContact;
this.displayNameField.setText(metaContact.getDisplayName());
this.setSelectedGroup(metaContact.getParentMetaContactGroup());
this.groupCombo.setEnabled(false);
@ -165,6 +172,9 @@ private void init()
labelsPanel.add(contactAddressLabel);
fieldsPanel.add(contactAddressField);
labelsPanel.add(displayNameLabel);
fieldsPanel.add(displayNameField);
contactAddressField.getDocument().addDocumentListener(
new DocumentListener()
{
@ -354,13 +364,14 @@ public void run()
{
try
{
GuiActivator.getContactListService()
.createMetaContact(
(ProtocolProviderService) accountCombo
.getSelectedItem(),
(MetaContactGroup) groupCombo
.getSelectedItem(),
contactName);
metaContact
= GuiActivator.getContactListService()
.createMetaContact(
(ProtocolProviderService) accountCombo
.getSelectedItem(),
(MetaContactGroup) groupCombo
.getSelectedItem(),
contactName);
}
catch (MetaContactListException ex)
{
@ -409,6 +420,23 @@ else if (errorCode
}
}.start();
}
final String displayName = displayNameField.getText();
if (metaContact != null
&& displayName != null
&& displayName.length() > 0
&& !metaContact.getDisplayName().equals(displayName))
{
new Thread()
{
@Override
public void run()
{
GuiActivator.getContactListService()
.renameMetaContact(metaContact, displayName);
}
}.start();
}
}
dispose();
}

Loading…
Cancel
Save