mirror of
https://github.com/moparisthebest/k-9
synced 2024-11-30 13:12:25 -05:00
Always save all headers. Not doing so is kind of a crazy space microoptimization and can get a little messy
This commit is contained in:
parent
20a608e1a0
commit
d5f739030a
@ -152,7 +152,6 @@ public class Account implements BaseAccount {
|
||||
private FolderMode mFolderPushMode;
|
||||
private FolderMode mFolderTargetMode;
|
||||
private int mAccountNumber;
|
||||
private boolean mSaveAllHeaders;
|
||||
private boolean mPushPollOnConnect;
|
||||
private boolean mNotifySync;
|
||||
private SortType mSortType;
|
||||
@ -240,7 +239,6 @@ public class Account implements BaseAccount {
|
||||
mLocalStorageProviderId = StorageManager.getInstance(K9.app).getDefaultProviderId();
|
||||
mAutomaticCheckIntervalMinutes = -1;
|
||||
mIdleRefreshMinutes = 24;
|
||||
mSaveAllHeaders = true;
|
||||
mPushPollOnConnect = true;
|
||||
mDisplayCount = K9.DEFAULT_VISIBLE_LIMIT;
|
||||
mAccountNumber = -1;
|
||||
@ -320,7 +318,6 @@ public class Account implements BaseAccount {
|
||||
mAlwaysBcc = prefs.getString(mUuid + ".alwaysBcc", mAlwaysBcc);
|
||||
mAutomaticCheckIntervalMinutes = prefs.getInt(mUuid + ".automaticCheckIntervalMinutes", -1);
|
||||
mIdleRefreshMinutes = prefs.getInt(mUuid + ".idleRefreshMinutes", 24);
|
||||
mSaveAllHeaders = prefs.getBoolean(mUuid + ".saveAllHeaders", true);
|
||||
mPushPollOnConnect = prefs.getBoolean(mUuid + ".pushPollOnConnect", true);
|
||||
mDisplayCount = prefs.getInt(mUuid + ".displayCount", K9.DEFAULT_VISIBLE_LIMIT);
|
||||
if (mDisplayCount < 0) {
|
||||
@ -478,7 +475,6 @@ public class Account implements BaseAccount {
|
||||
editor.remove(mUuid + ".alwaysBcc");
|
||||
editor.remove(mUuid + ".automaticCheckIntervalMinutes");
|
||||
editor.remove(mUuid + ".pushPollOnConnect");
|
||||
editor.remove(mUuid + ".saveAllHeaders");
|
||||
editor.remove(mUuid + ".idleRefreshMinutes");
|
||||
editor.remove(mUuid + ".lastAutomaticCheckTime");
|
||||
editor.remove(mUuid + ".latestOldMessageSeenTime");
|
||||
@ -638,7 +634,6 @@ public class Account implements BaseAccount {
|
||||
editor.putString(mUuid + ".alwaysBcc", mAlwaysBcc);
|
||||
editor.putInt(mUuid + ".automaticCheckIntervalMinutes", mAutomaticCheckIntervalMinutes);
|
||||
editor.putInt(mUuid + ".idleRefreshMinutes", mIdleRefreshMinutes);
|
||||
editor.putBoolean(mUuid + ".saveAllHeaders", mSaveAllHeaders);
|
||||
editor.putBoolean(mUuid + ".pushPollOnConnect", mPushPollOnConnect);
|
||||
editor.putInt(mUuid + ".displayCount", mDisplayCount);
|
||||
editor.putLong(mUuid + ".lastAutomaticCheckTime", mLastAutomaticCheckTime);
|
||||
@ -1397,14 +1392,6 @@ public class Account implements BaseAccount {
|
||||
mPushPollOnConnect = pushPollOnConnect;
|
||||
}
|
||||
|
||||
public synchronized boolean saveAllHeaders() {
|
||||
return mSaveAllHeaders;
|
||||
}
|
||||
|
||||
public synchronized void setSaveAllHeaders(boolean saveAllHeaders) {
|
||||
mSaveAllHeaders = saveAllHeaders;
|
||||
}
|
||||
|
||||
/**
|
||||
* Are we storing out localStore on the SD-card instead of the local device
|
||||
* memory?<br/>
|
||||
|
@ -156,7 +156,6 @@ public class AccountSettings extends K9PreferenceActivity {
|
||||
private CheckBoxPreference mReplyAfterQuote;
|
||||
private CheckBoxPreference mStripSignature;
|
||||
private CheckBoxPreference mSyncRemoteDeletions;
|
||||
private CheckBoxPreference mSaveAllHeaders;
|
||||
private CheckBoxPreference mPushPollOnConnect;
|
||||
private ListPreference mIdleRefreshPeriod;
|
||||
private ListPreference mMaxPushFolders;
|
||||
@ -366,9 +365,6 @@ public class AccountSettings extends K9PreferenceActivity {
|
||||
mSyncRemoteDeletions = (CheckBoxPreference) findPreference(PREFERENCE_SYNC_REMOTE_DELETIONS);
|
||||
mSyncRemoteDeletions.setChecked(mAccount.syncRemoteDeletions());
|
||||
|
||||
mSaveAllHeaders = (CheckBoxPreference) findPreference(PREFERENCE_SAVE_ALL_HEADERS);
|
||||
mSaveAllHeaders.setChecked(mAccount.saveAllHeaders());
|
||||
|
||||
mSearchableFolders = (ListPreference) findPreference(PREFERENCE_SEARCHABLE_FOLDERS);
|
||||
mSearchableFolders.setValue(mAccount.getSearchableFolders().name());
|
||||
mSearchableFolders.setSummary(mSearchableFolders.getEntry());
|
||||
@ -720,7 +716,6 @@ public class AccountSettings extends K9PreferenceActivity {
|
||||
mAccount.setExpungePolicy(mExpungePolicy.getValue());
|
||||
}
|
||||
mAccount.setSyncRemoteDeletions(mSyncRemoteDeletions.isChecked());
|
||||
mAccount.setSaveAllHeaders(mSaveAllHeaders.isChecked());
|
||||
mAccount.setSearchableFolders(Account.Searchable.valueOf(mSearchableFolders.getValue()));
|
||||
mAccount.setMessageFormat(Account.MessageFormat.valueOf(mMessageFormat.getValue()));
|
||||
mAccount.setAlwaysShowCcBcc(mAlwaysShowCcBcc.isChecked());
|
||||
|
@ -81,21 +81,6 @@ public class LocalStore extends Store implements Serializable {
|
||||
|
||||
private static final Flag[] PERMANENT_FLAGS = { Flag.DELETED, Flag.X_DESTROYED, Flag.SEEN, Flag.FLAGGED };
|
||||
|
||||
private static final Set<String> HEADERS_TO_SAVE;
|
||||
static {
|
||||
Set<String> set = new HashSet<String>();
|
||||
set.add(K9.IDENTITY_HEADER);
|
||||
set.add("To");
|
||||
set.add("Cc");
|
||||
set.add("From");
|
||||
set.add("In-Reply-To");
|
||||
set.add("References");
|
||||
set.add(MimeHeader.HEADER_CONTENT_ID);
|
||||
set.add(MimeHeader.HEADER_CONTENT_DISPOSITION);
|
||||
set.add("User-Agent");
|
||||
HEADERS_TO_SAVE = Collections.unmodifiableSet(set);
|
||||
}
|
||||
|
||||
/*
|
||||
* a String containing the columns getMessages expects to work with
|
||||
* in the correct order.
|
||||
@ -2314,12 +2299,9 @@ public class LocalStore extends Store implements Serializable {
|
||||
database.execute(true, new DbCallback<Void>() {
|
||||
@Override
|
||||
public Void doDbWork(final SQLiteDatabase db) throws WrappedException, UnavailableStorageException {
|
||||
boolean saveAllHeaders = mAccount.saveAllHeaders();
|
||||
boolean gotAdditionalHeaders = false;
|
||||
|
||||
deleteHeaders(id);
|
||||
for (String name : message.getHeaderNames()) {
|
||||
if (saveAllHeaders || HEADERS_TO_SAVE.contains(name)) {
|
||||
String[] values = message.getHeader(name);
|
||||
for (String value : values) {
|
||||
ContentValues cv = new ContentValues();
|
||||
@ -2328,12 +2310,8 @@ public class LocalStore extends Store implements Serializable {
|
||||
cv.put("value", value);
|
||||
db.insert("headers", "name", cv);
|
||||
}
|
||||
} else {
|
||||
gotAdditionalHeaders = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (!gotAdditionalHeaders) {
|
||||
// Remember that all headers for this message have been saved, so it is
|
||||
// not necessary to download them again in case the user wants to see all headers.
|
||||
List<Flag> appendedFlags = new ArrayList<Flag>();
|
||||
@ -2343,7 +2321,6 @@ public class LocalStore extends Store implements Serializable {
|
||||
db.execSQL("UPDATE messages " + "SET flags = ? " + " WHERE id = ?",
|
||||
new Object[]
|
||||
{ Utility.combine(appendedFlags.toArray(), ',').toUpperCase(Locale.US), id });
|
||||
}
|
||||
return null;
|
||||
}
|
||||
});
|
||||
|
@ -162,9 +162,6 @@ public class AccountSettings {
|
||||
s.put("ringtone", Settings.versions(
|
||||
new V(1, new RingtoneSetting("content://settings/system/notification_sound"))
|
||||
));
|
||||
s.put("saveAllHeaders", Settings.versions(
|
||||
new V(1, new BooleanSetting(true))
|
||||
));
|
||||
s.put("searchableFolders", Settings.versions(
|
||||
new V(1, new EnumSetting(Account.Searchable.class, Account.Searchable.ALL))
|
||||
));
|
||||
|
Loading…
Reference in New Issue
Block a user