Adds is server overridden checkbox in jabber account wizard.

cusax-fix
Damian Minkov 14 years ago
parent 4dfd16a63f
commit ea140320c0

@ -939,6 +939,7 @@ plugin.jabberaccregwizz.DOMAIN_BYPASS_CAPS=Domain that will use GTalk call
plugin.jabberaccregwizz.TELEPHONY_DOMAIN=Telephony domain
plugin.jabberaccregwizz.ALLOW_NON_SECURE=Allow non-secure connections
plugin.jabberaccregwizz.DTMF_AUTO=Auto: Choose automatically between RTP and Inband
plugin.jabberaccregwizz.SERVER_OPTIONS=Server options
# mailbox
plugin.mailbox.OUTGOING=Outgoing Message:

@ -13,6 +13,7 @@
import javax.swing.event.*;
import net.java.sip.communicator.util.swing.*;
import org.jitsi.util.*;
/**
*
@ -32,6 +33,9 @@ public class ConnectionPanel
private final JPanel advancedOpPanel
= new TransparentPanel(new BorderLayout(10, 10));
private final JPanel serverOpPanel
= new TransparentPanel(new BorderLayout(10, 10));
private final JPanel labelsAdvOpPanel
= new TransparentPanel(new GridLayout(0, 1, 10, 10));
@ -61,6 +65,11 @@ public class ConnectionPanel
private final JTextField priorityField
= new JTextField(JabberAccountRegistration.DEFAULT_PRIORITY);
private final JCheckBox serverAutoCheckBox = new SIPCommCheckBox(
Resources.getString(
"plugin.jabberaccregwizz.OVERRIDE_SERVER_DEFAULT_OPTIONS"),
JabberAccountRegistration.DEFAULT_RESOURCE_AUTOGEN);
private final JLabel serverLabel
= new JLabel(Resources.getString("plugin.jabberaccregwizz.SERVER"));
@ -140,12 +149,32 @@ public void removeUpdate(DocumentEvent evt)
}
});
serverAutoCheckBox.addActionListener(new ActionListener()
{
/**
* Invoked when an action occurs.
*/
public void actionPerformed(ActionEvent e)
{
enablesServerAutoConfigure(serverAutoCheckBox.isSelected());
}
});
serverAutoCheckBox.setSelected(
parentForm.getRegistration().isServerOverridden());
enablesServerAutoConfigure(serverAutoCheckBox.isSelected());
labelsAdvOpPanel.add(serverLabel);
labelsAdvOpPanel.add(portLabel);
valuesAdvOpPanel.add(serverField);
valuesAdvOpPanel.add(portField);
serverOpPanel.add(serverAutoCheckBox, BorderLayout.NORTH);
serverOpPanel.add(labelsAdvOpPanel, BorderLayout.WEST);
serverOpPanel.add(valuesAdvOpPanel, BorderLayout.CENTER);
serverOpPanel.setBorder(BorderFactory.createTitledBorder(
Resources.getString("plugin.jabberaccregwizz.SERVER_OPTIONS")));
JPanel checkBoxesPanel
= new TransparentPanel(new GridLayout(0, 1, 10, 10));
//checkBoxesPanel.add(sendKeepAliveBox);
@ -172,8 +201,7 @@ public void removeUpdate(DocumentEvent evt)
// default for new account
googleContactsBox.setSelected(true);
advancedOpPanel.add(checkBoxesPanel, BorderLayout.NORTH);
advancedOpPanel.add(labelsAdvOpPanel, BorderLayout.WEST);
advancedOpPanel.add(valuesAdvOpPanel, BorderLayout.CENTER);
advancedOpPanel.add(serverOpPanel, BorderLayout.CENTER);
advancedOpPanel.add(resourcePanel, BorderLayout.SOUTH);
if(autoGenerateResource.isSelected())
@ -193,7 +221,7 @@ public void actionPerformed(ActionEvent e)
mainPanel.add(createDTMFPanel());
String serverAddress = parentForm.getServerAddress();
if (serverAddress != null)
if (!StringUtils.isNullOrEmpty(serverAddress))
serverField.setText(serverAddress);
add(mainPanel, BorderLayout.NORTH);
@ -485,4 +513,37 @@ else if(dtmfMethod.equals("INBAND_DTMF"))
dtmfMethodBox.setSelectedItem(selString);
}
}
/**
* Sets the <tt>serverOverridden</tt> property.
* @param isServerOverridden <tt>true</tt> to indicate that the server is
* overridden, <tt>false</tt> - otherwise
*/
void setServerOverridden(boolean isServerOverridden)
{
this.serverAutoCheckBox.setSelected(isServerOverridden);
enablesServerAutoConfigure(serverAutoCheckBox.isSelected());
}
/**
* Return <tt>isServerOverridden</tt> property.
* @return <tt>isServerOverridden</tt> property.
*/
boolean isServerOverridden()
{
return this.serverAutoCheckBox.isSelected();
}
/**
* Enables/disables the proxy auto-configuration.
* @param isEnable <tt>true</tt> to enable proxy auto-configuration,
* <tt>false</tt> - otherwise
*/
void enablesServerAutoConfigure(boolean isEnable)
{
serverAutoCheckBox.setSelected(isEnable);
serverField.setEnabled(isEnable);
portField.setEnabled(isEnable);
parentForm.reValidateInput();
}
}

@ -268,6 +268,7 @@ public boolean commitPage(JabberAccountRegistration registration)
registration.setPassword(new String(password));
registration.setRememberPassword(accountPanel.isRememberPassword());
registration.setServerAddress(serverAddress);
registration.setServerOverridden(connectionPanel.isServerOverridden());
registration.setSendKeepAlive(connectionPanel.isSendKeepAlive());
registration.setGmailNotificationEnabled(
connectionPanel.isGmailNotificationsEnabled());
@ -509,10 +510,12 @@ public void loadAccount(AccountID accountID)
connectionPanel.setAllowNonSecure(isAllowNonSecure);
wizard.getRegistration().setServerOverridden(
boolean isServerOverriden =
accountID.getAccountPropertyBoolean(
ProtocolProviderFactory.IS_SERVER_OVERRIDDEN,
false));
ProtocolProviderFactory.IS_SERVER_OVERRIDDEN,
false);
connectionPanel.setServerOverridden(isServerOverriden);
String telephonyDomain = accountProperties.get("OVERRIDE_PHONE_SUFFIX");
telephonyConfigPanel.setTelephonyDomain(telephonyDomain);

@ -311,17 +311,25 @@ protected ProtocolProviderService installAccount(
&& registration.getServerAddress().length() > 0)
{
serverName = registration.getServerAddress();
if (userName.indexOf(serverName) < 0)
accountProperties.put(
ProtocolProviderFactory.IS_SERVER_OVERRIDDEN,
Boolean.toString(true));
}
else
{
serverName = getServerFromUserName(userName);
}
if(registration.isServerOverridden())
{
accountProperties.put(
ProtocolProviderFactory.IS_SERVER_OVERRIDDEN,
Boolean.toString(true));
}
else
{
accountProperties.put(
ProtocolProviderFactory.IS_SERVER_OVERRIDDEN,
Boolean.toString(false));
}
if (serverName == null || serverName.length() <= 0)
throw new OperationFailedException(
"Should specify a server for user name " + userName + ".",

Loading…
Cancel
Save