Changeset 701 for trunk/LogicMail/src/org/logicprobe
- Timestamp:
- 09/06/10 13:19:28 (17 months ago)
- Location:
- trunk/LogicMail/src/org/logicprobe/LogicMail
- Files:
-
- 2 added
- 21 edited
-
model/AccountNode.java (modified) (18 diffs)
-
model/LocalAccountNode.java (added)
-
model/MailFileManager.java (modified) (1 diff)
-
model/MailManager.java (modified) (7 diffs)
-
model/MailRootNode.java (modified) (6 diffs)
-
model/MailboxNode.java (modified) (2 diffs)
-
model/MessageNode.java (modified) (2 diffs)
-
model/MessageNodeReader.java (modified) (1 diff)
-
model/MessageNodeWriter.java (modified) (2 diffs)
-
model/NetworkAccountNode.java (added)
-
model/OutboxMailboxNode.java (modified) (1 diff)
-
ui/AccountConfigScreen.java (modified) (2 diffs)
-
ui/AccountConfigWizard.java (modified) (2 diffs)
-
ui/CompositionScreen.java (modified) (6 diffs)
-
ui/MailHomeScreen.java (modified) (8 diffs)
-
ui/MailboxScreen.java (modified) (3 diffs)
-
ui/MessageActions.java (modified) (9 diffs)
-
ui/MessageScreen.java (modified) (4 diffs)
-
ui/NavigationController.java (modified) (6 diffs)
-
ui/NotificationHandler.java (modified) (5 diffs)
-
ui/ScreenFactory.java (modified) (2 diffs)
-
ui/ScreenFactoryBB42.java (modified) (4 diffs)
-
ui/StandardScreen.java (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/LogicMail/src/org/logicprobe/LogicMail/model/AccountNode.java
r693 r701 31 31 package org.logicprobe.LogicMail.model; 32 32 33 import org.logicprobe.LogicMail.conf.AccountConfig;34 import org.logicprobe.LogicMail.mail.AbstractMailSender;35 33 import org.logicprobe.LogicMail.mail.AbstractMailStore; 36 34 import org.logicprobe.LogicMail.mail.FolderEvent; … … 42 40 import org.logicprobe.LogicMail.mail.MessageListener; 43 41 import org.logicprobe.LogicMail.mail.MessageToken; 44 import org.logicprobe.LogicMail.mail.NetworkMailStore;45 42 import org.logicprobe.LogicMail.message.FolderMessage; 46 import org.logicprobe.LogicMail.message.Message;47 import org.logicprobe.LogicMail.message.MessageEnvelope;48 import org.logicprobe.LogicMail.util.DataStore;49 import org.logicprobe.LogicMail.util.DataStoreFactory;50 43 import org.logicprobe.LogicMail.util.EventListenerList; 51 44 … … 62 55 * be implemented. 63 56 */ 64 public class AccountNode implements Node {57 public abstract class AccountNode implements Node { 65 58 public final static int STATUS_LOCAL = 0; 66 59 public final static int STATUS_OFFLINE = 1; 67 60 public final static int STATUS_ONLINE = 2; 68 61 private AbstractMailStore mailStore; 69 private boolean usePersistedState;70 private AbstractMailSender mailSender;71 62 private MailRootNode parent; 72 63 private MailboxNode rootMailbox; … … 74 65 private Object rootMailboxLock = new Object(); 75 66 private EventListenerList listenerList = new EventListenerList(); 76 private AccountConfig accountConfig;77 private int status;78 private boolean shutdown = false;79 67 80 /** Map of folders to message to fetch for them. */ 68 protected int status; 69 70 /** Map of folders to messages to fetch for them. */ 81 71 private Hashtable folderMessagesToFetch; 82 72 … … 85 75 * 86 76 * @param accountConfig Account configuration. 87 * @param loadState True to load the stored account state, false to construct fresh 88 */ 89 AccountNode(AbstractMailStore mailStore) { 90 this(mailStore, true); 91 } 92 93 /** 94 * Construct a new node for a network account. 95 * 96 * @param accountConfig Account configuration. 97 * @param usePersistedState True to use persisted account state, false otherwise 98 */ 99 AccountNode(AbstractMailStore mailStore, boolean usePersistedState) { 77 */ 78 protected AccountNode(AbstractMailStore mailStore) { 100 79 this.rootMailbox = null; 101 80 this.pathMailboxMap = new Hashtable(); … … 103 82 104 83 this.mailStore = mailStore; 105 this.usePersistedState = usePersistedState; 106 107 if (!mailStore.isLocal() && mailStore instanceof NetworkMailStore) { 108 this.accountConfig = ((NetworkMailStore) mailStore).getAccountConfig(); 109 this.status = STATUS_OFFLINE; 110 } else { 111 this.status = STATUS_LOCAL; 112 } 113 84 85 addMailStoreListeners(); 86 } 87 88 private void addMailStoreListeners() { 114 89 this.mailStore.addMailStoreListener(new MailStoreListener() { 115 90 public void folderTreeUpdated(FolderEvent e) { … … 149 124 } 150 125 }); 151 152 if (!mailStore.hasFolders()) {153 // Create the fake INBOX node for non-folder-capable mail stores154 this.rootMailbox = new MailboxNode(new FolderTreeItem("", "", ""),155 false,156 -1);157 this.rootMailbox.setParentAccount(this);158 159 MailboxNode inboxNode = new MailboxNode(new FolderTreeItem(160 "INBOX", "INBOX", "", true), false, MailboxNode.TYPE_INBOX);161 inboxNode.setParentAccount(this);162 this.rootMailbox.addMailbox(inboxNode);163 pathMailboxMap.put("INBOX", inboxNode);164 }165 166 // Load any saved tree data167 if(usePersistedState) { load(); }168 126 } 169 127 … … 172 130 } 173 131 174 /**175 * Gets the mail sender associated with this account.176 *177 * @return The mail sender.178 */179 AbstractMailSender getMailSender() {180 return this.mailSender;181 }182 183 /**184 * Sets the mail sender associated with this account.185 * This is not set in the constructor since it can change186 * whenever account configuration changes.187 *188 * @param mailSender The mail sender.189 */190 void setMailSender(AbstractMailSender mailSender) {191 if ((this.mailSender != null) && (mailSender == null)) {192 this.mailSender = null;193 } else if ((this.mailSender != null) &&194 (this.mailSender != mailSender)) {195 this.mailSender = mailSender;196 } else if ((this.mailSender == null) && (mailSender != null)) {197 this.mailSender = mailSender;198 }199 }200 201 /**202 * Returns whether this account has a mail sender associated with it.203 *204 * @return True if mail can be sent, false otherwise.205 */206 public boolean hasMailSender() {207 return (this.mailSender != null);208 }209 210 /**211 * Returns whether this account has an identity associated with it.212 *213 * @return True if an identity is configured, false otherwise.214 */215 public boolean hasIdentity() {216 return this.accountConfig.getIdentityConfig() != null;217 }218 219 132 /** 220 133 * Sets the root node which is the parent of this account. … … 250 163 251 164 /** 252 * Gets the name of this account.253 *254 * @return The name.255 */256 public String toString() {257 if (accountConfig != null) {258 return this.accountConfig.toString();259 } else {260 return "Local Folders";261 }262 }263 264 /**265 * Gets the account configuration.266 *267 * @return The account configuration, or null for local accounts.268 */269 public AccountConfig getAccountConfig() {270 return this.accountConfig;271 }272 273 /**274 165 * Gets the mail store associated with this account. 275 166 * … … 289 180 this.status = status; 290 181 291 if ((this.status == STATUS_OFFLINE) && !shutdown &&292 mailStore instanceof NetworkMailStore) {293 ((NetworkMailStore) mailStore).restart();294 }295 296 182 fireAccountStatusChanged(AccountNodeEvent.TYPE_CONNECTION); 297 183 } … … 305 191 public int getStatus() { 306 192 return this.status; 307 }308 309 /**310 * Requests that this account be disconnected.311 * <p>312 * This method is only valid for the <tt>STATUS_ONLINE<tt>313 * status, and will do nothing in any other state.314 * </p>315 *316 * @param shutdown True if the application is closing, false if the mail store should be usable again.317 */318 public void requestDisconnect(boolean shutdown) {319 if ((status == STATUS_ONLINE) && mailStore instanceof NetworkMailStore) {320 ((NetworkMailStore) mailStore).shutdown(false);321 this.shutdown = shutdown;322 }323 193 } 324 194 … … 380 250 381 251 mailStore.requestFolderStatus(folders); 382 }383 384 /**385 * Sends a message from this account.386 *387 * @param envelope Envelope of the message to send388 * @param message Message to send.389 */390 public void sendMessage(MessageEnvelope envelope, Message message) {391 if (mailSender != null) {392 // Construct an outgoing message node393 FolderMessage outgoingFolderMessage = new FolderMessage(null, envelope, -1, -1);394 outgoingFolderMessage.setSeen(false);395 outgoingFolderMessage.setRecent(true);396 OutgoingMessageNode outgoingMessage =397 new OutgoingMessageNode(398 outgoingFolderMessage,399 this, mailSender);400 401 outgoingMessage.setMessageStructure(message.getStructure());402 outgoingMessage.putMessageContent(message.getAllContent());403 MailManager.getInstance().getOutboxMailboxNode().addMessage(outgoingMessage);404 }405 }406 407 /**408 * Sends a reply message from this account.409 *410 * @param envelope Envelope of the message to send411 * @param message Message to send.412 * @param originalMessageNode Message node this was in reply to.413 */414 public void sendMessageReply(MessageEnvelope envelope, Message message,415 MessageNode originalMessageNode) {416 sendMessageReplyImpl(envelope, message, originalMessageNode,417 OutgoingMessageNode.REPLY_ANSWERED);418 }419 420 /**421 * Sends a forwarded message from this account.422 *423 * @param envelope Envelope of the message to send424 * @param message Message to send.425 * @param originalMessageNode Message node this was in reply to.426 */427 public void sendMessageForwarded(MessageEnvelope envelope, Message message,428 MessageNode originalMessageNode) {429 sendMessageReplyImpl(envelope, message, originalMessageNode,430 OutgoingMessageNode.REPLY_FORWARDED);431 }432 433 private void sendMessageReplyImpl(MessageEnvelope envelope, Message message,434 MessageNode originalMessageNode, int replyType) {435 if (mailSender != null) {436 // Construct an outgoing message node437 FolderMessage outgoingFolderMessage = new FolderMessage(null, envelope, -1, -1);438 outgoingFolderMessage.setSeen(false);439 outgoingFolderMessage.setRecent(true);440 OutgoingMessageNode outgoingMessage =441 new OutgoingMessageNode(442 outgoingFolderMessage,443 this, mailSender, originalMessageNode, replyType);444 outgoingMessage.setMessageStructure(message.getStructure());445 outgoingMessage.putMessageContent(message.getAllContent());446 MailManager.getInstance().getOutboxMailboxNode().addMessage(outgoingMessage);447 }448 252 } 449 253 … … 477 281 478 282 if (folderPathMap.containsKey(path)) { 479 mailboxNode.setFolderTreeItem((FolderTreeItem) folderPathMap.get( 480 path)); 283 mailboxNode.setFolderTreeItem((FolderTreeItem) folderPathMap.get(path)); 481 284 remainingMailboxMap.put(path, mailboxNode); 482 285 } … … 491 294 } 492 295 493 if(usePersistedState) { save(); }296 save(); 494 297 fireAccountStatusChanged(AccountNodeEvent.TYPE_MAILBOX_TREE); 495 298 } … … 578 381 mailboxFolder.setUnseenCount(currentFolder.getUnseenCount()); 579 382 mailboxNode.updateUnseenFolderTreeItem(); 580 mailboxNode.fireMailboxStatusChanged(MailboxNodeEvent.TYPE_STATUS, 581 null); 383 mailboxNode.fireMailboxStatusChanged(MailboxNodeEvent.TYPE_STATUS, null); 582 384 } 583 385 … … 779 581 * @return Mailbox type 780 582 */ 781 pr ivateint getMailboxType(FolderTreeItem folderTreeItem) {782 int mailboxType = MailboxNode.TYPE_NORMAL;583 protected int getMailboxType(FolderTreeItem folderTreeItem) { 584 int mailboxType; 783 585 if (folderTreeItem.getPath().equalsIgnoreCase("INBOX")) { 784 586 mailboxType = MailboxNode.TYPE_INBOX; 785 587 } 786 else if(status == STATUS_LOCAL) { 787 String path = folderTreeItem.getPath(); 788 if (path.equalsIgnoreCase("Outbox")) { 789 mailboxType = MailboxNode.TYPE_OUTBOX; 790 } 791 else if (path.equalsIgnoreCase("Drafts")) { 792 mailboxType = MailboxNode.TYPE_DRAFTS; 793 } 794 else if (path.equalsIgnoreCase("Sent")) { 795 mailboxType = MailboxNode.TYPE_SENT; 796 } 797 else if (path.equalsIgnoreCase("Trash")) { 798 mailboxType = MailboxNode.TYPE_TRASH; 799 } 588 else { 589 mailboxType = MailboxNode.TYPE_NORMAL; 800 590 } 801 591 return mailboxType; … … 853 643 * Saves the mailbox tree to persistent storage. 854 644 */ 855 private void save() { 856 DataStore connectionCache = DataStoreFactory.getConnectionCacheStore(); 857 858 if(mailStore.isLocal()) { 859 connectionCache.putNamedObject("LocalMailStore", rootMailbox); 860 } 861 else { 862 connectionCache.putNamedObject(Long.toString(accountConfig.getUniqueId()), rootMailbox); 863 } 864 connectionCache.save(); 865 } 645 abstract void save(); 866 646 867 647 /** 868 648 * Loads the mailbox tree from persistent storage. 869 649 */ 870 private void load() { 871 DataStore connectionCache = DataStoreFactory.getConnectionCacheStore(); 872 873 Object loadedObject; 874 if(mailStore.isLocal()) { 875 loadedObject = connectionCache.getNamedObject("LocalMailStore"); 876 877 } 878 else { 879 loadedObject = connectionCache.getNamedObject(Long.toString(accountConfig.getUniqueId())); 880 } 881 882 if (loadedObject instanceof MailboxNode) { 883 synchronized (rootMailboxLock) { 884 this.rootMailbox = (MailboxNode) loadedObject; 885 this.rootMailbox.setParentAccount(this); 886 prepareDeserializedMailboxNode(rootMailbox); 887 } 888 } 889 } 650 abstract void load(); 890 651 891 652 /** … … 898 659 * </p> 899 660 */ 900 public void removeSavedData() { 901 if (!mailStore.isLocal()) { 902 DataStore connectionCache = DataStoreFactory.getConnectionCacheStore(); 903 connectionCache.removeNamedObject(Long.toString(accountConfig.getUniqueId())); 904 905 // This will only exist on certain account types, but this is the 906 // easiest place from which to clean it up. 907 connectionCache.removeNamedObject(Long.toString(accountConfig.getUniqueId()) + "_INBOX"); 908 909 connectionCache.save(); 910 } 911 } 912 661 protected void removeSavedData() { 662 // Default empty implementation 663 } 664 665 /** 666 * Sets the top-level mailbox contained within this account. 667 * This method should only be called by subclasses when loading saved 668 * account data. 669 */ 670 protected void setRootMailbox(MailboxNode mailboxNode) { 671 synchronized (rootMailboxLock) { 672 this.rootMailbox = mailboxNode; 673 prepareDeserializedMailboxNode(rootMailbox); 674 } 675 } 676 913 677 /** 914 678 * Traverses the deserialized mailbox nodes, populates any necessary -
trunk/LogicMail/src/org/logicprobe/LogicMail/model/MailFileManager.java
r697 r701 333 333 else { 334 334 accountUid = StringParser.toHexString( 335 mailboxNode.getParentAccount().getAccountConfig().getUniqueId()).toLowerCase();335 ((NetworkAccountNode)mailboxNode.getParentAccount()).getAccountConfig().getUniqueId()).toLowerCase(); 336 336 mailboxUid = StringParser.toHexString( 337 337 mailboxNode.getUniqueId()).toLowerCase(); -
trunk/LogicMail/src/org/logicprobe/LogicMail/model/MailManager.java
r628 r701 46 46 import org.logicprobe.LogicMail.mail.MailFactory; 47 47 import org.logicprobe.LogicMail.mail.NetworkMailSender; 48 import org.logicprobe.LogicMail.mail.NetworkMailStore; 48 49 import org.logicprobe.LogicMail.util.EventListenerList; 49 50 … … 125 126 }); 126 127 127 // Refresh data from local account nodes 128 AccountNode[] accounts = mailRootNode.getAccounts(); 129 for(int i=0; i<accounts.length; i++) { 130 if(accounts[i].getStatus() == AccountNode.STATUS_LOCAL) { 131 accounts[i].refreshMailboxes(); 132 accounts[i].refreshMailboxStatus(); 133 } 134 } 128 // Refresh data from local account node 129 LocalAccountNode localAccount = mailRootNode.getLocalAccount(); 130 localAccount.refreshMailboxes(); 131 localAccount.refreshMailboxStatus(); 135 132 136 133 MailboxNode[] localMailboxes = mailRootNode.getLocalAccount().getRootMailbox().getMailboxes(); … … 208 205 // if an account already exists, and only creating new nodes 209 206 // for new accounts. 210 AccountNode[] existingAccounts = mailRootNode.getAccounts();207 NetworkAccountNode[] existingAccounts = mailRootNode.getNetworkAccounts(); 211 208 Vector newAccounts = new Vector(); 212 213 // Prepopulate the new account list with the local accounts214 for(int i=0; i < existingAccounts.length; i++) {215 if(existingAccounts[i].getStatus() == AccountNode.STATUS_LOCAL) {216 newAccounts.addElement(existingAccounts[i]);217 }218 }219 209 220 210 int num = mailSettings.getNumAccounts(); … … 231 221 } 232 222 if(!accountExists) { 233 AccountNode newAccountNode = new AccountNode(MailFactory.createMailStore(accountConfig)); 223 AccountNode newAccountNode = new NetworkAccountNode((NetworkMailStore) MailFactory.createMailStore(accountConfig)); 224 newAccountNode.load(); 234 225 newAccounts.addElement(newAccountNode); 235 226 } … … 244 235 num = newAccounts.size(); 245 236 for(int i=0; i<num; i++) { 246 mailRootNode.addAccount(( AccountNode)newAccounts.elementAt(i));237 mailRootNode.addAccount((NetworkAccountNode)newAccounts.elementAt(i)); 247 238 } 248 239 … … 266 257 // Get the newly updated account list, and determine whether 267 258 // we need to update any mail senders. 268 existingAccounts = mailRootNode.get Accounts();259 existingAccounts = mailRootNode.getNetworkAccounts(); 269 260 for(int i=0; i<existingAccounts.length; i++) { 270 if(existingAccounts[i].getStatus() != AccountNode.STATUS_LOCAL) { 271 AbstractMailSender mailSender = existingAccounts[i].getMailSender(); 272 OutgoingConfig outgoingConfig = existingAccounts[i].getAccountConfig().getOutgoingConfig(); 273 if(outgoingConfig == null) { 274 if(mailSender != null) { 275 mailSender.shutdown(false); 276 } 277 existingAccounts[i].setMailSender(null); 261 NetworkAccountNode networkAccount = existingAccounts[i]; 262 AbstractMailSender mailSender = networkAccount.getMailSender(); 263 OutgoingConfig outgoingConfig = networkAccount.getAccountConfig().getOutgoingConfig(); 264 if(outgoingConfig == null) { 265 if(mailSender != null) { 266 mailSender.shutdown(false); 278 267 } 279 else if((mailSender instanceof NetworkMailSender 280 &&((NetworkMailSender)mailSender).getOutgoingConfig() != outgoingConfig)) { 281 mailSender.shutdown(false); 282 existingAccounts[i].setMailSender(MailFactory.createMailSender(existingAccounts[i].getAccountConfig().getOutgoingConfig())); 283 } 284 else if(mailSender == null) { 285 existingAccounts[i].setMailSender(MailFactory.createMailSender(existingAccounts[i].getAccountConfig().getOutgoingConfig())); 286 } 268 networkAccount.setMailSender(null); 269 } 270 else if((mailSender instanceof NetworkMailSender 271 &&((NetworkMailSender)mailSender).getOutgoingConfig() != outgoingConfig)) { 272 mailSender.shutdown(false); 273 networkAccount.setMailSender(MailFactory.createMailSender(networkAccount.getAccountConfig().getOutgoingConfig())); 274 } 275 else if(mailSender == null) { 276 networkAccount.setMailSender(MailFactory.createMailSender(networkAccount.getAccountConfig().getOutgoingConfig())); 287 277 } 288 278 } … … 302 292 private void mailConnectionManager_MailConnectionStateChanged(MailConnectionStateEvent e) { 303 293 // Find the account node associated with this event 304 AccountNode[] accounts = mailRootNode.getAccounts(); 305 AccountNode matchingAccount = null; 306 for(int i=0; i<accounts.length; i++) { 307 if(e.getConnectionConfig().equals(accounts[i].getAccountConfig())) { 308 matchingAccount = accounts[i]; 309 break; 310 } 311 } 294 AccountNode matchingAccount = mailRootNode.findAccountForConfig( 295 (AccountConfig)e.getConnectionConfig()); 312 296 313 297 // Update account state -
trunk/LogicMail/src/org/logicprobe/LogicMail/model/MailRootNode.java
r374 r701 33 33 import java.util.Vector; 34 34 35 import org.logicprobe.LogicMail.conf.AccountConfig; 36 import org.logicprobe.LogicMail.mail.LocalMailStore; 35 37 import org.logicprobe.LogicMail.mail.MailFactory; 36 38 … … 41 43 */ 42 44 public class MailRootNode implements Node { 43 private Vector accounts; 45 private LocalAccountNode localAccountNode; 46 private final Vector networkAccounts; 44 47 private AccountNode[] accountsArray; 45 private AccountNode localAccountNode; 48 private NetworkAccountNode[] networkAccountsArray; 49 private final Object accountsLock = new Object(); 46 50 47 51 public MailRootNode() { 48 this. accounts = new Vector();52 this.networkAccounts = new Vector(); 49 53 50 // Add the local mail store 51 localAccountNode = new AccountNode(MailFactory.createLocalMailStore());52 accounts.addElement(localAccountNode);54 // Add the local mail store account 55 localAccountNode = new LocalAccountNode((LocalMailStore) MailFactory.createLocalMailStore()); 56 localAccountNode.load(); 53 57 } 54 58 … … 70 74 // temporary snapshot array is kept. It is only recreated if the 71 75 // accounts vector is modified. 72 synchronized(accounts ) {76 synchronized(accountsLock) { 73 77 if(accountsArray == null) { 74 int size = accounts.size(); 75 accountsArray = new AccountNode[size]; 78 int size = networkAccounts.size(); 79 accountsArray = new AccountNode[size + 1]; 80 accountsArray[0] = localAccountNode; 76 81 for(int i=0; i<size; i++) { 77 accountsArray[i ] = (AccountNode)accounts.elementAt(i);82 accountsArray[i + 1] = (AccountNode)networkAccounts.elementAt(i); 78 83 } 79 84 } 80 85 } 81 86 return accountsArray; 87 } 88 89 /** 90 * Get the network accounts contained within the mail data model. 91 * This method returns an array that is a shallow copy of the 92 * live accounts list. Since multiple calls to this method 93 * may return the same instance of that array, it should 94 * not be modified by callers. 95 * 96 * @return Network account nodes. 97 */ 98 public NetworkAccountNode[] getNetworkAccounts() { 99 // Since this method is used quite frequently, a reference to the 100 // temporary snapshot array is kept. It is only recreated if the 101 // accounts vector is modified. 102 synchronized(accountsLock) { 103 if(networkAccountsArray == null) { 104 int size = networkAccounts.size(); 105 networkAccountsArray = new NetworkAccountNode[size]; 106 networkAccounts.copyInto(networkAccountsArray); 107 } 108 } 109 return networkAccountsArray; 110 } 111 112 /** 113 * Find the account node matching the provided account configuration. 114 * This is a convenience method for a relatively common operation. 115 * 116 * @param accountConfig the account configuration 117 * @return the network account node, or null if none found 118 */ 119 public NetworkAccountNode findAccountForConfig(AccountConfig accountConfig) { 120 NetworkAccountNode[] networkAccounts = getNetworkAccounts(); 121 for(int i=0; i<networkAccounts.length; i++) { 122 if(accountConfig.equals(networkAccounts[i].getAccountConfig())) { 123 return networkAccounts[i]; 124 } 125 } 126 return null; 82 127 } 83 128 … … 87 132 * @return Local account node. 88 133 */ 89 public AccountNode getLocalAccount() {134 public LocalAccountNode getLocalAccount() { 90 135 return localAccountNode; 91 136 } 92 137 93 138 /** 94 * Adds a naccount to the mail data model.139 * Adds a network account to the mail data model. 95 140 * The account is appended to the end of the 96 141 * live accounts list. … … 98 143 * @param account The account to add. 99 144 */ 100 void addAccount( AccountNode account) {101 synchronized(accounts ) {102 if(! accounts.contains(account)) {103 accounts.addElement(account);145 void addAccount(NetworkAccountNode account) { 146 synchronized(accountsLock) { 147 if(!networkAccounts.contains(account)) { 148 networkAccounts.addElement(account); 104 149 accountsArray = null; 150 networkAccountsArray = null; 105 151 } 106 152 } … … 108 154 109 155 /** 110 * Removes a n account from the mail data mode.156 * Removes a network account from the mail data model. 111 157 * 112 158 * @param account The account to remove 113 159 */ 114 void removeAccount( AccountNode account) {115 synchronized(accounts ) {116 if( accounts.contains(account)) {117 accounts.removeElement(account);160 void removeAccount(NetworkAccountNode account) { 161 synchronized(accountsLock) { 162 if(networkAccounts.contains(account)) { 163 networkAccounts.removeElement(account); 118 164 accountsArray = null; 165 networkAccountsArray = null; 119 166 } 120 167 } -
trunk/LogicMail/src/org/logicprobe/LogicMail/model/MailboxNode.java
r697 r701 222 222 // will not be serialized, yet it still needs a way to be matched up 223 223 // with a local cache folder. 224 if(this.type == TYPE_INBOX && !this.parentAccount.hasFolders() && this.parentAccount .getAccountConfig() != null) {225 this.uniqueId = this.parentAccount.getAccountConfig().getUniqueId();224 if(this.type == TYPE_INBOX && !this.parentAccount.hasFolders() && this.parentAccount instanceof NetworkAccountNode) { 225 this.uniqueId = ((NetworkAccountNode)this.parentAccount).getAccountConfig().getUniqueId(); 226 226 } 227 227 } … … 1040 1040 // Fetch messages stored in the cache 1041 1041 synchronized(fetchLock) { 1042 if(parentAccount .getAccountConfig() != null) {1042 if(parentAccount instanceof NetworkAccountNode) { 1043 1043 if(fetchThread == null || !fetchThread.isAlive()) { 1044 1044 synchronized(messages) { -
trunk/LogicMail/src/org/logicprobe/LogicMail/model/MessageNode.java
r691 r701 278 278 if(parent != null 279 279 && parent.getParentAccount() != null 280 && parent.getParentAccount() .getAccountConfig() != null) {280 && parent.getParentAccount() instanceof NetworkAccountNode) { 281 281 return true; 282 282 } … … 1131 1131 int maxSize = Integer.MAX_VALUE; 1132 1132 MimeMessagePart[] displayableParts = MimeMessagePartTransformer.getDisplayableParts(this.messageStructure); 1133 AccountConfig accountConfig = parent.getParentAccount().getAccountConfig(); 1134 if(accountConfig instanceof ImapConfig) { 1135 maxSize = ((ImapConfig)accountConfig).getMaxMessageSize(); 1133 if(parent.getParentAccount() instanceof NetworkAccountNode) { 1134 AccountConfig accountConfig = ((NetworkAccountNode)parent.getParentAccount()).getAccountConfig(); 1135 if(accountConfig instanceof ImapConfig) { 1136 maxSize = ((ImapConfig)accountConfig).getMaxMessageSize(); 1137 } 1136 1138 } 1137 1139 Vector partsToFetch = new Vector(); -
trunk/LogicMail/src/org/logicprobe/LogicMail/model/MessageNodeReader.java
r598 r701 329 329 // Resolve the accounts 330 330 if(sendingAccountId != -1 || replyToAccountId != -1) { 331 AccountNode[] accounts = MailManager.getInstance().getMailRootNode().getAccounts();331 NetworkAccountNode[] accounts = MailManager.getInstance().getMailRootNode().getNetworkAccounts(); 332 332 for(int i=0; i<accounts.length; i++) { 333 if(accounts[i].getAccountConfig() != null) { 334 long accountId = accounts[i].getAccountConfig().getUniqueId(); 335 336 if(accountId == sendingAccountId) { 337 messageNode.setSendingAccount(accounts[i]); 338 } 339 340 if(accountId == replyToAccountId) { 341 replyToAccount = accounts[i]; 342 } 333 long accountId = accounts[i].getAccountConfig().getUniqueId(); 334 335 if(accountId == sendingAccountId) { 336 messageNode.setSendingAccount(accounts[i]); 337 } 338 339 if(accountId == replyToAccountId) { 340 replyToAccount = accounts[i]; 343 341 } 344 342 } -
trunk/LogicMail/src/org/logicprobe/LogicMail/model/MessageNodeWriter.java
r586 r701 189 189 table.put(HEADER_KEY_OUTGOING, Boolean.TRUE); 190 190 191 if(outgoingMessage.getSendingAccount() != null && outgoingMessage.getSendingAccount() .getAccountConfig() != null) {191 if(outgoingMessage.getSendingAccount() != null && outgoingMessage.getSendingAccount() instanceof NetworkAccountNode) { 192 192 table.put(HEADER_KEY_OUTGOING_SENDING_ACCOUNT, 193 new Long( outgoingMessage.getSendingAccount().getAccountConfig().getUniqueId()));193 new Long(((NetworkAccountNode)outgoingMessage.getSendingAccount()).getAccountConfig().getUniqueId())); 194 194 } 195 195 if(outgoingMessage.getMailSender() != null && outgoingMessage.getMailSender() instanceof NetworkMailSender) { … … 203 203 if(outgoingMessage.getReplyToAccount() != null) { 204 204 AccountNode replyToAccount = outgoingMessage.getReplyToAccount(); 205 if(replyToAccount .getAccountConfig() != null) {206 table.put(HEADER_KEY_OUTGOING_REPLYTO_ACCOUNT, new Long( replyToAccount.getAccountConfig().getUniqueId()));205 if(replyToAccount instanceof NetworkAccountNode) { 206 table.put(HEADER_KEY_OUTGOING_REPLYTO_ACCOUNT, new Long(((NetworkAccountNode)replyToAccount).getAccountConfig().getUniqueId())); 207 207 } 208 208 } -
trunk/LogicMail/src/org/logicprobe/LogicMail/model/OutboxMailboxNode.java
r693 r701 339 339 // Store to the Sent folder 340 340 if(outgoingMessageNode.getSendingAccount() != null) { 341 AccountConfig sendingAccountConfig = outgoingMessageNode.getSendingAccount().getAccountConfig();341 AccountConfig sendingAccountConfig = ((NetworkAccountNode)outgoingMessageNode.getSendingAccount()).getAccountConfig(); 342 342 343 343 // Append to the Sent message folder, if available -
trunk/LogicMail/src/org/logicprobe/LogicMail/ui/AccountConfigScreen.java
r660 r701 60 60 import org.logicprobe.LogicMail.model.MailManager; 61 61 import org.logicprobe.LogicMail.model.MailboxNode; 62 import org.logicprobe.LogicMail.model.NetworkAccountNode; 62 63 63 64 /** … … 453 454 for(int i=0; i<accountNodes.length; i++) { 454 455 if(accountNodes[i].getStatus() == AccountNode.STATUS_LOCAL || 455 accountNodes[i].getAccountConfig() == accountConfig) {456 ((NetworkAccountNode)accountNodes[i]).getAccountConfig() == accountConfig) { 456 457 accountNodeVector.addElement(accountNodes[i]); 457 458 } -
trunk/LogicMail/src/org/logicprobe/LogicMail/ui/AccountConfigWizard.java
r608 r701 9 9 import org.logicprobe.LogicMail.conf.IdentityConfig; 10 10 import org.logicprobe.LogicMail.conf.OutgoingConfig; 11 import org.logicprobe.LogicMail.model.AccountNode;12 11 import org.logicprobe.LogicMail.model.MailManager; 12 import org.logicprobe.LogicMail.model.NetworkAccountNode; 13 13 14 14 import net.rim.device.api.ui.Field; … … 568 568 569 569 // Find the newly created account, and trigger a folder refresh (if applicable) 570 AccountNode[] accounts = MailManager.getInstance().getMailRootNode().getAccounts(); 571 for(int i=0; i<accounts.length; i++) { 572 if(accounts[i].getAccountConfig() == accountConfig) { 573 if(accounts[i].hasFolders()) { 574 accounts[i].refreshMailboxes(); 575 } 576 break; 577 } 570 NetworkAccountNode newAccount = MailManager.getInstance().getMailRootNode().findAccountForConfig(accountConfig); 571 if(newAccount != null && newAccount.hasFolders()) { 572 newAccount.refreshMailboxes(); 578 573 } 579 574 } -
trunk/LogicMail/src/org/logicprobe/LogicMail/ui/CompositionScreen.java
r694 r701 78 78 import org.logicprobe.LogicMail.message.UnsupportedContentException; 79 79 import org.logicprobe.LogicMail.message.VideoPart; 80 import org.logicprobe.LogicMail.model.AccountNode;81 80 import org.logicprobe.LogicMail.model.Address; 82 81 import org.logicprobe.LogicMail.model.MailboxNode; … … 84 83 import org.logicprobe.LogicMail.model.MessageNodeEvent; 85 84 import org.logicprobe.LogicMail.model.MessageNodeListener; 85 import org.logicprobe.LogicMail.model.NetworkAccountNode; 86 86 import org.logicprobe.LogicMail.util.EventObjectRunnable; 87 87 import org.logicprobe.LogicMail.util.UnicodeNormalizer; … … 100 100 private String initialRecipient; 101 101 private MessageNode sourceMessageNode; 102 private AccountNode accountNode;102 private NetworkAccountNode accountNode; 103 103 private AccountConfig accountConfig; 104 104 private UnicodeNormalizer unicodeNormalizer; … … 170 170 * @param accountNode Account node 171 171 */ 172 public CompositionScreen( AccountNode accountNode) {172 public CompositionScreen(NetworkAccountNode accountNode) { 173 173 this.accountNode = accountNode; 174 174 this.accountConfig = accountNode.getAccountConfig(); … … 185 185 * @param recipient Message recipient address to pre-populate the "To" field with 186 186 */ 187 public CompositionScreen( AccountNode accountNode, String recipient) {187 public CompositionScreen(NetworkAccountNode accountNode, String recipient) { 188 188 this(accountNode); 189 189 this.initialRecipient = recipient; … … 200 200 */ 201 201 public CompositionScreen( 202 AccountNode accountNode,202 NetworkAccountNode accountNode, 203 203 MessageNode messageNode, 204 204 int composeType) { -
trunk/LogicMail/src/org/logicprobe/LogicMail/ui/MailHomeScreen.java
r693 r701 63 63 import org.logicprobe.LogicMail.model.MailboxNodeListener; 64 64 import org.logicprobe.LogicMail.model.MessageNode; 65 import org.logicprobe.LogicMail.model.NetworkAccountNode; 65 66 import org.logicprobe.LogicMail.model.Node; 66 67 import org.logicprobe.LogicMail.model.OutboxMailboxNode; … … 383 384 AccountNode accountNode = getAccountForTreeNode(treeNode); 384 385 385 if(accountNode != null) {386 accountNode.requestDisconnect(false);386 if(accountNode instanceof NetworkAccountNode) { 387 ((NetworkAccountNode)accountNode).requestDisconnect(false); 387 388 } 388 389 } … … 391 392 AccountNode accountNode = getAccountForTreeNode(treeNode); 392 393 393 if(accountNode != null && accountNode.getAccountConfig() != null) {394 navigationController.displayComposition( accountNode);394 if(accountNode instanceof NetworkAccountNode) { 395 navigationController.displayComposition((NetworkAccountNode)accountNode); 395 396 } 396 397 } … … 468 469 firstVisible = false; 469 470 // Check to see if there are no configured accounts 470 if(mailRootNode.get Accounts().length <= 1) {471 if(mailRootNode.getNetworkAccounts().length == 0) { 471 472 navigationController.displayAccountConfigurationWizard(); 472 473 } … … 481 482 if(treeNode.node instanceof MailboxNode) { 482 483 menu.add(selectFolderItem); 483 if(((MailboxNode)treeNode.node).getParentAccount().hasMailSender()) { 484 AccountNode parentAccount = ((MailboxNode)treeNode.node).getParentAccount(); 485 if(parentAccount instanceof NetworkAccountNode && ((NetworkAccountNode)parentAccount).hasMailSender()) { 484 486 menu.add(compositionItem); 485 487 } … … 497 499 menu.add(refreshFoldersItem); 498 500 } 499 if(accountNode .hasMailSender()) {501 if(accountNode instanceof NetworkAccountNode && ((NetworkAccountNode)accountNode).hasMailSender()) { 500 502 menu.add(compositionItem); 501 503 } … … 592 594 // Check whether we can enable composition 593 595 MailHomeTreeNode treeNode = (MailHomeTreeNode)treeField.getCookie(curNode); 594 if(treeNode.node instanceof AccountNode) {595 if((( AccountNode)treeNode.node).hasMailSender()) {596 if(treeNode.node instanceof NetworkAccountNode) { 597 if(((NetworkAccountNode)treeNode.node).hasMailSender()) { 596 598 enableCompose = true; 597 599 } … … 601 603 } 602 604 else if(treeNode.node instanceof MailboxNode) { 603 if(((MailboxNode)treeNode.node).getParentAccount().hasMailSender()) { 605 AccountNode parentAccount = ((MailboxNode)treeNode.node).getParentAccount(); 606 if(parentAccount instanceof NetworkAccountNode && ((NetworkAccountNode)parentAccount).hasMailSender()) { 604 607 enableCompose = true; 605 608 } -
trunk/LogicMail/src/org/logicprobe/LogicMail/ui/MailboxScreen.java
r668 r701 62 62 import org.logicprobe.LogicMail.model.MessageNodeEvent; 63 63 import org.logicprobe.LogicMail.model.MessageNodeListener; 64 import org.logicprobe.LogicMail.model.NetworkAccountNode; 64 65 import org.logicprobe.LogicMail.util.EventObjectRunnable; 65 66 … … 194 195 } 195 196 196 composeEnabled = mailboxNode.getParentAccount().hasMailSender(); 197 composeEnabled = (mailboxNode.getParentAccount() instanceof NetworkAccountNode) 198 && ((NetworkAccountNode)mailboxNode.getParentAccount()).hasMailSender(); 197 199 ((StandardScreen)screen).setShortcutEnabled(SHORTCUT_COMPOSE, composeEnabled); 198 200 … … 267 269 compositionItem = new MenuItem(resources, LogicMailResource.MENUITEM_COMPOSE_EMAIL, 400100, 2000) { 268 270 public void run() { 269 navigationController.displayComposition( mailboxNode.getParentAccount());271 navigationController.displayComposition((NetworkAccountNode)mailboxNode.getParentAccount()); 270 272 } 271 273 }; -
trunk/LogicMail/src/org/logicprobe/LogicMail/ui/MessageActions.java
r643 r701 52 52 import org.logicprobe.LogicMail.model.MessageNodeEvent; 53 53 import org.logicprobe.LogicMail.model.MessageNodeListener; 54 import org.logicprobe.LogicMail.model.NetworkAccountNode; 54 55 import org.logicprobe.LogicMail.model.OutgoingMessageNode; 55 56 … … 191 192 192 193 if(!unloaded) { 193 if(accountNode.hasMailSender()) { 194 menu.add(replyItem); 195 if(accountNode.hasIdentity()) { 196 menu.add(replyAllItem); 194 if(accountNode instanceof NetworkAccountNode) { 195 NetworkAccountNode networkAccount = (NetworkAccountNode)accountNode; 196 if(networkAccount.hasMailSender()) { 197 menu.add(replyItem); 198 if(networkAccount.hasIdentity()) { 199 menu.add(replyAllItem); 200 } 201 menu.add(forwardItem); 197 202 } 198 menu.add(forwardItem);199 203 } 200 204 } … … 264 268 // configured as their drafts folder, and have a mail sender 265 269 Vector matchingAccounts = new Vector(); 266 AccountNode[] accounts = MailManager.getInstance().getMailRootNode().getAccounts();270 NetworkAccountNode[] accounts = MailManager.getInstance().getMailRootNode().getNetworkAccounts(); 267 271 268 272 for(int i=0; i<accounts.length; i++) { 269 273 if(accounts[i].hasMailSender()) { 270 274 AccountConfig accountConfig = accounts[i].getAccountConfig(); 271 if(accountConfig != null) { 272 if(accountConfig.getDraftMailbox() == messageNode.getParent()) { 273 matchingAccounts.addElement(accounts[i]); 274 } 275 } 275 if(accountConfig.getDraftMailbox() == messageNode.getParent()) { 276 matchingAccounts.addElement(accounts[i]); 277 } 276 278 } 277 279 } … … 282 284 if(matchingAccounts.size() == 0) { 283 285 for(int i=0; i<accounts.length; i++) { 284 if(accounts[i].hasMailSender() && accounts[i].getAccountConfig() != null) {286 if(accounts[i].hasMailSender()) { 285 287 matchingAccounts.addElement(accounts[i]); 286 288 } … … 290 292 // Select the account node that matches this mailbox, prompting the 291 293 // user if necessary. 292 AccountNode account;294 NetworkAccountNode account; 293 295 int size = matchingAccounts.size(); 294 296 if(size > 1) { 295 AccountNode[] choices = newAccountNode[size];297 NetworkAccountNode[] choices = new NetworkAccountNode[size]; 296 298 matchingAccounts.copyInto(choices); 297 299 int result = Dialog.ask( … … 306 308 } 307 309 else if(size == 1) { 308 account = ( AccountNode)matchingAccounts.elementAt(0);310 account = (NetworkAccountNode)matchingAccounts.elementAt(0); 309 311 } 310 312 else { … … 371 373 public void replyMessage(MessageNode messageNode) { 372 374 if(messageNode.hasMessageContent()) { 373 navigationController.displayCompositionReply( messageNode.getParent().getParentAccount(), messageNode, false);375 navigationController.displayCompositionReply((NetworkAccountNode)messageNode.getParent().getParentAccount(), messageNode, false); 374 376 } 375 377 } … … 382 384 public void replyAllMessage(MessageNode messageNode) { 383 385 if(messageNode.hasMessageContent()) { 384 navigationController.displayCompositionReply( messageNode.getParent().getParentAccount(), messageNode, true);386 navigationController.displayCompositionReply((NetworkAccountNode)messageNode.getParent().getParentAccount(), messageNode, true); 385 387 } 386 388 } … … 393 395 public void forwardMessage(MessageNode messageNode) { 394 396 if(messageNode.hasMessageContent()) { 395 navigationController.displayCompositionForward( messageNode.getParent().getParentAccount(), messageNode);397 navigationController.displayCompositionForward((NetworkAccountNode)messageNode.getParent().getParentAccount(), messageNode); 396 398 } 397 399 } -
trunk/LogicMail/src/org/logicprobe/LogicMail/ui/MessageScreen.java
r674 r701 80 80 import org.logicprobe.LogicMail.model.MessageNodeEvent; 81 81 import org.logicprobe.LogicMail.model.MessageNodeListener; 82 import org.logicprobe.LogicMail.model.NetworkAccountNode; 82 83 import org.logicprobe.LogicMail.model.OutgoingMessageNode; 83 84 import org.logicprobe.LogicMail.util.UnicodeNormalizer; … … 111 112 { 112 113 this.messageNode = messageNode; 113 this.accountConfig = messageNode.getParent().getParentAccount().getAccountConfig(); 114 if(messageNode.getParent().getParentAccount() instanceof NetworkAccountNode) { 115 this.accountConfig = ((NetworkAccountNode)messageNode.getParent().getParentAccount()).getAccountConfig(); 116 } 114 117 115 118 if(MailSettings.getInstance().getGlobalConfig().getUnicodeNormalization()) { … … 304 307 compositionItem = new MenuItem(resources, LogicMailResource.MENUITEM_COMPOSE_EMAIL, 400100, 2000) { 305 308 public void run() { 306 navigationController.displayComposition( messageNode.getParent().getParentAccount());309 navigationController.displayComposition((NetworkAccountNode)messageNode.getParent().getParentAccount()); 307 310 } 308 311 }; … … 630 633 if((context & BrowserFieldManager.ACTION_SEND_EMAIL) != 0) { 631 634 String address = ((BrowserFieldManager)field).getSelectedToken(); 632 navigationController.displayComposition( messageNode.getParent().getParentAccount(), address);635 navigationController.displayComposition((NetworkAccountNode)messageNode.getParent().getParentAccount(), address); 633 636 } 634 637 } -
trunk/LogicMail/src/org/logicprobe/LogicMail/ui/NavigationController.java
r675 r701 43 43 import org.logicprobe.LogicMail.mail.MailConnectionStateEvent; 44 44 import org.logicprobe.LogicMail.mail.MailConnectionStatusEvent; 45 import org.logicprobe.LogicMail.model.AccountNode;46 45 import org.logicprobe.LogicMail.model.MailManager; 47 46 import org.logicprobe.LogicMail.model.MailRootNode; 48 47 import org.logicprobe.LogicMail.model.MailboxNode; 49 48 import org.logicprobe.LogicMail.model.MessageNode; 49 import org.logicprobe.LogicMail.model.NetworkAccountNode; 50 50 import org.logicprobe.LogicMail.util.EventObjectRunnable; 51 51 … … 118 118 } 119 119 120 public synchronized void displayComposition( AccountNode accountNode) {120 public synchronized void displayComposition(NetworkAccountNode accountNode) { 121 121 StandardScreen screen = screenFactory.getCompositionScreen(this, accountNode); 122 122 ScreenFactory.getInstance().attachScreenTransition(screen, ScreenFactory.TRANSITION_ZOOM); … … 124 124 } 125 125 126 public synchronized void displayComposition( AccountNode accountNode, MessageNode messageNode) {126 public synchronized void displayComposition(NetworkAccountNode accountNode, MessageNode messageNode) { 127 127 StandardScreen screen = screenFactory.getCompositionScreen( 128 128 this, … … 133 133 } 134 134 135 public void displayComposition( AccountNode accountNode, String address) {135 public void displayComposition(NetworkAccountNode accountNode, String address) { 136 136 StandardScreen screen = screenFactory.getCompositionScreen(this, accountNode, address); 137 137 ScreenFactory.getInstance().attachScreenTransition(screen, ScreenFactory.TRANSITION_ZOOM); … … 139 139 } 140 140 141 public synchronized void displayCompositionReply( AccountNode accountNode, MessageNode messageNode, boolean replyAll) {141 public synchronized void displayCompositionReply(NetworkAccountNode accountNode, MessageNode messageNode, boolean replyAll) { 142 142 StandardScreen screen = screenFactory.getCompositionReplyScreen( 143 143 this, … … 149 149 } 150 150 151 public synchronized void displayCompositionForward( AccountNode accountNode, MessageNode messageNode) {151 public synchronized void displayCompositionForward(NetworkAccountNode accountNode, MessageNode messageNode) { 152 152 StandardScreen screen = screenFactory.getCompositionForwardScreen( 153 153 this, -
trunk/LogicMail/src/org/logicprobe/LogicMail/ui/NotificationHandler.java
r672 r701 48 48 import org.logicprobe.LogicMail.model.MailboxNodeListener; 49 49 import org.logicprobe.LogicMail.model.MessageNode; 50 import org.logicprobe.LogicMail.model.NetworkAccountNode; 50 51 51 52 import net.rim.blackberry.api.homescreen.HomeScreen; … … 173 174 174 175 // Subscribe to any new accounts 175 AccountNode[] accountNodes = MailManager.getInstance().getMailRootNode().getAccounts();176 NetworkAccountNode[] accountNodes = MailManager.getInstance().getMailRootNode().getNetworkAccounts(); 176 177 for(int i=0; i<accountNodes.length; i++) { 177 if(accountNodes[i].getStatus() != AccountNode.STATUS_LOCAL) { 178 updateAccountMap(accountNodes[i]); 179 180 accountNodes[i].addAccountNodeListener(accountNodeListener); 181 182 // Register the notification source, if necessary 183 AccountConfig accountConfig = accountNodes[i].getAccountConfig(); 184 LogicMailEventSource eventSource = (LogicMailEventSource)eventSourceMap.get(accountConfig.getUniqueId()); 185 if(eventSource == null || !eventSource.getAccountName().equals(accountConfig.getAcctName())) { 186 eventSource = 187 new LogicMailEventSource(accountConfig.getAcctName(), accountConfig.getUniqueId()); 188 NotificationsManager.registerSource( 189 eventSource.getEventSourceId(), 190 eventSource, 191 NotificationsConstants.CASUAL); 192 eventSourceMap.put(accountConfig.getUniqueId(), eventSource); 193 } 178 updateAccountMap(accountNodes[i]); 179 180 accountNodes[i].addAccountNodeListener(accountNodeListener); 181 182 // Register the notification source, if necessary 183 AccountConfig accountConfig = ((NetworkAccountNode)accountNodes[i]).getAccountConfig(); 184 LogicMailEventSource eventSource = (LogicMailEventSource)eventSourceMap.get(accountConfig.getUniqueId()); 185 if(eventSource == null || !eventSource.getAccountName().equals(accountConfig.getAcctName())) { 186 eventSource = 187 new LogicMailEventSource(accountConfig.getAcctName(), accountConfig.getUniqueId()); 188 NotificationsManager.registerSource( 189 eventSource.getEventSourceId(), 190 eventSource, 191 NotificationsConstants.CASUAL); 192 eventSourceMap.put(accountConfig.getUniqueId(), eventSource); 194 193 } 195 194 } … … 220 219 221 220 // Unregister the notification source 222 long eventSourceKey = accountNode.getAccountConfig().getUniqueId();221 long eventSourceKey = ((NetworkAccountNode)accountNode).getAccountConfig().getUniqueId(); 223 222 LogicMailEventSource eventSource = (LogicMailEventSource)eventSourceMap.get(eventSourceKey); 224 223 if(eventSource != null) { … … 264 263 */ 265 264 private void notifyNewMessages(MailboxNode mailboxNode) { 266 long sourceId = AppInfo.GUID + mailboxNode.getParentAccount().getAccountConfig().getUniqueId();265 long sourceId = AppInfo.GUID + ((NetworkAccountNode)mailboxNode.getParentAccount()).getAccountConfig().getUniqueId(); 267 266 NotificationsManager.triggerImmediateEvent(sourceId, 0, this, null); 268 267 setAppIcon(true); … … 276 275 while(e.hasMoreElements()) { 277 276 AccountNode accountNode = (AccountNode)e.nextElement(); 278 long sourceId = AppInfo.GUID + accountNode.getAccountConfig().getUniqueId();277 long sourceId = AppInfo.GUID + ((NetworkAccountNode)accountNode).getAccountConfig().getUniqueId(); 279 278 NotificationsManager.cancelImmediateEvent(sourceId, 0, this, null); 280 279 } -
trunk/LogicMail/src/org/logicprobe/LogicMail/ui/ScreenFactory.java
r686 r701 33 33 import net.rim.device.api.ui.Screen; 34 34 35 import org.logicprobe.LogicMail.model.AccountNode;36 35 import org.logicprobe.LogicMail.model.MailRootNode; 37 36 import org.logicprobe.LogicMail.model.MailboxNode; 38 37 import org.logicprobe.LogicMail.model.MessageNode; 38 import org.logicprobe.LogicMail.model.NetworkAccountNode; 39 39 import org.logicprobe.LogicMail.util.PlatformUtils; 40 40 … … 81 81 public abstract StandardScreen getMessageScreen(NavigationController navigationController, MessageNode messageNode); 82 82 83 public abstract StandardScreen getCompositionScreen(NavigationController navigationController, AccountNode accountNode);83 public abstract StandardScreen getCompositionScreen(NavigationController navigationController, NetworkAccountNode accountNode); 84 84 85 public abstract StandardScreen getCompositionScreen(NavigationController navigationController, AccountNode accountNode, MessageNode messageNode);85 public abstract StandardScreen getCompositionScreen(NavigationController navigationController, NetworkAccountNode accountNode, MessageNode messageNode); 86 86 87 public abstract StandardScreen getCompositionScreen(NavigationController navigationController, AccountNode accountNode, String address);87 public abstract StandardScreen getCompositionScreen(NavigationController navigationController, NetworkAccountNode accountNode, String address); 88 88 89 public abstract StandardScreen getCompositionReplyScreen(NavigationController navigationController, AccountNode accountNode, MessageNode messageNode, boolean replyAll);89 public abstract StandardScreen getCompositionReplyScreen(NavigationController navigationController, NetworkAccountNode accountNode, MessageNode messageNode, boolean replyAll); 90 90 91 public abstract StandardScreen getCompositionForwardScreen(NavigationController navigationController, AccountNode accountNode, MessageNode messageNode);91 public abstract StandardScreen getCompositionForwardScreen(NavigationController navigationController, NetworkAccountNode accountNode, MessageNode messageNode); 92 92 93 93 public abstract String showFilePicker(); -
trunk/LogicMail/src/org/logicprobe/LogicMail/ui/ScreenFactoryBB42.java
r675 r701 34 34 import net.rim.device.api.ui.component.Dialog; 35 35 36 import org.logicprobe.LogicMail.model.AccountNode;37 36 import org.logicprobe.LogicMail.model.MailRootNode; 38 37 import org.logicprobe.LogicMail.model.MailboxNode; 39 38 import org.logicprobe.LogicMail.model.MessageNode; 39 import org.logicprobe.LogicMail.model.NetworkAccountNode; 40 40 41 41 public class ScreenFactoryBB42 extends ScreenFactory { … … 64 64 } 65 65 66 public StandardScreen getCompositionScreen(NavigationController navigationController, AccountNode accountNode) {66 public StandardScreen getCompositionScreen(NavigationController navigationController, NetworkAccountNode accountNode) { 67 67 return new StandardScreen(navigationController, new CompositionScreen(accountNode)); 68 68 } 69 69 70 public StandardScreen getCompositionScreen(NavigationController navigationController, AccountNode accountNode, MessageNode messageNode) {70 public StandardScreen getCompositionScreen(NavigationController navigationController, NetworkAccountNode accountNode, MessageNode messageNode) { 71 71 return new StandardScreen(navigationController, new CompositionScreen( 72 72 accountNode, … … 75 75 } 76 76 77 public StandardScreen getCompositionScreen(NavigationController navigationController, AccountNode accountNode, String address) {77 public StandardScreen getCompositionScreen(NavigationController navigationController, NetworkAccountNode accountNode, String address) { 78 78 return new StandardScreen(navigationController, new CompositionScreen(accountNode, address)); 79 79 } 80 80 81 public StandardScreen getCompositionReplyScreen(NavigationController navigationController, AccountNode accountNode, MessageNode messageNode, boolean replyAll) {81 public StandardScreen getCompositionReplyScreen(NavigationController navigationController, NetworkAccountNode accountNode, MessageNode messageNode, boolean replyAll) { 82 82 return new StandardScreen(navigationController, new CompositionScreen( 83 83 accountNode, … … 86 86 } 87 87 88 public StandardScreen getCompositionForwardScreen(NavigationController navigationController, AccountNode accountNode, MessageNode messageNode) {88 public StandardScreen getCompositionForwardScreen(NavigationController navigationController, NetworkAccountNode accountNode, MessageNode messageNode) { 89 89 return new StandardScreen(navigationController, new CompositionScreen( 90 90 accountNode, -
trunk/LogicMail/src/org/logicprobe/LogicMail/ui/StandardScreen.java
r686 r701 34 34 import org.logicprobe.LogicMail.model.AccountNode; 35 35 import org.logicprobe.LogicMail.model.MailManager; 36 import org.logicprobe.LogicMail.model.NetworkAccountNode; 36 37 37 38 import net.rim.device.api.i18n.ResourceBundle; … … 232 233 public void tryShutdownApplication() { 233 234 // Get all accounts 234 AccountNode[] accounts = MailManager.getInstance().getMailRootNode().getAccounts();235 NetworkAccountNode[] accounts = MailManager.getInstance().getMailRootNode().getNetworkAccounts(); 235 236 236 237 // Find out of we still have an open connection
Note: See TracChangeset
for help on using the changeset viewer.
