Default identities can be set now in the preferences file for each store.
This commit is contained in:
Родитель
0d248c9512
Коммит
84bfaebbed
|
@ -32,6 +32,8 @@ import javax.swing.border.*;
|
|||
import calypso.util.Preferences;
|
||||
import calypso.util.PreferencesFactory;
|
||||
|
||||
import grendel.ui.ActionFactory;
|
||||
|
||||
public class OptionsPanel extends JPanel implements Serializable {
|
||||
// private final int BOX_WIDTH = 300;
|
||||
private final int BOX_WIDTH = 160;
|
||||
|
@ -96,10 +98,10 @@ public class OptionsPanel extends JPanel implements Serializable {
|
|||
Preferences prefs = PreferencesFactory.Get();
|
||||
int numIdentities = prefs.getInt("mail.identities", 1);
|
||||
for (int i=0; i<numIdentities; i++) {
|
||||
ident.addPossibleValue(prefs.getString("mail.identity-" + i + ".description", "(nobody)"));
|
||||
ident.addPossibleValue(prefs.getString("mail.identity-" + i + ".description", "(no description available)"));
|
||||
}
|
||||
// Select the first (default) identity (number 0)
|
||||
ident.setSelectedIndex(0);
|
||||
// Select the default identity
|
||||
ident.setSelectedIndex(ActionFactory.getIdent());
|
||||
|
||||
addToGridBag(new FixedSizedPanel (BOX_WIDTH, BOX_HEIGHT, ident), gridbag, c);
|
||||
|
||||
|
|
|
@ -20,6 +20,7 @@
|
|||
*
|
||||
* Contributors: Jeff Galyan <talisman@anamorphic.com>
|
||||
* Giao Nguyen <grail@cafebabe.org>
|
||||
* Edwin Woudt <edwin@woudt.nl>
|
||||
*/
|
||||
|
||||
package grendel.ui;
|
||||
|
@ -56,6 +57,10 @@ public class ActionFactory {
|
|||
static SearchAction fSearchAction = new SearchAction();
|
||||
static RunFiltersAction fRunFiltersAction = new RunFiltersAction();
|
||||
static ShowTooltipsAction fShowTooltipsAction = new ShowTooltipsAction();
|
||||
|
||||
static int fIdent = 0;
|
||||
|
||||
static Runnable fComposeMessageThread = new DummyComposeMessageThread();
|
||||
|
||||
static public ExitAction GetExitAction() {
|
||||
return fExitAction;
|
||||
|
@ -69,8 +74,18 @@ public class ActionFactory {
|
|||
return fComposeMessageAction;
|
||||
}
|
||||
|
||||
static public void SetComposeMessageAction(ComposeMessageAction aAction) {
|
||||
fComposeMessageAction = aAction;
|
||||
static public void SetComposeMessageThread(Runnable aThread) {
|
||||
fComposeMessageThread = aThread;
|
||||
}
|
||||
|
||||
static public void setIdent(int aIdent) {
|
||||
System.out.println("setIdent "+aIdent);
|
||||
fIdent = aIdent;
|
||||
}
|
||||
|
||||
static public int getIdent() {
|
||||
System.out.println("getIdent "+fIdent);
|
||||
return fIdent;
|
||||
}
|
||||
|
||||
static public PreferencesAction GetPreferencesAction() {
|
||||
|
@ -131,16 +146,14 @@ class ComposeMessageAction extends UIAction {
|
|||
}
|
||||
|
||||
public void actionPerformed(ActionEvent aEvent) {
|
||||
new Thread(new ComposeThread(), "Composition Starter").start();
|
||||
new Thread(ActionFactory.fComposeMessageThread, "Composition Starter").start();
|
||||
}
|
||||
|
||||
class ComposeThread implements Runnable {
|
||||
public void run() {
|
||||
Composition frame = new Composition();
|
||||
}
|
||||
|
||||
frame.show();
|
||||
frame.requestFocus();
|
||||
}
|
||||
class DummyComposeMessageThread implements Runnable {
|
||||
public void run() {
|
||||
System.out.println("This should not happen! DummyComposeMessageThread called.");
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -19,6 +19,7 @@
|
|||
* Created: Will Scullin <scullin@netscape.com>, 3 Sep 1997.
|
||||
*
|
||||
* Contributors: Jeff Galyan <talisman@anamorphic.com>
|
||||
* Edwin Woudt <edwin@woudt.nl>
|
||||
*/
|
||||
|
||||
package grendel.ui;
|
||||
|
@ -35,6 +36,8 @@ import java.awt.event.ActionEvent;
|
|||
import java.awt.event.KeyEvent;
|
||||
import java.awt.event.MouseEvent;
|
||||
import java.io.IOException;
|
||||
import java.net.InetAddress;
|
||||
import java.net.UnknownHostException;
|
||||
import java.text.MessageFormat;
|
||||
import java.util.Enumeration;
|
||||
import java.util.Hashtable;
|
||||
|
@ -72,6 +75,7 @@ import javax.mail.MessagingException;
|
|||
import javax.mail.Session;
|
||||
import javax.mail.Store;
|
||||
|
||||
import grendel.composition.Composition;
|
||||
import grendel.storage.FolderExtraFactory;
|
||||
import grendel.storage.SearchResultsFolderFactory;
|
||||
import grendel.ui.UIAction;
|
||||
|
@ -206,6 +210,8 @@ public class MasterPanel extends GeneralPanel {
|
|||
|
||||
fStoreChangeListener = new StoreChangeListener();
|
||||
StoreFactory.Instance().addChangeListener(fStoreChangeListener);
|
||||
|
||||
ActionFactory.SetComposeMessageThread(new ComposeMessageThread());
|
||||
}
|
||||
|
||||
public void dispose() {
|
||||
|
@ -373,6 +379,33 @@ public class MasterPanel extends GeneralPanel {
|
|||
}
|
||||
}
|
||||
|
||||
class ComposeMessageThread implements Runnable {
|
||||
public void run() {
|
||||
|
||||
int identity;
|
||||
try {
|
||||
Preferences prefs = PreferencesFactory.Get();
|
||||
InetAddress ia = InetAddress.getByName(getSelectedViewedFolder().getViewedStore().getHost());
|
||||
String fPrefBase = "mail." + getSelectedViewedFolder().getViewedStore().getProtocol()
|
||||
+ "-" + ia.getHostName();
|
||||
System.out.println("fPrefBase");
|
||||
identity = prefs.getInt(fPrefBase + ".default-identity", 0);
|
||||
} catch (NullPointerException npe) {
|
||||
identity = 0;
|
||||
} catch (UnknownHostException uhe) {
|
||||
uhe.printStackTrace();
|
||||
identity = 0;
|
||||
}
|
||||
|
||||
ActionFactory.setIdent(identity);
|
||||
|
||||
Composition frame = new Composition();
|
||||
|
||||
frame.show();
|
||||
frame.requestFocus();
|
||||
}
|
||||
}
|
||||
|
||||
class MPClipboardOwner implements ClipboardOwner {
|
||||
public void lostOwnership(Clipboard aClipboard,
|
||||
Transferable aTransferable) {
|
||||
|
|
Загрузка…
Ссылка в новой задаче