aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDamian Minkov <damencho@jitsi.org>2014-02-05 18:03:31 +0200
committerDamian Minkov <damencho@jitsi.org>2014-02-05 18:03:31 +0200
commita38f1499406c8b33d462661f0e63bc23f6d01290 (patch)
tree5f70c62461a4836311526447a37bb9b27289174c
parent0af99ea38e52893836eeea308c1f5dbdca4bca51 (diff)
downloadjitsi-a38f1499406c8b33d462661f0e63bc23f6d01290.zip
jitsi-a38f1499406c8b33d462661f0e63bc23f6d01290.tar.gz
jitsi-a38f1499406c8b33d462661f0e63bc23f6d01290.tar.bz2
Adds account info in incoming call dialog and property to enable removing domain in caller address.
-rw-r--r--src/net/java/sip/communicator/impl/gui/main/call/PreCallDialog.java36
-rw-r--r--src/net/java/sip/communicator/impl/gui/main/call/ReceivedCallDialog.java40
-rw-r--r--src/net/java/sip/communicator/util/ConfigurationUtils.java29
3 files changed, 94 insertions, 11 deletions
diff --git a/src/net/java/sip/communicator/impl/gui/main/call/PreCallDialog.java b/src/net/java/sip/communicator/impl/gui/main/call/PreCallDialog.java
index a3af737..9ed098f 100644
--- a/src/net/java/sip/communicator/impl/gui/main/call/PreCallDialog.java
+++ b/src/net/java/sip/communicator/impl/gui/main/call/PreCallDialog.java
@@ -93,6 +93,11 @@ public abstract class PreCallDialog
private JLabel callLabelAddress;
/**
+ * Call label for account.
+ */
+ private JLabel callLabelAccount;
+
+ /**
* The label that will contain the peer image.
*/
private JLabel callLabelImage;
@@ -213,6 +218,8 @@ public abstract class PreCallDialog
= HudWidgetFactory.createHudComboBox(
new DefaultComboBoxModel(accounts));
}
+ else
+ callLabelAccount = HudWidgetFactory.createHudLabel("");
}
else
{
@@ -228,6 +235,8 @@ public abstract class PreCallDialog
if (accounts != null)
accountsCombo = new JComboBox(accounts);
+ else
+ callLabelAccount = new JLabel();
}
if (text != null)
@@ -257,6 +266,9 @@ public abstract class PreCallDialog
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 @@ public abstract class PreCallDialog
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 @@ public abstract class PreCallDialog
// 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 @@ public abstract class PreCallDialog
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 abstract class PreCallDialog
*/
public JLabel[] getCallLabels()
{
- return new JLabel[]{
+ if(callLabelAccount == null)
+ return new JLabel[]{
callLabelImage, callLabelDisplayName, callLabelAddress};
+ else
+ return new JLabel[]{
+ callLabelImage,
+ callLabelDisplayName,
+ callLabelAddress,
+ callLabelAccount};
}
/**
diff --git a/src/net/java/sip/communicator/impl/gui/main/call/ReceivedCallDialog.java b/src/net/java/sip/communicator/impl/gui/main/call/ReceivedCallDialog.java
index 952bca5..a5e1abe 100644
--- a/src/net/java/sip/communicator/impl/gui/main/call/ReceivedCallDialog.java
+++ b/src/net/java/sip/communicator/impl/gui/main/call/ReceivedCallDialog.java
@@ -17,6 +17,7 @@ import net.java.sip.communicator.impl.gui.utils.*;
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 @@ public class ReceivedCallDialog
boolean hasMorePeers = false;
String textDisplayName = "";
String textAddress = "";
+ String textAccount = "";
ImageIcon imageIcon =
ImageUtils.scaleIconWithinBounds(ImageLoader
@@ -87,17 +89,20 @@ public class ReceivedCallDialog
{
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 @@ public class ReceivedCallDialog
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 class ReceivedCallDialog
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 @@ public class ReceivedCallDialog
: 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;
+ }
}
diff --git a/src/net/java/sip/communicator/util/ConfigurationUtils.java b/src/net/java/sip/communicator/util/ConfigurationUtils.java
index 925a34f..d46beb3 100644
--- a/src/net/java/sip/communicator/util/ConfigurationUtils.java
+++ b/src/net/java/sip/communicator/util/ConfigurationUtils.java
@@ -320,6 +320,19 @@ public class ConfigurationUtils
".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.
*/
private static final String SHOW_SMILEYS_PROPERTY
@@ -884,6 +897,10 @@ public class ConfigurationUtils
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";
@@ -1746,6 +1763,15 @@ public class ConfigurationUtils
}
/**
+ * 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 class ConfigurationUtils
}
/**
- * 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 class ConfigurationUtils
.getPropertyNamesByPrefix(prefix, true);
for (String accountRootPropName : accounts)
{
-
String tmpAccountID
= configService.getString(accountRootPropName);