mirror of
https://github.com/moparisthebest/k-9
synced 2025-02-07 02:30:10 -05:00
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:
parent
acea3ab3b5
commit
0e9d1f195e
@ -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());
|
||||
}
|
||||
|
@ -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;
|
||||
}
|
||||
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user