Adds account info in incoming call dialog and property to enable removing domain in caller address.

ice4sip 5070
Damian Minkov 12 years ago
parent 0af99ea38e
commit a38f149940

@ -92,6 +92,11 @@ public abstract class PreCallDialog
*/
private JLabel callLabelAddress;
/**
* Call label for account.
*/
private JLabel callLabelAccount;
/**
* The label that will contain the peer image.
*/
@ -213,6 +218,8 @@ private Window createPreCallWindow( String title,
= HudWidgetFactory.createHudComboBox(
new DefaultComboBoxModel(accounts));
}
else
callLabelAccount = HudWidgetFactory.createHudLabel("");
}
else
{
@ -228,6 +235,8 @@ private Window createPreCallWindow( String title,
if (accounts != null)
accountsCombo = new JComboBox(accounts);
else
callLabelAccount = new JLabel();
}
if (text != null)
@ -257,6 +266,9 @@ private void initComponents()
callLabelAddress.putClientProperty("html.disable", Boolean.TRUE);
callLabelImage.putClientProperty("html.disable", Boolean.TRUE);
if(callLabelAccount != null)
callLabelAccount.putClientProperty("html.disable", Boolean.TRUE);
JComponent buttonsPanel = new CallToolBar(false, true);
callButton = new SIPCommButton();
@ -298,10 +310,18 @@ private void initComponents()
labelsPanel.setLayout(new BoxLayout(labelsPanel, BoxLayout.Y_AXIS));
callLabelDisplayName.setAlignmentX(JLabel.LEFT_ALIGNMENT);
labelsPanel.add(callLabelDisplayName);
labelsPanel.add(Box.createVerticalStrut(3));
callLabelAddress.setAlignmentX(JLabel.LEFT_ALIGNMENT);
labelsPanel.add(callLabelAddress);
if(callLabelAccount != null)
{
labelsPanel.add(Box.createVerticalStrut(3));
callLabelAccount.setAlignmentX(JLabel.LEFT_ALIGNMENT);
labelsPanel.add(callLabelAccount);
}
if (accountsCombo != null)
{
labelsPanel.add(Box.createVerticalStrut(3));
@ -314,8 +334,8 @@ private void initComponents()
// Loads skin resources.
loadSkin();
JPanel rightPanel = new TransparentPanel(
new FlowLayout(FlowLayout.CENTER, 0, 0));
JPanel rightPanel = new TransparentPanel();
rightPanel.setLayout(new BoxLayout(rightPanel, BoxLayout.Y_AXIS));
rightPanel.setBorder(BorderFactory.createEmptyBorder(6, 0, 0, 0));
@ -329,7 +349,10 @@ private void initComponents()
buttonsPanel.add(hangupButton);
buttonsPanel.setAlignmentX(Component.CENTER_ALIGNMENT);
rightPanel.add(Box.createVerticalGlue());
rightPanel.add(buttonsPanel);
rightPanel.add(Box.createVerticalGlue());
mainPanel.add(rightPanel, BorderLayout.EAST);
}
@ -416,8 +439,15 @@ public void dispose()
*/
public JLabel[] getCallLabels()
{
return new JLabel[]{
if(callLabelAccount == null)
return new JLabel[]{
callLabelImage, callLabelDisplayName, callLabelAddress};
else
return new JLabel[]{
callLabelImage,
callLabelDisplayName,
callLabelAddress,
callLabelAccount};
}
/**

@ -17,6 +17,7 @@
import net.java.sip.communicator.plugin.desktoputil.*;
import net.java.sip.communicator.service.protocol.*;
import net.java.sip.communicator.service.protocol.event.*;
import net.java.sip.communicator.util.*;
import net.java.sip.communicator.util.skin.*;
import org.jitsi.util.*;
@ -78,6 +79,7 @@ private void initCallLabel(final JLabel callLabel[])
boolean hasMorePeers = false;
String textDisplayName = "";
String textAddress = "";
String textAccount = "";
ImageIcon imageIcon =
ImageUtils.scaleIconWithinBounds(ImageLoader
@ -87,17 +89,20 @@ private void initCallLabel(final JLabel callLabel[])
{
final CallPeer peer = peersIter.next();
String peerAddress = getPeerDisplayAddress(peer);
textAccount = peer.getProtocolProvider().getAccountID()
.getDisplayName();
// More peers.
if (peersIter.hasNext())
{
textDisplayName = callLabel[1].getText()
+ CallManager.getPeerDisplayName(peer) + ", ";
String peerAddress = getPeerDisplayAddress(peer);
if(!StringUtils.isNullOrEmpty(peerAddress))
textAddress = callLabel[2].getText()
+ peerAddress + ", ";
+ trimPeerAddressToUsername(peerAddress) + ", ";
hasMorePeers = true;
}
@ -109,11 +114,9 @@ private void initCallLabel(final JLabel callLabel[])
new String[]{
CallManager.getPeerDisplayName(peer) });
String peerAddress = getPeerDisplayAddress(peer);
if(!StringUtils.isNullOrEmpty(peerAddress))
textAddress = callLabel[2].getText()
+ peerAddress ;
+ trimPeerAddressToUsername(peerAddress);
byte[] image = CallManager.getPeerImage(peer);
@ -146,6 +149,13 @@ public void run()
callLabel[2].setText(textAddress);
callLabel[2].setForeground(Color.GRAY);
if(textAccount != null)
{
callLabel[3].setText(
GuiActivator.getResources().getI18NString("service.gui.TO")
+ " " + textAccount);
}
}
/**
@ -247,4 +257,22 @@ private String getPeerDisplayAddress(CallPeer peer)
: peerAddress;
}
}
/**
* Removes the domain/server part from the address only if it is enabled.
* @param peerAddress peer address to change.
* @return username part of the address.
*/
private String trimPeerAddressToUsername(String peerAddress)
{
if(ConfigurationUtils.isHideDomainInReceivedCallDialogEnabled())
{
if(peerAddress != null && !peerAddress.startsWith("@"))
{
return peerAddress.split("@")[0];
}
}
return peerAddress;
}
}

@ -319,6 +319,19 @@ public class ConfigurationUtils
= "net.java.sip.communicator.impl.gui.contactlist" +
".HIDE_ADDRESS_IN_CALL_HISTORY_TOOLTIP_ENABLED";
/**
* Whether domain will be shown in receive call dialog.
*/
private static boolean isHideDomainInReceivedCallDialogEnabled = false;
/**
* The name of the property, whether to show addresses in call history
* tooltip.
*/
private static final String HIDE_DOMAIN_IN_RECEIEVE_CALL_DIALOG_PROPERTY
= "net.java.sip.communicator.impl.gui.main.call." +
"HIDE_DOMAIN_IN_RECEIVE_CALL_DIALOG_ENABLED";
/**
* The name of the show smileys property.
*/
@ -884,6 +897,10 @@ public static void loadGuiConfigurations()
HIDE_ADDR_IN_CALL_HISTORY_TOOLTIP_PROPERTY,
isHideAddressInCallHistoryTooltipEnabled);
isHideDomainInReceivedCallDialogEnabled = configService.getBoolean(
HIDE_DOMAIN_IN_RECEIEVE_CALL_DIALOG_PROPERTY,
isHideDomainInReceivedCallDialogEnabled);
String hideExtendedAwayStatusProperty
= "net.java.sip.communicator.service.protocol" +
".globalstatus.HIDE_EXTENDED_AWAY_STATUS";
@ -1745,6 +1762,15 @@ public static boolean isHideAddressInCallHistoryTooltipEnabled()
return isHideAddressInCallHistoryTooltipEnabled;
}
/**
* Whether domain will be shown in receive call dialog.
* @return whether domain will be shown in receive call dialog.
*/
public static boolean isHideDomainInReceivedCallDialogEnabled()
{
return isHideDomainInReceivedCallDialogEnabled;
}
/**
* Updates the "singleWindowInterface" property through the
* <tt>ConfigurationService</tt>.
@ -2339,7 +2365,7 @@ public static String getChatRoomProperty(
}
/**
* Returns the chat room prefix saved in <tt>ConfigurationService</tt>
* Returns the chat room prefix saved in <tt>ConfigurationService</tt>
* associated with the <tt>accountID</tt> and <tt>chatRoomID</tt>.
*
* @param accountID the account id
@ -2353,7 +2379,6 @@ public static String getChatRoomPrefix(String accountID, String chatRoomId)
.getPropertyNamesByPrefix(prefix, true);
for (String accountRootPropName : accounts)
{
String tmpAccountID
= configService.getString(accountRootPropName);

Loading…
Cancel
Save