1
0
mirror of https://github.com/moparisthebest/k-9 synced 2024-12-24 08:38:51 -05:00

Always reload all accounts after importing one or more accounts

This commit is contained in:
cketti 2011-04-13 03:44:43 +02:00
parent 12d87854ac
commit 8240d7ff10
2 changed files with 6 additions and 19 deletions

View File

@ -49,36 +49,23 @@ public class Preferences {
}
}
private synchronized void loadAccounts() {
public synchronized void loadAccounts() {
accounts = new HashMap<String, Account>();
refreshAccounts();
}
public synchronized void refreshAccounts() {
Map<String, Account> newAccountMap = new HashMap<String, Account>();
accountsInOrder = new LinkedList<Account>();
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;
}
/**

View File

@ -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);