Issue 319

Do not reset all folder settings when a database upgrade occurs. (Or
any other event that wipes all of the local folders.
This commit is contained in:
Daniel Applebaum 2009-02-24 05:03:28 +00:00
parent acea3ab3b5
commit 0e9d1f195e
2 changed files with 12 additions and 7 deletions

View File

@ -428,7 +428,6 @@ public class MessagingController implements Runnable {
LocalFolder localFolder = localStore.getFolder(remoteFolders[i].getName());
if (!localFolder.exists()) {
localFolder.create(FolderType.HOLDS_MESSAGES, account.getDisplayCount());
localFolder.save(Preferences.getPreferences(mApplication));
}
remoteFolderNames.add(remoteFolders[i].getName());
}

View File

@ -108,10 +108,9 @@ public class LocalStore extends Store implements Serializable {
private void doDbUpgrade ( SQLiteDatabase mDb) {
if (Config.LOGV) {
Log.v(Email.LOG_TAG, String.format("Upgrading database from %d to %d", mDb
.getVersion(), DB_VERSION));
}
Log.i(Email.LOG_TAG, String.format("Upgrading database from version %d to version %d",
mDb.getVersion(), DB_VERSION));
mDb.execSQL("DROP TABLE IF EXISTS folders");
mDb.execSQL("CREATE TABLE folders (id INTEGER PRIMARY KEY, name TEXT, "
+ "last_updated INTEGER, unread_count INTEGER, visible_limit INTEGER, status TEXT)");
@ -729,16 +728,23 @@ public class LocalStore extends Store implements Serializable {
displayClass = FolderClass.NONE;
}
FolderClass defSyncClass = FolderClass.NONE;
if (Email.INBOX.equals(getName()))
{
defSyncClass = FolderClass.FIRST_CLASS;
}
try
{
syncClass = FolderClass.valueOf(preferences.mSharedPreferences.getString(id + ".syncMode",
FolderClass.NONE.name()));
defSyncClass.name()));
}
catch (Exception e)
{
Log.e(Email.LOG_TAG, "Unable to load syncMode for " + getName(), e);
syncClass = FolderClass.NONE;
syncClass = defSyncClass;
}
}