1 package SnowMailClient.view.actions; 2 3 import SnowMailClient.MailEngine.*; 4 import SnowMailClient.*; 5 import SnowMailClient.model.*; 6 import SnowMailClient.model.accounts.*; 7 import SnowMailClient.view.*; 8 import SnowMailClient.view.dialogs.*; 9 import SnowMailClient.Language.Language; 10 11 import java.awt.*; 12 import java.awt.event.*; 13 import javax.swing.*; 14 15 16 18 public class SetUserPass extends AbstractAction 19 { 20 MailAccount account; 21 JDialog ref; 22 23 public SetUserPass(JDialog ref, MailAccount account) 24 { 25 super(Language.translate("Set a user pasword")); 26 this.account = account; 27 this.ref= ref; 28 29 putValue(AbstractAction.SMALL_ICON, SnowMailClientApp.loadImageIcon("pics/key.PNG")); 30 33 } 34 35 public void actionPerformed(ActionEvent actionEvent) 36 { 37 44 45 AddNewUserDialog dialog = new AddNewUserDialog(ref, account.getPop()); 46 dialog.setTitle( 47 Language.translate("Set a % user password", account.getPop())); 48 dialog.pack(); 49 SnowMailClientApp.centerComponentOnMainFrame(dialog); 50 dialog.setVisible(true); 51 52 if(dialog.addNewUserOnExit) 53 { 54 try 55 { 56 SecurePopConnection sp = account.getCheckedPopConnection(); 57 sp.setUserPassword( dialog.getUserName(), dialog.getPassword() ); 58 sp.terminateSession(); 59 } 60 catch(Exception ex) 61 { 62 ex.printStackTrace(); 64 JOptionPane.showMessageDialog( 65 ref, "Error: \n"+ex.getMessage(), 66 "Failed to add new user", 67 JOptionPane.ERROR_MESSAGE); 68 } 69 } 70 71 } 72 73 } | Popular Tags |