Signature storage into prefs.
This commit is contained in:
Родитель
d8d99d6ea2
Коммит
eee2c5da92
|
@ -39,6 +39,7 @@ public class Prefs {
|
|||
static final String kUserName = "mail.identity-0.username";
|
||||
static final String kOrganization = "mail.identity-0.organization";
|
||||
static final String kEmailAddress = "mail.identity-0.email";
|
||||
static final String kSignatureFile = "mail.identity-0.signature";
|
||||
//static final String kPopHost = "pop.host";
|
||||
//static final String kPopUser = "pop.user";
|
||||
//static final String kPopPassword = "pop.password";
|
||||
|
@ -62,6 +63,7 @@ public class Prefs {
|
|||
fPrefs.putString(kUserName, aPrefs.getUserName());
|
||||
fPrefs.putString(kEmailAddress, aPrefs.getUserEmailAddress());
|
||||
fPrefs.putString(kOrganization, aPrefs.getUserOrganization());
|
||||
fPrefs.putString(kSignatureFile, aPrefs.getSignatureFile());
|
||||
}
|
||||
|
||||
public MailServerPrefs getMailServerPrefs() {
|
||||
|
|
|
@ -25,6 +25,7 @@ public class UserPrefs {
|
|||
String fUserName;
|
||||
String fUserEmailAddress;
|
||||
String fUserOrganization;
|
||||
String fSignatureFile;
|
||||
|
||||
public String getUserName() {
|
||||
return fUserName;
|
||||
|
@ -50,12 +51,21 @@ public class UserPrefs {
|
|||
fUserOrganization = aOrganization;
|
||||
}
|
||||
|
||||
public String getSignatureFile() {
|
||||
return fSignatureFile;
|
||||
}
|
||||
|
||||
public void setSignatureFile(String file) {
|
||||
fSignatureFile = file;
|
||||
}
|
||||
|
||||
public boolean equals(Object aObject) {
|
||||
if (aObject instanceof UserPrefs) {
|
||||
UserPrefs prefs = (UserPrefs) aObject;
|
||||
return prefs.fUserName.equals(fUserName) &&
|
||||
prefs.fUserEmailAddress.equals(fUserEmailAddress) &&
|
||||
prefs.fUserOrganization.equals(fUserOrganization);
|
||||
prefs.fUserOrganization.equals(fUserOrganization) &&
|
||||
prefs.fSignatureFile.equals(fSignatureFile);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -21,6 +21,8 @@
|
|||
|
||||
package grendel.prefs;
|
||||
|
||||
import java.io.File;
|
||||
|
||||
import java.awt.Component;
|
||||
import java.awt.Graphics;
|
||||
import java.awt.Rectangle;
|
||||
|
@ -47,6 +49,8 @@ import java.util.ResourceBundle;
|
|||
import javax.swing.JComponent;
|
||||
import javax.swing.JPanel;
|
||||
import javax.swing.JTextField;
|
||||
import javax.swing.JFileChooser;
|
||||
import javax.swing.text.JTextComponent;
|
||||
|
||||
import grendel.ui.XMLPageBuilder;
|
||||
import grendel.ui.PageModel;
|
||||
|
@ -63,6 +67,8 @@ public class UserPrefsEditor
|
|||
static final String kNameKey="userNameField";
|
||||
static final String kOrganizationKey="userOrganizationField";
|
||||
static final String kEmailAddressKey="userEmailAddressField";
|
||||
static final String kSignatureKey = "signatureField";
|
||||
static final String kChooseKey = "signatureButton";
|
||||
|
||||
Hashtable fValues = null;
|
||||
|
||||
|
@ -76,10 +82,26 @@ public class UserPrefsEditor
|
|||
fValues.put(kNameKey, "");
|
||||
fValues.put(kOrganizationKey, "");
|
||||
fValues.put(kEmailAddressKey, "");
|
||||
fValues.put(kSignatureKey, "");
|
||||
setStore(fValues);
|
||||
}
|
||||
|
||||
// this is where you handle the magic of buttons in this page
|
||||
public void actionPerformed(ActionEvent aEvent) {
|
||||
String action = aEvent.getActionCommand();
|
||||
|
||||
if (action.equals(kChooseKey)) {
|
||||
JFileChooser chooser = new JFileChooser();
|
||||
File selected;
|
||||
String path;
|
||||
chooser.showDialog(fPanel, "Okay");
|
||||
selected = chooser.getSelectedFile();
|
||||
path = selected.getAbsolutePath();
|
||||
((JTextComponent)
|
||||
fPanel.getCtrlByName(kSignatureKey)).setText(path);
|
||||
fPrefs.setSignatureFile(path);
|
||||
fListeners.firePropertyChange(null, null, fPrefs);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -102,6 +124,9 @@ public class UserPrefsEditor
|
|||
|
||||
c = fPanel.getCtrlByName(kEmailAddressKey);
|
||||
c.addPropertyChangeListener(ca);
|
||||
|
||||
c = fPanel.getCtrlByName(kSignatureKey);
|
||||
c.addPropertyChangeListener(ca);
|
||||
}
|
||||
|
||||
public String getAsText() {
|
||||
|
@ -126,10 +151,12 @@ public class UserPrefsEditor
|
|||
String name = (String) fValues.get(kNameKey);
|
||||
String org = (String) fValues.get(kOrganizationKey);
|
||||
String email = (String) fValues.get(kEmailAddressKey);
|
||||
String sig = (String)fValues.get(kSignatureKey);
|
||||
|
||||
fPrefs.setUserName(name);
|
||||
fPrefs.setUserOrganization(org);
|
||||
fPrefs.setUserEmailAddress(email);
|
||||
fPrefs.setSignatureFile(sig);
|
||||
|
||||
return fPrefs;
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче