Merge branch 'tomka-improve-add-contact-dialog'

Closes #15
sip-call-params
Ingo Bauersachs 10 years ago
commit 5ee630fc20

@ -171,6 +171,8 @@ service.gui.CONNECTION=Connection
service.gui.CONNECTION_FAILED_MSG=Connection failed for the following account: User name: {0}, Server name: {1}. Please check your network connection or contact your network administrator for more information.
service.gui.CONNECTION_EXPIRED_MSG=You are currently disconnected from the {0} server.
service.gui.CONTACT_NAME=ID or Number
service.gui.CONTACT_NAME_PROMPT=jane.doe@example.com
service.gui.CONTACT_NAME_INFO=Add either an instant messaging address (such as jane.doe@example.com) or a VoIP number
service.gui.CONTACT_NOT_SUPPORTING_TELEPHONY=The chosen {0} contact doesn''t support telephony.
service.gui.CONTACT_NOT_SUPPORTING_CHAT_CONF=The chosen {0} contact doesn''t support chat conferencing.
service.gui.CONTACT_PAUSED_TYPING={0} paused typing the message
@ -204,6 +206,8 @@ service.gui.DESKTOP_SHARING_WARNING=<b>Are you sure you want to start screen sha
service.gui.DESKTOP_SHARING_DIALOG_INDICATE=You are sharing your screen
service.gui.DIALPAD=Dial Pad
service.gui.DISPLAY_NAME=Display name
service.gui.DISPLAY_NAME_PROMPT=Jane Doe
service.gui.DISPLAY_NAME_INFO=Add a name for this contact. If left blank the IM address or VoIP number will be used. (Optional)
service.gui.DISCONNECTED_STATUS=Disconnected
service.gui.DND_STATUS=Do not disturb
service.gui.DO_NOT_ASK_AGAIN=Don't ask again
@ -509,8 +513,10 @@ service.gui.SEARCH_FOR_CHAT_ROOMS_MSG=Click the below button to show all chat ro
service.gui.SEARCH_STRING_CONTACT_SOURCE=Searched contact
service.gui.SECURITY=Security
service.gui.SELECT_ACCOUNT=Select account
service.gui.SELECT_ACCOUNT_INFO=Which account do you want to use to communicate with this contact?
service.gui.SELECT_COLOR=Select color
service.gui.SELECT_GROUP=Select group
service.gui.SELECT_GROUP_INFO=Which group do you want to display this contact under? (Optional)
service.gui.SELECT_GROUP_WIZARD_MSG=The list below contains all groups in your Contact List. Select the one, where you would like to add the new contact.
service.gui.SELECT_NO_GROUP=No group
service.gui.SELECT_GROUP_WIZARD=Specify group

@ -24,7 +24,9 @@
import java.util.List;
import javax.swing.*;
import javax.swing.border.*;
import javax.swing.event.*;
import javax.swing.text.*;
import org.jitsi.util.*;
@ -165,32 +167,101 @@ public void setDisplayName(String displayName)
displayNameField.setText(displayName);
}
/**
* Adds a faint gray prompt to the provided text field that
* will vanish as soon as text is entered into the field.
*/
private void addPrompt(JTextField field, String text)
{
final JLabel prompt = new JLabel(text);
// Give prompt a foreground color like the original
// text field, but with half transparency.
final Color fg = field.getForeground();
final Color color = new Color(
fg.getRed(), fg.getGreen(), fg.getBlue(), 128);
// Mimic properties of given text field
prompt.setFont(field.getFont());
prompt.setForeground(color);
prompt.setBorder(new EmptyBorder(field.getInsets()));
prompt.setHorizontalAlignment(JLabel.LEADING);
// Add handler to hide prompt when text is entered
final Document doc = field.getDocument();
doc.addDocumentListener( new DocumentListener() {
public void insertUpdate(DocumentEvent e)
{
prompt.setVisible(doc.getLength() == 0);
}
public void removeUpdate(DocumentEvent e)
{
prompt.setVisible(doc.getLength() == 0);
}
public void changedUpdate(DocumentEvent e) {}
});
// Add prompt to text field
field.setLayout( new BorderLayout() );
field.add(prompt);
}
/**
* Initializes the dialog.
*/
private void init()
{
// Get tool tip text for primary controls
final String displayNameInfo =
GuiActivator.getResources().getI18NString(
"service.gui.DISPLAY_NAME_INFO");
final String contactInfo =
GuiActivator.getResources().getI18NString(
"service.gui.CONTACT_NAME_INFO");
final String accountInfo =
GuiActivator.getResources().getI18NString(
"service.gui.SELECT_ACCOUNT_INFO");
final String groupInfo =
GuiActivator.getResources().getI18NString(
"service.gui.SELECT_GROUP_INFO");
// Initialize controls
this.accountLabel = new JLabel(
GuiActivator.getResources().getI18NString(
"service.gui.SELECT_ACCOUNT") + ": ");
this.accountLabel.setToolTipText(accountInfo);
this.accountCombo = new JComboBox();
this.groupLabel = new JLabel(
GuiActivator.getResources().getI18NString(
"service.gui.SELECT_GROUP") + ": ");
this.accountCombo.setToolTipText(accountInfo);
this.contactAddressLabel = new JLabel(
GuiActivator.getResources().getI18NString(
"service.gui.CONTACT_NAME") + ": ");
this.contactAddressLabel.setToolTipText(contactInfo);
this.displayNameLabel = new JLabel(
GuiActivator.getResources().getI18NString(
"service.gui.DISPLAY_NAME") + ": ");
this.displayNameLabel.setToolTipText(displayNameInfo);
this.contactAddressField = new JTextField();
this.contactAddressField.setToolTipText(contactInfo);
addPrompt(this.contactAddressField,
GuiActivator.getResources().getI18NString(
"service.gui.CONTACT_NAME_PROMPT"));
this.displayNameField = new JTextField();
this.displayNameField.setToolTipText(displayNameInfo);
addPrompt(this.displayNameField,
GuiActivator.getResources().getI18NString(
"service.gui.DISPLAY_NAME_PROMPT"));
this.groupLabel = new JLabel(
GuiActivator.getResources().getI18NString(
"service.gui.SELECT_GROUP") + ": ");
this.groupLabel.setToolTipText(groupInfo);
this.addButton = new JButton(
GuiActivator.getResources().getI18NString("service.gui.ADD"));
@ -201,6 +272,7 @@ private void init()
this.imageLabel = new JLabel();
this.groupCombo = createGroupCombo(this);
this.groupCombo.setToolTipText(groupInfo);
if(metaContact != null)
{
@ -228,15 +300,15 @@ private void init()
fieldsPanel.add(accountCombo);
}
labelsPanel.add(groupLabel);
fieldsPanel.add(groupCombo);
labelsPanel.add(contactAddressLabel);
fieldsPanel.add(contactAddressField);
labelsPanel.add(displayNameLabel);
fieldsPanel.add(displayNameField);
labelsPanel.add(groupLabel);
fieldsPanel.add(groupCombo);
contactAddressField.getDocument().addDocumentListener(
new DocumentListener()
{

Loading…
Cancel
Save