mirror of
https://github.com/moparisthebest/k-9
synced 2024-11-23 09:52:16 -05:00
Set to use new folder display and sync class defaults.
Accounts are now set: Folder display mode = All except 2nd Class Folder sync mode = Only 1st Class Only the Inbox is set for: Folder sync class = 1st Class All other folders have class set to None for sync and display Also restored an optimization on opening local folders that I removed. It is now optimistic, and in the normal case does not have to make an explicit existence check
This commit is contained in:
parent
41d6598e22
commit
828ceba503
@ -75,8 +75,8 @@ public class Account implements Serializable {
|
||||
mNotifyNewMail = true;
|
||||
mSignature = "Sent from my Android phone with K-9. Please excuse my brevity.";
|
||||
mVibrate = false;
|
||||
mFolderDisplayMode = FolderMode.ALL;
|
||||
mFolderSyncMode = FolderMode.ALL;
|
||||
mFolderDisplayMode = FolderMode.NOT_SECOND_CLASS;
|
||||
mFolderSyncMode = FolderMode.FIRST_CLASS;
|
||||
mRingtoneUri = "content://settings/system/notification_sound";
|
||||
}
|
||||
|
||||
@ -126,7 +126,7 @@ public class Account implements Serializable {
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
mFolderDisplayMode = FolderMode.ALL;
|
||||
mFolderDisplayMode = FolderMode.NOT_SECOND_CLASS;
|
||||
}
|
||||
|
||||
try
|
||||
@ -136,7 +136,7 @@ public class Account implements Serializable {
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
mFolderSyncMode = FolderMode.ALL;
|
||||
mFolderSyncMode = FolderMode.FIRST_CLASS;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -304,9 +304,7 @@ public class MessagingController implements Runnable {
|
||||
for (int i = 0, count = remoteFolders.length; i < count; i++) {
|
||||
LocalFolder localFolder = localStore.getFolder(remoteFolders[i].getName());
|
||||
if (!localFolder.exists()) {
|
||||
// TODO: if the localFolder is inbox, set to 1st Class
|
||||
localFolder.create(FolderType.HOLDS_MESSAGES, account.getDisplayCount());
|
||||
localFolder.setDisplayClass(Folder.FolderClass.FIRST_CLASS);
|
||||
localFolder.save(Preferences.getPreferences(mApplication));
|
||||
}
|
||||
remoteFolderNames.add(remoteFolders[i].getName());
|
||||
|
@ -348,6 +348,12 @@ public class LocalStore extends Store implements Serializable {
|
||||
|
||||
public LocalFolder(String name) {
|
||||
this.mName = name;
|
||||
|
||||
if (Email.INBOX.equals(getName()))
|
||||
{
|
||||
syncClass = FolderClass.FIRST_CLASS;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public long getId() {
|
||||
@ -359,9 +365,6 @@ public class LocalStore extends Store implements Serializable {
|
||||
if (isOpen()) {
|
||||
return;
|
||||
}
|
||||
if (!exists()) {
|
||||
create(FolderType.HOLDS_MESSAGES);
|
||||
}
|
||||
Cursor cursor = null;
|
||||
try {
|
||||
cursor = mDb.rawQuery("SELECT id, unread_count, visible_limit, last_updated, status FROM folders "
|
||||
@ -369,9 +372,17 @@ public class LocalStore extends Store implements Serializable {
|
||||
new String[] {
|
||||
mName
|
||||
});
|
||||
cursor.moveToFirst();
|
||||
open(cursor.getInt(0), cursor.getInt(1), cursor.getInt(2), cursor.getLong(3), cursor.getString(4));
|
||||
|
||||
if (cursor.moveToFirst()) {
|
||||
int folderId = cursor.getInt(0);
|
||||
if (folderId > 0)
|
||||
{
|
||||
open(cursor.getInt(0), cursor.getInt(1), cursor.getInt(2), cursor.getLong(3), cursor.getString(4));
|
||||
}
|
||||
} else {
|
||||
create(FolderType.HOLDS_MESSAGES);
|
||||
open(mode);
|
||||
}
|
||||
}
|
||||
finally {
|
||||
if (cursor != null) {
|
||||
@ -581,8 +592,8 @@ public class LocalStore extends Store implements Serializable {
|
||||
String id = getPrefId();
|
||||
|
||||
SharedPreferences.Editor editor = preferences.mSharedPreferences.edit();
|
||||
// there can be a lot of folders. For the defaults, let's not save prefs, saving space
|
||||
if (displayClass == FolderClass.NONE)
|
||||
// there can be a lot of folders. For the defaults, let's not save prefs, saving space, except for INBOX
|
||||
if (displayClass == FolderClass.NONE && !Email.INBOX.equals(getName()))
|
||||
{
|
||||
editor.remove(id + ".displayMode");
|
||||
}
|
||||
@ -591,7 +602,7 @@ public class LocalStore extends Store implements Serializable {
|
||||
editor.putString(id + ".displayMode", displayClass.name());
|
||||
}
|
||||
|
||||
if (syncClass == FolderClass.NONE)
|
||||
if (syncClass == FolderClass.NONE && !Email.INBOX.equals(getName()))
|
||||
{
|
||||
editor.remove(id + ".syncMode");
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user