mirror of
https://github.com/igniterealtime/Spark.git
synced 2025-12-01 12:27:58 +00:00
Refactoring.
git-svn-id: http://svn.igniterealtime.org/svn/repos/spark/trunk@6927 b35dd754-fafc-0310-a699-88a17e54d16e
This commit is contained in:
@ -25,6 +25,14 @@ import org.jivesoftware.spark.util.SwingWorker;
|
|||||||
import org.jivesoftware.sparkimpl.settings.local.LocalPreferences;
|
import org.jivesoftware.sparkimpl.settings.local.LocalPreferences;
|
||||||
import org.jivesoftware.sparkimpl.settings.local.SettingsManager;
|
import org.jivesoftware.sparkimpl.settings.local.SettingsManager;
|
||||||
|
|
||||||
|
import java.awt.BorderLayout;
|
||||||
|
import java.awt.Component;
|
||||||
|
import java.awt.GridBagConstraints;
|
||||||
|
import java.awt.GridBagLayout;
|
||||||
|
import java.awt.Insets;
|
||||||
|
import java.awt.event.ActionEvent;
|
||||||
|
import java.awt.event.ActionListener;
|
||||||
|
|
||||||
import javax.swing.JButton;
|
import javax.swing.JButton;
|
||||||
import javax.swing.JDialog;
|
import javax.swing.JDialog;
|
||||||
import javax.swing.JFrame;
|
import javax.swing.JFrame;
|
||||||
@ -35,14 +43,9 @@ import javax.swing.JPasswordField;
|
|||||||
import javax.swing.JProgressBar;
|
import javax.swing.JProgressBar;
|
||||||
import javax.swing.JTextField;
|
import javax.swing.JTextField;
|
||||||
|
|
||||||
import java.awt.BorderLayout;
|
/**
|
||||||
import java.awt.Component;
|
* Allows the creation of accounts on an XMPP server.
|
||||||
import java.awt.GridBagConstraints;
|
*/
|
||||||
import java.awt.GridBagLayout;
|
|
||||||
import java.awt.Insets;
|
|
||||||
import java.awt.event.ActionEvent;
|
|
||||||
import java.awt.event.ActionListener;
|
|
||||||
|
|
||||||
public class AccountCreationWizard extends JPanel {
|
public class AccountCreationWizard extends JPanel {
|
||||||
private JLabel usernameLabel = new JLabel();
|
private JLabel usernameLabel = new JLabel();
|
||||||
private JTextField usernameField = new JTextField();
|
private JTextField usernameField = new JTextField();
|
||||||
@ -65,7 +68,9 @@ public class AccountCreationWizard extends JPanel {
|
|||||||
private XMPPConnection connection = null;
|
private XMPPConnection connection = null;
|
||||||
private JProgressBar progressBar;
|
private JProgressBar progressBar;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Construct the AccountCreationWizard UI.
|
||||||
|
*/
|
||||||
public AccountCreationWizard() {
|
public AccountCreationWizard() {
|
||||||
// Associate Mnemonics
|
// Associate Mnemonics
|
||||||
ResourceUtils.resLabel(usernameLabel, usernameField, Res.getString("label.username") + ":");
|
ResourceUtils.resLabel(usernameLabel, usernameField, Res.getString("label.username") + ":");
|
||||||
@ -114,27 +119,55 @@ public class AccountCreationWizard extends JPanel {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the username to use for the new account.
|
||||||
|
*
|
||||||
|
* @return the username.
|
||||||
|
*/
|
||||||
public String getUsername() {
|
public String getUsername() {
|
||||||
return StringUtils.escapeNode(usernameField.getText().toLowerCase());
|
return StringUtils.escapeNode(usernameField.getText().toLowerCase());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the password to use for the new account.
|
||||||
|
*
|
||||||
|
* @return the password to use for the new account.
|
||||||
|
*/
|
||||||
public String getPassword() {
|
public String getPassword() {
|
||||||
return new String(passwordField.getPassword());
|
return new String(passwordField.getPassword());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the confirmation password to use for the new account.
|
||||||
|
*
|
||||||
|
* @return the password to use for the new account.
|
||||||
|
*/
|
||||||
public String getConfirmPassword() {
|
public String getConfirmPassword() {
|
||||||
return new String(confirmPasswordField.getPassword());
|
return new String(confirmPasswordField.getPassword());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the server to use with the new account.
|
||||||
|
*
|
||||||
|
* @return the server to use.
|
||||||
|
*/
|
||||||
public String getServer() {
|
public String getServer() {
|
||||||
return serverField.getText();
|
return serverField.getText();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns true if the passwords match.
|
||||||
|
*
|
||||||
|
* @return true if the passwords match.
|
||||||
|
*/
|
||||||
public boolean isPasswordValid() {
|
public boolean isPasswordValid() {
|
||||||
return getPassword().equals(getConfirmPassword());
|
return getPassword().equals(getConfirmPassword());
|
||||||
}
|
}
|
||||||
|
|
||||||
public void createAccount() {
|
/**
|
||||||
|
* Creates the new account using the supplied information.
|
||||||
|
*/
|
||||||
|
private void createAccount() {
|
||||||
boolean errors = false;
|
boolean errors = false;
|
||||||
String errorMessage = "";
|
String errorMessage = "";
|
||||||
|
|
||||||
@ -170,6 +203,7 @@ public class AccountCreationWizard extends JPanel {
|
|||||||
progressBar.setStringPainted(true);
|
progressBar.setStringPainted(true);
|
||||||
progressBar.setString(Res.getString("message.registering", getServer()));
|
progressBar.setString(Res.getString("message.registering", getServer()));
|
||||||
progressBar.setVisible(true);
|
progressBar.setVisible(true);
|
||||||
|
|
||||||
final SwingWorker worker = new SwingWorker() {
|
final SwingWorker worker = new SwingWorker() {
|
||||||
int errorCode;
|
int errorCode;
|
||||||
|
|
||||||
@ -222,6 +256,11 @@ public class AccountCreationWizard extends JPanel {
|
|||||||
worker.start();
|
worker.start();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Called if the account creation failed.
|
||||||
|
*
|
||||||
|
* @param errorCode the error code.
|
||||||
|
*/
|
||||||
private void accountCreationFailed(int errorCode) {
|
private void accountCreationFailed(int errorCode) {
|
||||||
String message = Res.getString("message.create.account");
|
String message = Res.getString("message.create.account");
|
||||||
if (errorCode == 409) {
|
if (errorCode == 409) {
|
||||||
@ -233,12 +272,20 @@ public class AccountCreationWizard extends JPanel {
|
|||||||
createAccountButton.setEnabled(true);
|
createAccountButton.setEnabled(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Called if the account was created succesfully.
|
||||||
|
*/
|
||||||
private void accountCreationSuccessful() {
|
private void accountCreationSuccessful() {
|
||||||
registered = true;
|
registered = true;
|
||||||
JOptionPane.showMessageDialog(this, Res.getString("message.account.created"), Res.getString("title.account.created"), JOptionPane.INFORMATION_MESSAGE);
|
JOptionPane.showMessageDialog(this, Res.getString("message.account.created"), Res.getString("title.account.created"), JOptionPane.INFORMATION_MESSAGE);
|
||||||
dialog.dispose();
|
dialog.dispose();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Invokes the AccountCreationWizard.
|
||||||
|
*
|
||||||
|
* @param parent the parent frame to use.
|
||||||
|
*/
|
||||||
public void invoke(JFrame parent) {
|
public void invoke(JFrame parent) {
|
||||||
dialog = new JDialog(parent, Res.getString("title.create.new.account"), true);
|
dialog = new JDialog(parent, Res.getString("title.create.new.account"), true);
|
||||||
|
|
||||||
@ -252,13 +299,19 @@ public class AccountCreationWizard extends JPanel {
|
|||||||
dialog.setVisible(true);
|
dialog.setVisible(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates an XMPPConnection based on the users settings.
|
||||||
|
*
|
||||||
|
* @return the XMPPConnection created.
|
||||||
|
* @throws XMPPException thrown if an exception occured creating the connection.
|
||||||
|
*/
|
||||||
private XMPPConnection getConnection() throws XMPPException {
|
private XMPPConnection getConnection() throws XMPPException {
|
||||||
LocalPreferences localPref = SettingsManager.getLocalPreferences();
|
final LocalPreferences localPreferences = SettingsManager.getLocalPreferences();
|
||||||
XMPPConnection con = null;
|
XMPPConnection connection = null;
|
||||||
|
|
||||||
// Get connection
|
// Get connection
|
||||||
|
|
||||||
int port = localPref.getXmppPort();
|
int port = localPreferences.getXmppPort();
|
||||||
|
|
||||||
String serverName = getServer();
|
String serverName = getServer();
|
||||||
|
|
||||||
@ -271,8 +324,8 @@ public class AccountCreationWizard extends JPanel {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
boolean useSSL = localPref.isSSL();
|
boolean useSSL = localPreferences.isSSL();
|
||||||
boolean hostPortConfigured = localPref.isHostAndPortConfigured();
|
boolean hostPortConfigured = localPreferences.isHostAndPortConfigured();
|
||||||
|
|
||||||
ConnectionConfiguration config = null;
|
ConnectionConfiguration config = null;
|
||||||
|
|
||||||
@ -282,7 +335,7 @@ public class AccountCreationWizard extends JPanel {
|
|||||||
config.setSocketFactory(new DummySSLSocketFactory());
|
config.setSocketFactory(new DummySSLSocketFactory());
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
config = new ConnectionConfiguration(localPref.getXmppHost(), port, serverName);
|
config = new ConnectionConfiguration(localPreferences.getXmppHost(), port, serverName);
|
||||||
config.setSocketFactory(new DummySSLSocketFactory());
|
config.setSocketFactory(new DummySSLSocketFactory());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -291,7 +344,7 @@ public class AccountCreationWizard extends JPanel {
|
|||||||
config = new ConnectionConfiguration(serverName);
|
config = new ConnectionConfiguration(serverName);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
config = new ConnectionConfiguration(localPref.getXmppHost(), port, serverName);
|
config = new ConnectionConfiguration(localPreferences.getXmppHost(), port, serverName);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -299,18 +352,23 @@ public class AccountCreationWizard extends JPanel {
|
|||||||
|
|
||||||
if (config != null) {
|
if (config != null) {
|
||||||
config.setReconnectionAllowed(true);
|
config.setReconnectionAllowed(true);
|
||||||
boolean compressionEnabled = localPref.isCompressionEnabled();
|
boolean compressionEnabled = localPreferences.isCompressionEnabled();
|
||||||
config.setCompressionEnabled(compressionEnabled);
|
config.setCompressionEnabled(compressionEnabled);
|
||||||
con = new XMPPConnection(config);
|
connection = new XMPPConnection(config);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (con != null) {
|
if (connection != null) {
|
||||||
con.connect();
|
connection.connect();
|
||||||
}
|
}
|
||||||
return con;
|
return connection;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns true if the user is registered.
|
||||||
|
*
|
||||||
|
* @return true if the user is registered.
|
||||||
|
*/
|
||||||
public boolean isRegistered() {
|
public boolean isRegistered() {
|
||||||
return registered;
|
return registered;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -19,6 +19,10 @@ import com.install4j.api.windows.WinRegistry;
|
|||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The installer class is used by the Install4j Installer to setup registry entries
|
||||||
|
* during the setup process.
|
||||||
|
*/
|
||||||
public class Installer extends InstallAction {
|
public class Installer extends InstallAction {
|
||||||
|
|
||||||
private InstallerWizardContext context;
|
private InstallerWizardContext context;
|
||||||
@ -38,24 +42,34 @@ public class Installer extends InstallAction {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
addStartup(installerWizardContext.getInstallationDirectory());
|
addSparkToStartup(installerWizardContext.getInstallationDirectory());
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void addStartup(File dir) {
|
/**
|
||||||
File jivec = new File(dir, "Spark.exe");
|
* Adds Spark to the users registry.
|
||||||
|
*
|
||||||
|
* @param dir the installation directory of Spark.
|
||||||
|
*/
|
||||||
|
public void addSparkToStartup(File dir) {
|
||||||
|
final File sparkDirectory = new File(dir, "Spark.exe");
|
||||||
try {
|
try {
|
||||||
String path = jivec.getCanonicalPath();
|
final String sparkPath = sparkDirectory.getCanonicalPath();
|
||||||
WinRegistry.setValue(WinRegistry.HKEY_CURRENT_USER, "Software\\Microsoft\\Windows\\CurrentVersion\\Run", "Spark", path);
|
WinRegistry.setValue(WinRegistry.HKEY_CURRENT_USER, "Software\\Microsoft\\Windows\\CurrentVersion\\Run", "Spark", sparkPath);
|
||||||
|
|
||||||
addURIMapping(dir, path);
|
setURI(sparkPath);
|
||||||
}
|
}
|
||||||
catch (IOException e) {
|
catch (IOException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void addURIMapping(File dir, String path) {
|
/**
|
||||||
|
* Adds Spark to the users registry to allow for XMPP URI mapping.
|
||||||
|
*
|
||||||
|
* @param path the installation directory of spark.
|
||||||
|
*/
|
||||||
|
private void setURI(String path) {
|
||||||
boolean exists = WinRegistry.keyExists(WinRegistry.HKEY_CLASSES_ROOT, "xmpp");
|
boolean exists = WinRegistry.keyExists(WinRegistry.HKEY_CLASSES_ROOT, "xmpp");
|
||||||
if (exists) {
|
if (exists) {
|
||||||
}
|
}
|
||||||
|
|||||||
@ -49,7 +49,6 @@ import java.awt.GridBagConstraints;
|
|||||||
import java.awt.GridBagLayout;
|
import java.awt.GridBagLayout;
|
||||||
import java.awt.Image;
|
import java.awt.Image;
|
||||||
import java.awt.Insets;
|
import java.awt.Insets;
|
||||||
import java.awt.LayoutManager;
|
|
||||||
import java.awt.event.ActionEvent;
|
import java.awt.event.ActionEvent;
|
||||||
import java.awt.event.ActionListener;
|
import java.awt.event.ActionListener;
|
||||||
import java.awt.event.FocusEvent;
|
import java.awt.event.FocusEvent;
|
||||||
@ -65,7 +64,6 @@ import java.util.List;
|
|||||||
|
|
||||||
import javax.swing.ImageIcon;
|
import javax.swing.ImageIcon;
|
||||||
import javax.swing.JCheckBox;
|
import javax.swing.JCheckBox;
|
||||||
import javax.swing.JComponent;
|
|
||||||
import javax.swing.JFrame;
|
import javax.swing.JFrame;
|
||||||
import javax.swing.JLabel;
|
import javax.swing.JLabel;
|
||||||
import javax.swing.JOptionPane;
|
import javax.swing.JOptionPane;
|
||||||
@ -122,7 +120,7 @@ public final class LoginDialog {
|
|||||||
|
|
||||||
loginDialog.setIconImage(SparkRes.getImageIcon(SparkRes.MAIN_IMAGE).getImage());
|
loginDialog.setIconImage(SparkRes.getImageIcon(SparkRes.MAIN_IMAGE).getImage());
|
||||||
|
|
||||||
final JPanel mainPanel = new GrayBackgroundPanel();
|
final JPanel mainPanel = new LoginBackgroundPanel();
|
||||||
final GridBagLayout mainLayout = new GridBagLayout();
|
final GridBagLayout mainLayout = new GridBagLayout();
|
||||||
mainPanel.setLayout(mainLayout);
|
mainPanel.setLayout(mainLayout);
|
||||||
|
|
||||||
@ -302,7 +300,7 @@ public final class LoginDialog {
|
|||||||
advancedButton.addActionListener(this);
|
advancedButton.addActionListener(this);
|
||||||
|
|
||||||
// Make same size
|
// Make same size
|
||||||
GraphicUtils.makeSameSize(new JComponent[]{usernameField, passwordField});
|
GraphicUtils.makeSameSize(usernameField, passwordField);
|
||||||
|
|
||||||
// Set progress bar description
|
// Set progress bar description
|
||||||
progressBar.setText(Res.getString("message.autenticating"));
|
progressBar.setText(Res.getString("message.autenticating"));
|
||||||
@ -374,14 +372,29 @@ public final class LoginDialog {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the username the user defined.
|
||||||
|
*
|
||||||
|
* @return the username.
|
||||||
|
*/
|
||||||
private String getUsername() {
|
private String getUsername() {
|
||||||
return StringUtils.escapeNode(usernameField.getText().trim());
|
return StringUtils.escapeNode(usernameField.getText().trim());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the password specified by the user.
|
||||||
|
*
|
||||||
|
* @return the password.
|
||||||
|
*/
|
||||||
private String getPassword() {
|
private String getPassword() {
|
||||||
return new String(passwordField.getPassword());
|
return new String(passwordField.getPassword());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the server name specified by the user.
|
||||||
|
*
|
||||||
|
* @return the server name.
|
||||||
|
*/
|
||||||
private String getServerName() {
|
private String getServerName() {
|
||||||
return serverField.getText().trim();
|
return serverField.getText().trim();
|
||||||
}
|
}
|
||||||
@ -446,11 +459,19 @@ public final class LoginDialog {
|
|||||||
validateDialog();
|
validateDialog();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Checks the users input and enables/disables the login button depending on state.
|
||||||
|
*/
|
||||||
private void validateDialog() {
|
private void validateDialog() {
|
||||||
loginButton.setEnabled(ModelUtil.hasLength(getUsername()) && ModelUtil.hasLength(getPassword())
|
loginButton.setEnabled(ModelUtil.hasLength(getUsername()) && ModelUtil.hasLength(getPassword())
|
||||||
&& ModelUtil.hasLength(getServerName()));
|
&& ModelUtil.hasLength(getServerName()));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Validates key input.
|
||||||
|
*
|
||||||
|
* @param e the keyEvent.
|
||||||
|
*/
|
||||||
private void validate(KeyEvent e) {
|
private void validate(KeyEvent e) {
|
||||||
if (loginButton.isEnabled() && e.getKeyChar() == KeyEvent.VK_ENTER) {
|
if (loginButton.isEnabled() && e.getKeyChar() == KeyEvent.VK_ENTER) {
|
||||||
validateLogin();
|
validateLogin();
|
||||||
@ -467,6 +488,11 @@ public final class LoginDialog {
|
|||||||
public void focusLost(FocusEvent e) {
|
public void focusLost(FocusEvent e) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Enables/Disables the editable components in the login screen.
|
||||||
|
*
|
||||||
|
* @param editable true to enable components, otherwise false to disable.
|
||||||
|
*/
|
||||||
private void enableComponents(boolean editable) {
|
private void enableComponents(boolean editable) {
|
||||||
|
|
||||||
// Need to set both editable and enabled for best behavior.
|
// Need to set both editable and enabled for best behavior.
|
||||||
@ -480,14 +506,18 @@ public final class LoginDialog {
|
|||||||
serverField.setEnabled(editable);
|
serverField.setEnabled(editable);
|
||||||
|
|
||||||
if (editable) {
|
if (editable) {
|
||||||
|
|
||||||
// Reapply focus to username field
|
// Reapply focus to username field
|
||||||
passwordField.requestFocus();
|
passwordField.requestFocus();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void showProgressBar(boolean show) {
|
/**
|
||||||
if (show) {
|
* Displays the progress bar.
|
||||||
|
*
|
||||||
|
* @param visible true to display progress bar, false to hide it.
|
||||||
|
*/
|
||||||
|
private void setProgressBarVisible(boolean visible) {
|
||||||
|
if (visible) {
|
||||||
cardLayout.show(cardPanel, PROGRESS_BAR);
|
cardLayout.show(cardPanel, PROGRESS_BAR);
|
||||||
// progressBar.setIndeterminate(true);
|
// progressBar.setIndeterminate(true);
|
||||||
}
|
}
|
||||||
@ -496,9 +526,11 @@ public final class LoginDialog {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Validates the users login information.
|
||||||
|
*/
|
||||||
private void validateLogin() {
|
private void validateLogin() {
|
||||||
|
final SwingWorker loginValidationThread = new SwingWorker() {
|
||||||
SwingWorker worker = new SwingWorker() {
|
|
||||||
public Object construct() {
|
public Object construct() {
|
||||||
|
|
||||||
boolean loginSuccessfull = login();
|
boolean loginSuccessfull = login();
|
||||||
@ -518,7 +550,7 @@ public final class LoginDialog {
|
|||||||
savePasswordBox.setEnabled(true);
|
savePasswordBox.setEnabled(true);
|
||||||
autoLoginBox.setEnabled(true);
|
autoLoginBox.setEnabled(true);
|
||||||
enableComponents(true);
|
enableComponents(true);
|
||||||
showProgressBar(false);
|
setProgressBarVisible(false);
|
||||||
}
|
}
|
||||||
return Boolean.valueOf(loginSuccessfull);
|
return Boolean.valueOf(loginSuccessfull);
|
||||||
}
|
}
|
||||||
@ -529,9 +561,9 @@ public final class LoginDialog {
|
|||||||
enableComponents(false);
|
enableComponents(false);
|
||||||
|
|
||||||
// Show progressbar
|
// Show progressbar
|
||||||
showProgressBar(true);
|
setProgressBarVisible(true);
|
||||||
|
|
||||||
worker.start();
|
loginValidationThread.start();
|
||||||
}
|
}
|
||||||
|
|
||||||
public JPasswordField getPasswordField() {
|
public JPasswordField getPasswordField() {
|
||||||
@ -672,7 +704,6 @@ public final class LoginDialog {
|
|||||||
// Persist information
|
// Persist information
|
||||||
localPref.setUsername(getUsername());
|
localPref.setUsername(getUsername());
|
||||||
|
|
||||||
|
|
||||||
// Check to see if the password should be saved.
|
// Check to see if the password should be saved.
|
||||||
if (savePasswordBox.isSelected()) {
|
if (savePasswordBox.isSelected()) {
|
||||||
String encodedPassword = null;
|
String encodedPassword = null;
|
||||||
@ -687,7 +718,7 @@ public final class LoginDialog {
|
|||||||
else {
|
else {
|
||||||
localPref.setPassword("");
|
localPref.setPassword("");
|
||||||
}
|
}
|
||||||
|
|
||||||
localPref.setSavePassword(savePasswordBox.isSelected());
|
localPref.setSavePassword(savePasswordBox.isSelected());
|
||||||
localPref.setAutoLogin(autoLoginBox.isSelected());
|
localPref.setAutoLogin(autoLoginBox.isSelected());
|
||||||
localPref.setServer(serverField.getText());
|
localPref.setServer(serverField.getText());
|
||||||
@ -771,6 +802,11 @@ public final class LoginDialog {
|
|||||||
workspace.buildLayout();
|
workspace.buildLayout();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Updates System properties with Proxy configuration.
|
||||||
|
*
|
||||||
|
* @throws Exception thrown if an exception occurs.
|
||||||
|
*/
|
||||||
private void updateProxyConfig() throws Exception {
|
private void updateProxyConfig() throws Exception {
|
||||||
if (ModelUtil.hasLength(Default.getString(Default.PROXY_PORT)) && ModelUtil.hasLength(Default.getString(Default.PROXY_HOST))) {
|
if (ModelUtil.hasLength(Default.getString(Default.PROXY_PORT)) && ModelUtil.hasLength(Default.getString(Default.PROXY_HOST))) {
|
||||||
String port = Default.getString(Default.PROXY_PORT);
|
String port = Default.getString(Default.PROXY_PORT);
|
||||||
@ -799,17 +835,24 @@ public final class LoginDialog {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public class GrayBackgroundPanel extends JPanel {
|
/**
|
||||||
|
* Defines the background to use with the Login panel.
|
||||||
|
*/
|
||||||
|
public class LoginBackgroundPanel extends JPanel {
|
||||||
final ImageIcon icons = Default.getImageIcon(Default.LOGIN_DIALOG_BACKGROUND_IMAGE);
|
final ImageIcon icons = Default.getImageIcon(Default.LOGIN_DIALOG_BACKGROUND_IMAGE);
|
||||||
|
|
||||||
public GrayBackgroundPanel() {
|
/**
|
||||||
|
* Empty constructor.
|
||||||
|
*/
|
||||||
|
public LoginBackgroundPanel() {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public GrayBackgroundPanel(LayoutManager layout) {
|
/**
|
||||||
super(layout);
|
* Uses an image to paint on background.
|
||||||
}
|
*
|
||||||
|
* @param g the graphics.
|
||||||
|
*/
|
||||||
public void paintComponent(Graphics g) {
|
public void paintComponent(Graphics g) {
|
||||||
Image backgroundImage = icons.getImage();
|
Image backgroundImage = icons.getImage();
|
||||||
double scaleX = getWidth() / (double)backgroundImage.getWidth(null);
|
double scaleX = getWidth() / (double)backgroundImage.getWidth(null);
|
||||||
@ -819,21 +862,22 @@ public final class LoginDialog {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The image panel to display the Spark Logo.
|
||||||
|
*/
|
||||||
public class ImagePanel extends JPanel {
|
public class ImagePanel extends JPanel {
|
||||||
final ImageIcon icons = Default.getImageIcon(Default.MAIN_IMAGE);
|
|
||||||
|
|
||||||
public ImagePanel() {
|
private final ImageIcon icons = Default.getImageIcon(Default.MAIN_IMAGE);
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
public ImagePanel(LayoutManager layout) {
|
|
||||||
super(layout);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Uses the Spark logo to paint as the background.
|
||||||
|
*
|
||||||
|
* @param g the graphics to use.
|
||||||
|
*/
|
||||||
public void paintComponent(Graphics g) {
|
public void paintComponent(Graphics g) {
|
||||||
Image backgroundImage = icons.getImage();
|
final Image backgroundImage = icons.getImage();
|
||||||
double scaleX = getWidth() / (double)backgroundImage.getWidth(null);
|
final double scaleX = getWidth() / (double)backgroundImage.getWidth(null);
|
||||||
double scaleY = getHeight() / (double)backgroundImage.getHeight(null);
|
final double scaleY = getHeight() / (double)backgroundImage.getHeight(null);
|
||||||
AffineTransform xform = AffineTransform.getScaleInstance(scaleX, scaleY);
|
AffineTransform xform = AffineTransform.getScaleInstance(scaleX, scaleY);
|
||||||
((Graphics2D)g).drawImage(backgroundImage, xform, this);
|
((Graphics2D)g).drawImage(backgroundImage, xform, this);
|
||||||
}
|
}
|
||||||
@ -846,6 +890,11 @@ public final class LoginDialog {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Checks for historic Spark settings and upgrades the user.
|
||||||
|
*
|
||||||
|
* @throws Exception thrown if an error occurs.
|
||||||
|
*/
|
||||||
private void checkForOldSettings() throws Exception {
|
private void checkForOldSettings() throws Exception {
|
||||||
// Check for old settings.xml
|
// Check for old settings.xml
|
||||||
File settingsXML = new File(Spark.getUserHome(), "/Spark/settings.xml");
|
File settingsXML = new File(Spark.getUserHome(), "/Spark/settings.xml");
|
||||||
|
|||||||
@ -19,6 +19,17 @@ import org.jivesoftware.spark.util.ResourceUtils;
|
|||||||
import org.jivesoftware.sparkimpl.settings.local.LocalPreferences;
|
import org.jivesoftware.sparkimpl.settings.local.LocalPreferences;
|
||||||
import org.jivesoftware.sparkimpl.settings.local.SettingsManager;
|
import org.jivesoftware.sparkimpl.settings.local.SettingsManager;
|
||||||
|
|
||||||
|
import java.awt.BorderLayout;
|
||||||
|
import java.awt.Component;
|
||||||
|
import java.awt.GridBagConstraints;
|
||||||
|
import java.awt.GridBagLayout;
|
||||||
|
import java.awt.Insets;
|
||||||
|
import java.awt.event.ActionEvent;
|
||||||
|
import java.awt.event.ActionListener;
|
||||||
|
import java.beans.PropertyChangeEvent;
|
||||||
|
import java.beans.PropertyChangeListener;
|
||||||
|
import java.util.Properties;
|
||||||
|
|
||||||
import javax.swing.BorderFactory;
|
import javax.swing.BorderFactory;
|
||||||
import javax.swing.JCheckBox;
|
import javax.swing.JCheckBox;
|
||||||
import javax.swing.JComboBox;
|
import javax.swing.JComboBox;
|
||||||
@ -32,17 +43,6 @@ import javax.swing.JPasswordField;
|
|||||||
import javax.swing.JTabbedPane;
|
import javax.swing.JTabbedPane;
|
||||||
import javax.swing.JTextField;
|
import javax.swing.JTextField;
|
||||||
|
|
||||||
import java.awt.BorderLayout;
|
|
||||||
import java.awt.Component;
|
|
||||||
import java.awt.GridBagConstraints;
|
|
||||||
import java.awt.GridBagLayout;
|
|
||||||
import java.awt.Insets;
|
|
||||||
import java.awt.event.ActionEvent;
|
|
||||||
import java.awt.event.ActionListener;
|
|
||||||
import java.beans.PropertyChangeEvent;
|
|
||||||
import java.beans.PropertyChangeListener;
|
|
||||||
import java.util.Properties;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Allows users to configure startup options.
|
* Allows users to configure startup options.
|
||||||
*
|
*
|
||||||
@ -70,9 +70,7 @@ public class LoginSettingDialog implements PropertyChangeListener {
|
|||||||
|
|
||||||
private JCheckBox autoLoginBox = new JCheckBox();
|
private JCheckBox autoLoginBox = new JCheckBox();
|
||||||
|
|
||||||
|
|
||||||
private JCheckBox useSSLBox = new JCheckBox();
|
private JCheckBox useSSLBox = new JCheckBox();
|
||||||
private JLabel sslLabel = new JLabel();
|
|
||||||
|
|
||||||
private JCheckBox compressionBox = new JCheckBox();
|
private JCheckBox compressionBox = new JCheckBox();
|
||||||
|
|
||||||
@ -168,7 +166,7 @@ public class LoginSettingDialog implements PropertyChangeListener {
|
|||||||
// The user should only be able to close this dialog.
|
// The user should only be able to close this dialog.
|
||||||
Object[] options = {Res.getString("ok"), Res.getString("cancel"), Res.getString("use.default")};
|
Object[] options = {Res.getString("ok"), Res.getString("cancel"), Res.getString("use.default")};
|
||||||
optionPane = new JOptionPane(tabbedPane, JOptionPane.PLAIN_MESSAGE,
|
optionPane = new JOptionPane(tabbedPane, JOptionPane.PLAIN_MESSAGE,
|
||||||
JOptionPane.OK_CANCEL_OPTION, null, options, options[0]);
|
JOptionPane.OK_CANCEL_OPTION, null, options, options[0]);
|
||||||
|
|
||||||
mainPanel.add(optionPane, BorderLayout.CENTER);
|
mainPanel.add(optionPane, BorderLayout.CENTER);
|
||||||
|
|
||||||
@ -211,7 +209,7 @@ public class LoginSettingDialog implements PropertyChangeListener {
|
|||||||
}
|
}
|
||||||
catch (NumberFormatException numberFormatException) {
|
catch (NumberFormatException numberFormatException) {
|
||||||
JOptionPane.showMessageDialog(optionsDialog, Res.getString("message.supply.valid.timeout"),
|
JOptionPane.showMessageDialog(optionsDialog, Res.getString("message.supply.valid.timeout"),
|
||||||
Res.getString("title.error"), JOptionPane.ERROR_MESSAGE);
|
Res.getString("title.error"), JOptionPane.ERROR_MESSAGE);
|
||||||
timeOutField.requestFocus();
|
timeOutField.requestFocus();
|
||||||
errors = true;
|
errors = true;
|
||||||
}
|
}
|
||||||
@ -221,14 +219,14 @@ public class LoginSettingDialog implements PropertyChangeListener {
|
|||||||
}
|
}
|
||||||
catch (NumberFormatException numberFormatException) {
|
catch (NumberFormatException numberFormatException) {
|
||||||
JOptionPane.showMessageDialog(optionsDialog, Res.getString("message.supply.valid.port"),
|
JOptionPane.showMessageDialog(optionsDialog, Res.getString("message.supply.valid.port"),
|
||||||
Res.getString("title.error"), JOptionPane.ERROR_MESSAGE);
|
Res.getString("title.error"), JOptionPane.ERROR_MESSAGE);
|
||||||
portField.requestFocus();
|
portField.requestFocus();
|
||||||
errors = true;
|
errors = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!ModelUtil.hasLength(resource)) {
|
if (!ModelUtil.hasLength(resource)) {
|
||||||
JOptionPane.showMessageDialog(optionsDialog, Res.getString("message.supply.resource"),
|
JOptionPane.showMessageDialog(optionsDialog, Res.getString("message.supply.resource"),
|
||||||
Res.getString("title.error"), JOptionPane.ERROR_MESSAGE);
|
Res.getString("title.error"), JOptionPane.ERROR_MESSAGE);
|
||||||
resourceField.requestFocus();
|
resourceField.requestFocus();
|
||||||
errors = true;
|
errors = true;
|
||||||
}
|
}
|
||||||
@ -242,7 +240,7 @@ public class LoginSettingDialog implements PropertyChangeListener {
|
|||||||
|
|
||||||
optionsDialog.setVisible(false);
|
optionsDialog.setVisible(false);
|
||||||
localPreferences.setResource(resource);
|
localPreferences.setResource(resource);
|
||||||
proxyPanel.save();
|
proxyPanel.saveProxySettings();
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
optionPane.removePropertyChangeListener(this);
|
optionPane.removePropertyChangeListener(this);
|
||||||
@ -261,6 +259,9 @@ public class LoginSettingDialog implements PropertyChangeListener {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Internal class to allow setting of proxies within Spark.
|
||||||
|
*/
|
||||||
private class ProxyPanel extends JPanel {
|
private class ProxyPanel extends JPanel {
|
||||||
private JCheckBox useProxyBox = new JCheckBox();
|
private JCheckBox useProxyBox = new JCheckBox();
|
||||||
private JComboBox protocolBox = new JComboBox();
|
private JComboBox protocolBox = new JComboBox();
|
||||||
@ -269,6 +270,9 @@ public class LoginSettingDialog implements PropertyChangeListener {
|
|||||||
private JTextField usernameField = new JTextField();
|
private JTextField usernameField = new JTextField();
|
||||||
private JPasswordField passwordField = new JPasswordField();
|
private JPasswordField passwordField = new JPasswordField();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Construct UI.
|
||||||
|
*/
|
||||||
public ProxyPanel() {
|
public ProxyPanel() {
|
||||||
JLabel protocolLabel = new JLabel();
|
JLabel protocolLabel = new JLabel();
|
||||||
JLabel hostLabel = new JLabel();
|
JLabel hostLabel = new JLabel();
|
||||||
@ -341,6 +345,11 @@ public class LoginSettingDialog implements PropertyChangeListener {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Enables the fields of the proxy panel.
|
||||||
|
*
|
||||||
|
* @param enable true if all fields should be enabled, otherwise false.
|
||||||
|
*/
|
||||||
private void enableFields(boolean enable) {
|
private void enableFields(boolean enable) {
|
||||||
Component[] comps = getComponents();
|
Component[] comps = getComponents();
|
||||||
for (int i = 0; i < comps.length; i++) {
|
for (int i = 0; i < comps.length; i++) {
|
||||||
@ -351,31 +360,64 @@ public class LoginSettingDialog implements PropertyChangeListener {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns true if a proxy is set.
|
||||||
|
*
|
||||||
|
* @return true if a proxy is set.
|
||||||
|
*/
|
||||||
public boolean useProxy() {
|
public boolean useProxy() {
|
||||||
return useProxyBox.isSelected();
|
return useProxyBox.isSelected();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the protocol to use for this proxy.
|
||||||
|
*
|
||||||
|
* @return the protocol.
|
||||||
|
*/
|
||||||
public String getProtocol() {
|
public String getProtocol() {
|
||||||
return (String)protocolBox.getSelectedItem();
|
return (String)protocolBox.getSelectedItem();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the host to use for this proxy.
|
||||||
|
*
|
||||||
|
* @return the host.
|
||||||
|
*/
|
||||||
public String getHost() {
|
public String getHost() {
|
||||||
return hostField.getText();
|
return hostField.getText();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the port to use with this proxy.
|
||||||
|
*
|
||||||
|
* @return the port to use.
|
||||||
|
*/
|
||||||
public String getPort() {
|
public String getPort() {
|
||||||
return portField.getText();
|
return portField.getText();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the username to use with this proxy.
|
||||||
|
*
|
||||||
|
* @return the username.
|
||||||
|
*/
|
||||||
public String getUsername() {
|
public String getUsername() {
|
||||||
return usernameField.getText();
|
return usernameField.getText();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the password to use with this proxy.
|
||||||
|
*
|
||||||
|
* @return the password.
|
||||||
|
*/
|
||||||
public String getPassword() {
|
public String getPassword() {
|
||||||
return new String(passwordField.getPassword());
|
return new String(passwordField.getPassword());
|
||||||
}
|
}
|
||||||
|
|
||||||
public void save() {
|
/**
|
||||||
|
* Persist the proxy settings to local preferences.
|
||||||
|
*/
|
||||||
|
public void saveProxySettings() {
|
||||||
localPreferences.setProxyEnabled(useProxyBox.isSelected());
|
localPreferences.setProxyEnabled(useProxyBox.isSelected());
|
||||||
if (ModelUtil.hasLength(getProtocol())) {
|
if (ModelUtil.hasLength(getProtocol())) {
|
||||||
localPreferences.setProtocol(getProtocol());
|
localPreferences.setProtocol(getProtocol());
|
||||||
@ -432,7 +474,9 @@ public class LoginSettingDialog implements PropertyChangeListener {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Updates local preferences with auto discovery settings.
|
||||||
|
*/
|
||||||
private void updateAutoDiscovery() {
|
private void updateAutoDiscovery() {
|
||||||
boolean isSelected = autoDiscoverBox.isSelected();
|
boolean isSelected = autoDiscoverBox.isSelected();
|
||||||
xmppHostField.setEnabled(!isSelected);
|
xmppHostField.setEnabled(!isSelected);
|
||||||
|
|||||||
@ -17,7 +17,6 @@ import org.jivesoftware.smack.XMPPConnection;
|
|||||||
import org.jivesoftware.smack.packet.Presence;
|
import org.jivesoftware.smack.packet.Presence;
|
||||||
import org.jivesoftware.smackx.debugger.EnhancedDebuggerWindow;
|
import org.jivesoftware.smackx.debugger.EnhancedDebuggerWindow;
|
||||||
import org.jivesoftware.spark.SparkManager;
|
import org.jivesoftware.spark.SparkManager;
|
||||||
import org.jivesoftware.spark.ui.ChatFrame;
|
|
||||||
import org.jivesoftware.spark.util.BrowserLauncher;
|
import org.jivesoftware.spark.util.BrowserLauncher;
|
||||||
import org.jivesoftware.spark.util.GraphicUtils;
|
import org.jivesoftware.spark.util.GraphicUtils;
|
||||||
import org.jivesoftware.spark.util.ResourceUtils;
|
import org.jivesoftware.spark.util.ResourceUtils;
|
||||||
@ -86,7 +85,7 @@ public final class MainWindow extends JFrame implements ActionListener {
|
|||||||
|
|
||||||
private static MainWindow singleton;
|
private static MainWindow singleton;
|
||||||
private static final Object LOCK = new Object();
|
private static final Object LOCK = new Object();
|
||||||
|
|
||||||
private JSplitPane splitPane = null;
|
private JSplitPane splitPane = null;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -119,7 +118,7 @@ public final class MainWindow extends JFrame implements ActionListener {
|
|||||||
*/
|
*/
|
||||||
private MainWindow(String title, ImageIcon icon) {
|
private MainWindow(String title, ImageIcon icon) {
|
||||||
|
|
||||||
// Initialize and dock the menus
|
// Initialize and dock the menus
|
||||||
buildMenu();
|
buildMenu();
|
||||||
|
|
||||||
// Add Workspace Container
|
// Add Workspace Container
|
||||||
@ -244,6 +243,9 @@ public final class MainWindow extends JFrame implements ActionListener {
|
|||||||
try {
|
try {
|
||||||
fireWindowShutdown();
|
fireWindowShutdown();
|
||||||
}
|
}
|
||||||
|
catch (Exception ex) {
|
||||||
|
Log.error(ex);
|
||||||
|
}
|
||||||
finally {
|
finally {
|
||||||
// Close application.
|
// Close application.
|
||||||
System.exit(1);
|
System.exit(1);
|
||||||
@ -253,6 +255,8 @@ public final class MainWindow extends JFrame implements ActionListener {
|
|||||||
/**
|
/**
|
||||||
* Prepares Spark for shutting down by first calling all {@link MainWindowListener}s and
|
* Prepares Spark for shutting down by first calling all {@link MainWindowListener}s and
|
||||||
* setting the Agent to be offline.
|
* setting the Agent to be offline.
|
||||||
|
*
|
||||||
|
* @param sendStatus true if Spark should send a presence with a status message.
|
||||||
*/
|
*/
|
||||||
public void logout(boolean sendStatus) {
|
public void logout(boolean sendStatus) {
|
||||||
final XMPPConnection con = SparkManager.getConnection();
|
final XMPPConnection con = SparkManager.getConnection();
|
||||||
@ -610,16 +614,16 @@ public final class MainWindow extends JFrame implements ActionListener {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isDocked() {
|
public boolean isDocked() {
|
||||||
LocalPreferences preferences = SettingsManager.getLocalPreferences();
|
LocalPreferences preferences = SettingsManager.getLocalPreferences();
|
||||||
return preferences.isDockingEnabled();
|
return preferences.isDockingEnabled();
|
||||||
}
|
}
|
||||||
|
|
||||||
public JSplitPane getSplitPane() {
|
public JSplitPane getSplitPane() {
|
||||||
// create the split pane only if required.
|
// create the split pane only if required.
|
||||||
if (splitPane == null){
|
if (splitPane == null) {
|
||||||
splitPane = new JSplitPane();
|
splitPane = new JSplitPane();
|
||||||
}
|
}
|
||||||
return this.splitPane;
|
return this.splitPane;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -22,6 +22,11 @@ import java.io.IOException;
|
|||||||
*/
|
*/
|
||||||
public class Restarter {
|
public class Restarter {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Is called on a restart of Spark. This is the format for restarting Spark in Log out.
|
||||||
|
*
|
||||||
|
* @param args the array of arguments.
|
||||||
|
*/
|
||||||
public static void main(String args[]) {
|
public static void main(String args[]) {
|
||||||
if (args.length == 0) {
|
if (args.length == 0) {
|
||||||
return;
|
return;
|
||||||
|
|||||||
@ -71,9 +71,8 @@ public class SparkStartupListener implements com.install4j.api.launcher.StartupN
|
|||||||
* Factory method to handle different types of URI Mappings.
|
* Factory method to handle different types of URI Mappings.
|
||||||
*
|
*
|
||||||
* @param uriMapping the uri mapping string.
|
* @param uriMapping the uri mapping string.
|
||||||
* @throws Exception thrown if an exception occurs.
|
|
||||||
*/
|
*/
|
||||||
public void handleJID(String uriMapping) throws Exception {
|
public void handleJID(String uriMapping) {
|
||||||
int index = uriMapping.indexOf("xmpp:");
|
int index = uriMapping.indexOf("xmpp:");
|
||||||
int messageIndex = uriMapping.indexOf("?message");
|
int messageIndex = uriMapping.indexOf("?message");
|
||||||
|
|
||||||
@ -113,7 +112,7 @@ public class SparkStartupListener implements com.install4j.api.launcher.StartupN
|
|||||||
* @param uriMapping the uri mapping.
|
* @param uriMapping the uri mapping.
|
||||||
* @throws Exception thrown if the conference cannot be joined.
|
* @throws Exception thrown if the conference cannot be joined.
|
||||||
*/
|
*/
|
||||||
public void handleConference(String uriMapping) throws Exception {
|
public void handleConference(String uriMapping) {
|
||||||
int index = uriMapping.indexOf("xmpp:");
|
int index = uriMapping.indexOf("xmpp:");
|
||||||
int join = uriMapping.indexOf("?join");
|
int join = uriMapping.indexOf("?join");
|
||||||
|
|
||||||
@ -121,8 +120,4 @@ public class SparkStartupListener implements com.install4j.api.launcher.StartupN
|
|||||||
ConferenceUtils.autoJoinConferenceRoom(conference, conference, null);
|
ConferenceUtils.autoJoinConferenceRoom(conference, conference, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void main(String args[]) {
|
|
||||||
SparkStartupListener l = new SparkStartupListener();
|
|
||||||
l.startupPerformed("xmpp:jorge@jivesoftware.com?message;body=hello%20there");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -32,6 +32,11 @@ public class Uninstaller extends UninstallAction {
|
|||||||
return super.performAction(context, progressInterface); //To change body of overridden methods use File | Settings | File Templates.
|
return super.performAction(context, progressInterface); //To change body of overridden methods use File | Settings | File Templates.
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Removes Spark from the start up registration in the registry.
|
||||||
|
*
|
||||||
|
* @param dir the directory where Spark resides.
|
||||||
|
*/
|
||||||
public void removeStartup(File dir) {
|
public void removeStartup(File dir) {
|
||||||
WinRegistry.deleteValue(WinRegistry.HKEY_CURRENT_USER, "Software\\Microsoft\\Windows\\CurrentVersion\\Run", "Spark");
|
WinRegistry.deleteValue(WinRegistry.HKEY_CURRENT_USER, "Software\\Microsoft\\Windows\\CurrentVersion\\Run", "Spark");
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user