mirror of
https://github.com/moparisthebest/k-9
synced 2024-11-23 18:02:15 -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;
|
mNotifyNewMail = true;
|
||||||
mSignature = "Sent from my Android phone with K-9. Please excuse my brevity.";
|
mSignature = "Sent from my Android phone with K-9. Please excuse my brevity.";
|
||||||
mVibrate = false;
|
mVibrate = false;
|
||||||
mFolderDisplayMode = FolderMode.ALL;
|
mFolderDisplayMode = FolderMode.NOT_SECOND_CLASS;
|
||||||
mFolderSyncMode = FolderMode.ALL;
|
mFolderSyncMode = FolderMode.FIRST_CLASS;
|
||||||
mRingtoneUri = "content://settings/system/notification_sound";
|
mRingtoneUri = "content://settings/system/notification_sound";
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -126,7 +126,7 @@ public class Account implements Serializable {
|
|||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
mFolderDisplayMode = FolderMode.ALL;
|
mFolderDisplayMode = FolderMode.NOT_SECOND_CLASS;
|
||||||
}
|
}
|
||||||
|
|
||||||
try
|
try
|
||||||
@ -136,7 +136,7 @@ public class Account implements Serializable {
|
|||||||
}
|
}
|
||||||
catch (Exception e)
|
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++) {
|
for (int i = 0, count = remoteFolders.length; i < count; i++) {
|
||||||
LocalFolder localFolder = localStore.getFolder(remoteFolders[i].getName());
|
LocalFolder localFolder = localStore.getFolder(remoteFolders[i].getName());
|
||||||
if (!localFolder.exists()) {
|
if (!localFolder.exists()) {
|
||||||
// TODO: if the localFolder is inbox, set to 1st Class
|
|
||||||
localFolder.create(FolderType.HOLDS_MESSAGES, account.getDisplayCount());
|
localFolder.create(FolderType.HOLDS_MESSAGES, account.getDisplayCount());
|
||||||
localFolder.setDisplayClass(Folder.FolderClass.FIRST_CLASS);
|
|
||||||
localFolder.save(Preferences.getPreferences(mApplication));
|
localFolder.save(Preferences.getPreferences(mApplication));
|
||||||
}
|
}
|
||||||
remoteFolderNames.add(remoteFolders[i].getName());
|
remoteFolderNames.add(remoteFolders[i].getName());
|
||||||
|
@ -348,6 +348,12 @@ public class LocalStore extends Store implements Serializable {
|
|||||||
|
|
||||||
public LocalFolder(String name) {
|
public LocalFolder(String name) {
|
||||||
this.mName = name;
|
this.mName = name;
|
||||||
|
|
||||||
|
if (Email.INBOX.equals(getName()))
|
||||||
|
{
|
||||||
|
syncClass = FolderClass.FIRST_CLASS;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public long getId() {
|
public long getId() {
|
||||||
@ -356,28 +362,33 @@ public class LocalStore extends Store implements Serializable {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void open(OpenMode mode) throws MessagingException {
|
public void open(OpenMode mode) throws MessagingException {
|
||||||
if (isOpen()) {
|
if (isOpen()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (!exists()) {
|
Cursor cursor = null;
|
||||||
create(FolderType.HOLDS_MESSAGES);
|
try {
|
||||||
}
|
cursor = mDb.rawQuery("SELECT id, unread_count, visible_limit, last_updated, status FROM folders "
|
||||||
Cursor cursor = null;
|
+ "where folders.name = ?",
|
||||||
try {
|
new String[] {
|
||||||
cursor = mDb.rawQuery("SELECT id, unread_count, visible_limit, last_updated, status FROM folders "
|
mName
|
||||||
+ "where folders.name = ?",
|
});
|
||||||
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) {
|
finally {
|
||||||
cursor.close();
|
if (cursor != null) {
|
||||||
}
|
cursor.close();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void open(int id, int unreadCount, int visibleLimit, long lastChecked, String status) throws MessagingException
|
private void open(int id, int unreadCount, int visibleLimit, long lastChecked, String status) throws MessagingException
|
||||||
@ -581,8 +592,8 @@ public class LocalStore extends Store implements Serializable {
|
|||||||
String id = getPrefId();
|
String id = getPrefId();
|
||||||
|
|
||||||
SharedPreferences.Editor editor = preferences.mSharedPreferences.edit();
|
SharedPreferences.Editor editor = preferences.mSharedPreferences.edit();
|
||||||
// there can be a lot of folders. For the defaults, let's not save prefs, saving space
|
// there can be a lot of folders. For the defaults, let's not save prefs, saving space, except for INBOX
|
||||||
if (displayClass == FolderClass.NONE)
|
if (displayClass == FolderClass.NONE && !Email.INBOX.equals(getName()))
|
||||||
{
|
{
|
||||||
editor.remove(id + ".displayMode");
|
editor.remove(id + ".displayMode");
|
||||||
}
|
}
|
||||||
@ -591,7 +602,7 @@ public class LocalStore extends Store implements Serializable {
|
|||||||
editor.putString(id + ".displayMode", displayClass.name());
|
editor.putString(id + ".displayMode", displayClass.name());
|
||||||
}
|
}
|
||||||
|
|
||||||
if (syncClass == FolderClass.NONE)
|
if (syncClass == FolderClass.NONE && !Email.INBOX.equals(getName()))
|
||||||
{
|
{
|
||||||
editor.remove(id + ".syncMode");
|
editor.remove(id + ".syncMode");
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user