diff --git a/src/net/java/sip/communicator/impl/gui/customcontrols/SIPCommSmartComboBox.java b/src/net/java/sip/communicator/impl/gui/customcontrols/SIPCommSmartComboBox.java index 25be007e9..8395d1529 100644 --- a/src/net/java/sip/communicator/impl/gui/customcontrols/SIPCommSmartComboBox.java +++ b/src/net/java/sip/communicator/impl/gui/customcontrols/SIPCommSmartComboBox.java @@ -127,16 +127,16 @@ public Object getSelectedItem() } public void setSelectedItem(Object val) - { + { if ((selectedItem == null) && (val == null)) return; - + if ((selectedItem != null) && selectedItem.equals(val)) return; - + if ((val != null) && val.equals(selectedItem)) return; - + selectedItem = val; fireContentsChanged(this, -1, -1); } @@ -227,11 +227,12 @@ protected void handleChange() { if (setting) return; - + filtering = true; Filter filter = null; - if (text.getText().length() > 0) { + if (text.getText().length() > 0) + { filter = new StartsWithFilter(text.getText()); } diff --git a/src/net/java/sip/communicator/impl/gui/main/call/CallPanel.java b/src/net/java/sip/communicator/impl/gui/main/call/CallPanel.java index c0caecc31..bb64dcdc8 100644 --- a/src/net/java/sip/communicator/impl/gui/main/call/CallPanel.java +++ b/src/net/java/sip/communicator/impl/gui/main/call/CallPanel.java @@ -248,17 +248,22 @@ public void participantImageChanged(CallParticipantChangeEvent evt) { } - public void securityStatusChanged(SecurityGUIEvent securityEvent) { + public void securityStatusChanged(SecurityGUIEvent securityEvent) + { CallParticipant part = (CallParticipant)securityEvent.getSource(); CallParticipantPanel panel = getParticipantPanel(part); - - if (securityEvent.getEventID() == SecurityGUIEvent.SECURITY_ENABLED) { - panel.changeSecureCallButton(true); + + if (securityEvent.getEventID() == SecurityGUIEvent.SECURITY_ENABLED) + { + panel.changeSecureCallButton(true); } - if (securityEvent.getProvider() == SecurityGUIEvent.ZRTP) { - panel.changeZrtpPanel((SecurityGUIEventZrtp)securityEvent); + + if (securityEvent.getProvider() == SecurityGUIEvent.ZRTP) + { + panel.changeZrtpPanel((SecurityGUIEventZrtp) securityEvent); } } + /** * Returns the call for this call panel. * diff --git a/src/net/java/sip/communicator/impl/gui/main/call/CallParticipantPanel.java b/src/net/java/sip/communicator/impl/gui/main/call/CallParticipantPanel.java index d29b05ccf..dd52a0c2b 100644 --- a/src/net/java/sip/communicator/impl/gui/main/call/CallParticipantPanel.java +++ b/src/net/java/sip/communicator/impl/gui/main/call/CallParticipantPanel.java @@ -331,20 +331,19 @@ private Component createSecureCallButton() { secureButton = new SecureButton(callParticipant); - secureButton.setActionCommand("startSecureMode"); - secureButton.setName("secureButton"); secureButton.setToolTipText( GuiActivator.getResources().getI18NString( "impl.media.security.TOGGLE_ON_SECURITY")); + return secureButton; } } return null; } - public void changeSecureCallButton(boolean onOff) + public void changeSecureCallButton(boolean isEnabled) { - secureButton.updateSecureButton(onOff); + secureButton.updateSecureButton(isEnabled); } public void changeZrtpPanel(SecurityGUIEventZrtp securityEvent) diff --git a/src/net/java/sip/communicator/impl/gui/main/call/SecureButton.java b/src/net/java/sip/communicator/impl/gui/main/call/SecureButton.java index 11249cf98..8755e0b37 100644 --- a/src/net/java/sip/communicator/impl/gui/main/call/SecureButton.java +++ b/src/net/java/sip/communicator/impl/gui/main/call/SecureButton.java @@ -8,10 +8,7 @@ import java.awt.event.*; -import javax.swing.*; - import net.java.sip.communicator.impl.gui.*; - import net.java.sip.communicator.impl.gui.customcontrols.*; import net.java.sip.communicator.impl.gui.utils.*; import net.java.sip.communicator.service.protocol.*; @@ -30,6 +27,7 @@ public class SecureButton public SecureButton(CallParticipant callParticipant) { super(ImageLoader.getImage(ImageLoader.SECURE_BUTTON_OFF)); + this.callParticipant = callParticipant; // this.addActionListener(this); } @@ -40,30 +38,27 @@ public void actionPerformed(ActionEvent evt) if (call != null) { - String command = evt.getActionCommand(); - if (command.equals("startSecureMode")) - { - OperationSetSecureTelephony telephony = - (OperationSetSecureTelephony) call.getProtocolProvider() + OperationSetSecureTelephony telephony + = (OperationSetSecureTelephony) call.getProtocolProvider() .getOperationSet(OperationSetSecureTelephony.class); - if (telephony != null && telephony.isSecure(callParticipant)) + if (telephony != null ) + { + if (!telephony.isSecure(callParticipant)) { - updateSecureButton(false); telephony.setSecure(callParticipant, - false, - OperationSetSecureTelephony. - SecureStatusChangeSource - .SECURE_STATUS_CHANGE_BY_LOCAL); + true, + OperationSetSecureTelephony. + SecureStatusChangeSource + .SECURE_STATUS_CHANGE_BY_LOCAL); } - else if (telephony != null) + else { - updateSecureButton(true); telephony.setSecure(callParticipant, - true, - OperationSetSecureTelephony. - SecureStatusChangeSource - .SECURE_STATUS_CHANGE_BY_LOCAL); + false, + OperationSetSecureTelephony. + SecureStatusChangeSource + .SECURE_STATUS_CHANGE_BY_LOCAL); } } } @@ -79,21 +74,17 @@ public void updateSecureButton(boolean isSecure) { if(isSecure) { - this.setIcon( - new ImageIcon( - ImageLoader.getImage(ImageLoader.SECURE_BUTTON_ON))); + this.setImage(ImageLoader.getImage(ImageLoader.SECURE_BUTTON_ON)); // TODO GoClear // We deactivate the tooltip at the moment, because the // secure mode cannot be toggled off - //this.setToolTipText( + // this.setToolTipText( // GuiActivator.getResources().getI18NString("impl.media.security.TOGGLE_OFF_SECURITY").getText()); this.setToolTipText(null); } else { - this.setIcon( - new ImageIcon( - ImageLoader.getImage(ImageLoader.SECURE_BUTTON_OFF))); + this.setImage(ImageLoader.getImage(ImageLoader.SECURE_BUTTON_OFF)); this.setToolTipText( GuiActivator.getResources() .getI18NString("impl.media.security.TOGGLE_ON_SECURITY"));