am ed4e1c50
: Merge "Disable sync settings controls for drafts folders" into jb-ub-mail-ur10
* commit 'ed4e1c503942eb8e809782d762be519b70d6f89a': Disable sync settings controls for drafts folders
This commit is contained in:
commit
4e19b9499e
@ -347,7 +347,9 @@ public class Mailbox extends EmailContent implements MailboxColumns, Parcelable
|
||||
SYNCABLE_TYPES = new SparseBooleanArray(7);
|
||||
SYNCABLE_TYPES.put(TYPE_INBOX, true);
|
||||
SYNCABLE_TYPES.put(TYPE_MAIL, false);
|
||||
SYNCABLE_TYPES.put(TYPE_DRAFTS, true);
|
||||
// TODO: b/11158759
|
||||
// For now, drafts folders are not syncable.
|
||||
//SYNCABLE_TYPES.put(TYPE_DRAFTS, true);
|
||||
SYNCABLE_TYPES.put(TYPE_SENT, true);
|
||||
SYNCABLE_TYPES.put(TYPE_TRASH, false);
|
||||
SYNCABLE_TYPES.put(TYPE_CALENDAR, true);
|
||||
|
@ -192,7 +192,9 @@ public class MailboxSettings extends PreferenceActivity {
|
||||
mSyncEnabledPref.setChecked(mMailbox.mSyncInterval != 0);
|
||||
mSyncLookbackPref.setValue(String.valueOf(mMailbox.mSyncLookback));
|
||||
onDataLoaded();
|
||||
enablePreferences(true);
|
||||
if (mMailbox.mType != Mailbox.TYPE_DRAFTS) {
|
||||
enablePreferences(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -154,8 +154,8 @@ public final class DBHelper {
|
||||
// Version 116: Add MessageMove & MessageStateChange tables.
|
||||
// Version 117: Add trigger to delete duplicate messages on sync.
|
||||
// Version 118: Set syncInterval to 0 for all IMAP mailboxes
|
||||
|
||||
public static final int DATABASE_VERSION = 118;
|
||||
// Version 119: Disable syncing of DRAFTS type folders.
|
||||
public static final int DATABASE_VERSION = 119;
|
||||
|
||||
// Any changes to the database format *must* include update-in-place code.
|
||||
// Original version: 2
|
||||
@ -1211,6 +1211,29 @@ public final class DBHelper {
|
||||
+ mContext.getString(R.string.protocol_imap) + "' or "
|
||||
+ HostAuth.TABLE_NAME + "." + HostAuthColumns.PROTOCOL + "='imap'));");
|
||||
}
|
||||
|
||||
/**
|
||||
* This statement changes the sync interval column to 0 for all DRAFTS type mailboxes,
|
||||
* and deletes any messages that are:
|
||||
* * synced from the server, and
|
||||
* * in an exchange account draft folder
|
||||
*
|
||||
* This is primary for Exchange (b/11158759) but we don't sync draft folders for any
|
||||
* other account type anyway.
|
||||
* This will only affect people who used intermediate builds between email1 and email2,
|
||||
* it should be a no-op for most users.
|
||||
*/
|
||||
if (oldVersion <= 118) {
|
||||
db.execSQL("update " + Mailbox.TABLE_NAME + " set " + MailboxColumns.SYNC_INTERVAL
|
||||
+ "=0 where " + MailboxColumns.TYPE + "=" + Mailbox.TYPE_DRAFTS);
|
||||
|
||||
db.execSQL("delete from " + Message.TABLE_NAME + " where "
|
||||
+ "(" + SyncColumns.SERVER_ID + " not null and "
|
||||
+ SyncColumns.SERVER_ID + "!='') and "
|
||||
+ MessageColumns.MAILBOX_KEY + " in (select "
|
||||
+ MailboxColumns.ID + " from " + Mailbox.TABLE_NAME + " where "
|
||||
+ MailboxColumns.TYPE + "=" + Mailbox.TYPE_DRAFTS + ")");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
Loading…
Reference in New Issue
Block a user