Commits Dmitri Melnikov's dialogs.patch provided in the dev mailing list thread "Password Storage in trunk".

cusax-fix
Lyubomir Marinov 16 years ago
parent 7a707b25e5
commit 4f6aaa3ee7

@ -21,7 +21,8 @@
*/
public class MasterPasswordInputDialog
extends SIPCommDialog
implements ActionListener
implements ActionListener,
KeyListener
{
/**
* Instance of this class.
@ -106,6 +107,7 @@ private void initComponents()
// password fields
currentPasswdField = new JPasswordField(15);
currentPasswdField.addKeyListener(this);
currentPasswdField.addActionListener(new ActionListener()
{
public void actionPerformed(ActionEvent arg0)
@ -118,13 +120,12 @@ public void actionPerformed(ActionEvent arg0)
// OK and cancel buttons
okButton = new JButton(resources.getI18NString("service.gui.OK"));
okButton.setMnemonic(GuiActivator.getResources().getI18nMnemonic(
"service.gui.OK"));
okButton.setMnemonic(resources.getI18nMnemonic("service.gui.OK"));
okButton.addActionListener(this);
cancelButton =
new JButton(resources.getI18NString("service.gui.CANCEL"));
cancelButton.setMnemonic(GuiActivator.getResources().getI18nMnemonic(
cancelButton.setMnemonic(resources.getI18nMnemonic(
"service.gui.CANCEL"));
cancelButton.addActionListener(this);
@ -206,12 +207,47 @@ protected void close(boolean escaped)
/**
* Resets the password by clearing the input field and setting
* <tt>password</tt> to <tt>null</tt>.
* <tt>password</tt> to <tt>null</tt>. Disables the OK button.
*/
private void resetPassword()
{
password = null;
currentPasswdField.setText("");
currentPasswdField.requestFocusInWindow();
okButton.setEnabled(false);
}
/**
* Disables OK button if the password input field is empty.
*
* @param event key event
*/
public void keyReleased(KeyEvent event)
{
JPasswordField source = (JPasswordField) event.getSource();
if (currentPasswdField.equals(source))
{
String password = new String(currentPasswdField.getPassword());
okButton.setEnabled(password.length() > 0);
password = null;
}
}
/**
* Not overriding.
*
* @param arg0 key event
*/
public void keyPressed(KeyEvent arg0)
{
}
/**
* Not overriding.
*
* @param arg0 key event
*/
public void keyTyped(KeyEvent arg0)
{
}
}

@ -192,10 +192,13 @@ public void actionPerformed(ActionEvent e)
// OK and cancel buttons
okButton = new JButton(resources.getI18NString("service.gui.OK"));
okButton.setMnemonic(resources.getI18nMnemonic("service.gui.OK"));
okButton.addActionListener(this);
okButton.setEnabled(false);
cancelButton
= new JButton(resources.getI18NString("service.gui.CANCEL"));
cancelButton.setMnemonic(resources.getI18nMnemonic(
"service.gui.CANCEL"));
cancelButton.addActionListener(this);
passwordQualityBar =

Loading…
Cancel
Save