diff --git a/src/com/fsck/k9/Preferences.java b/src/com/fsck/k9/Preferences.java index 6ee07f538..462d37e63 100644 --- a/src/com/fsck/k9/Preferences.java +++ b/src/com/fsck/k9/Preferences.java @@ -49,36 +49,23 @@ public class Preferences { } } - private synchronized void loadAccounts() { + public synchronized void loadAccounts() { accounts = new HashMap(); - refreshAccounts(); - } - - public synchronized void refreshAccounts() { - Map newAccountMap = new HashMap(); accountsInOrder = new LinkedList(); String accountUuids = getPreferences().getString("accountUuids", null); if ((accountUuids != null) && (accountUuids.length() != 0)) { String[] uuids = accountUuids.split(","); for (String uuid : uuids) { - Account account = accounts.get(uuid); - if (account != null) { - newAccountMap.put(uuid, account); - accountsInOrder.add(account); - } else { - Account newAccount = new Account(this, uuid); - newAccountMap.put(uuid, newAccount); - accountsInOrder.add(newAccount); - } + Account newAccount = new Account(this, uuid); + accounts.put(uuid, newAccount); + accountsInOrder.add(newAccount); } } if ((newAccount != null) && newAccount.getAccountNumber() != -1) { - newAccountMap.put(newAccount.getUuid(), newAccount); + accounts.put(newAccount.getUuid(), newAccount); accountsInOrder.add(newAccount); newAccount = null; } - - accounts = newAccountMap; } /** diff --git a/src/com/fsck/k9/preferences/StorageImporter.java b/src/com/fsck/k9/preferences/StorageImporter.java index 47f15fa08..8f7412cc1 100644 --- a/src/com/fsck/k9/preferences/StorageImporter.java +++ b/src/com/fsck/k9/preferences/StorageImporter.java @@ -178,7 +178,7 @@ public class StorageImporter { throw new StorageImportExportException("Couldn't save imported settings"); } - preferences.refreshAccounts(); + preferences.loadAccounts(); DateFormatter.clearChosenFormat(); K9.loadPrefs(preferences); K9.setServicesEnabled(context);