2008-11-01 17:32:06 -04:00
|
|
|
|
2008-12-16 18:34:01 -05:00
|
|
|
package com.android.email;
|
2008-11-01 17:32:06 -04:00
|
|
|
|
|
|
|
import java.io.Serializable;
|
2009-06-08 23:11:35 -04:00
|
|
|
import java.util.ArrayList;
|
2008-11-01 17:32:06 -04:00
|
|
|
import java.util.Arrays;
|
2009-06-08 23:11:35 -04:00
|
|
|
import java.util.List;
|
2008-11-01 17:32:06 -04:00
|
|
|
import java.util.UUID;
|
|
|
|
|
2009-02-28 12:40:39 -05:00
|
|
|
import com.android.email.mail.Address;
|
Complete merge of DAmail functionality into K9mail. Following
features are added to K9mail:
1) Show unread message count on each folder
2) Sum unread count of all shown folders in an account to the account display
3) Periodically check selected folders for new mail, not just Inbox
4) Don't refresh folder when opened (unless folder is empty)
5) Show date and time of last sync for each folder
6) Fix timer for automatic periodic sync (use wakelock to assure completion)
7) Optimize local folder queries (speeds up account and folder lists)
8) Show Loading... message in status bar indicating which folder is being synced
9) Eliminate redundant sync of new messages (performance enhancement)
10) Improve notification text for multiple accounts
11) Do not automatically sync folders more often than the account-specific period
12) Use user-configured date and time formats
13) Select which folders are shown, using configurable Classes
14) Select which folders are synced, using configurable Classes
15) Added context (long press) menu to folders, to provide for Refresh
and Folder Settings
16) Status light flashes purple when there are unread messages
17) Folder list more quickly eliminates display of deleted and out-of-Class folders.
18) Delete works
19) Mark all messages as read (in the folder context menu)
20) Notifications only for new unread messages
21) One minute synchronization frequency
22) Deleting an unread message decrements unread counter
23) Notifications work for POP3 accounts
24) Message deletes work for POP3 accounts
25) Explicit errors show in folder list
26) Stack traces saved to folder K9mail-errors
27) Clear pending actions (danger, for emergencies only!)
28) Delete policy in Account settings
29) DNS cache in InetAddress disabled
30) Trapped some crash-causing error conditions
31) Eliminate duplicate copies to Sent folder
32) Prevent crashes due to message listener concurrency
33) Empty Trash
34) Nuclear "Mark all messages as read" (marks all messages as read in
server-side folder, irrespective of which messages have been downloaded)
35) Forward (alternate) to allow forwarding email through other programs
36) Accept text/plain Intents to allow other programs to send email through K9mail
37) Displays Outbox sending status
38) Manual retry of outbox sending when "Refresh"ing Outbox
39) Folder error status is persisted
40) Ability to log to arbitrary file
Fixes K9 issues 11, 23, 24, 65, 69, 71, 79, 81, 82, 83, 87, 101, 104,
107, 120, 148, 154
2008-12-30 22:49:09 -05:00
|
|
|
import com.android.email.mail.Folder;
|
|
|
|
import com.android.email.mail.MessagingException;
|
|
|
|
import com.android.email.mail.Store;
|
|
|
|
import com.android.email.mail.store.LocalStore;
|
|
|
|
import com.android.email.mail.store.LocalStore.LocalFolder;
|
|
|
|
|
|
|
|
import android.app.Application;
|
2008-11-01 17:32:06 -04:00
|
|
|
import android.content.Context;
|
|
|
|
import android.content.SharedPreferences;
|
|
|
|
import android.net.Uri;
|
Complete merge of DAmail functionality into K9mail. Following
features are added to K9mail:
1) Show unread message count on each folder
2) Sum unread count of all shown folders in an account to the account display
3) Periodically check selected folders for new mail, not just Inbox
4) Don't refresh folder when opened (unless folder is empty)
5) Show date and time of last sync for each folder
6) Fix timer for automatic periodic sync (use wakelock to assure completion)
7) Optimize local folder queries (speeds up account and folder lists)
8) Show Loading... message in status bar indicating which folder is being synced
9) Eliminate redundant sync of new messages (performance enhancement)
10) Improve notification text for multiple accounts
11) Do not automatically sync folders more often than the account-specific period
12) Use user-configured date and time formats
13) Select which folders are shown, using configurable Classes
14) Select which folders are synced, using configurable Classes
15) Added context (long press) menu to folders, to provide for Refresh
and Folder Settings
16) Status light flashes purple when there are unread messages
17) Folder list more quickly eliminates display of deleted and out-of-Class folders.
18) Delete works
19) Mark all messages as read (in the folder context menu)
20) Notifications only for new unread messages
21) One minute synchronization frequency
22) Deleting an unread message decrements unread counter
23) Notifications work for POP3 accounts
24) Message deletes work for POP3 accounts
25) Explicit errors show in folder list
26) Stack traces saved to folder K9mail-errors
27) Clear pending actions (danger, for emergencies only!)
28) Delete policy in Account settings
29) DNS cache in InetAddress disabled
30) Trapped some crash-causing error conditions
31) Eliminate duplicate copies to Sent folder
32) Prevent crashes due to message listener concurrency
33) Empty Trash
34) Nuclear "Mark all messages as read" (marks all messages as read in
server-side folder, irrespective of which messages have been downloaded)
35) Forward (alternate) to allow forwarding email through other programs
36) Accept text/plain Intents to allow other programs to send email through K9mail
37) Displays Outbox sending status
38) Manual retry of outbox sending when "Refresh"ing Outbox
39) Folder error status is persisted
40) Ability to log to arbitrary file
Fixes K9 issues 11, 23, 24, 65, 69, 71, 79, 81, 82, 83, 87, 101, 104,
107, 120, 148, 154
2008-12-30 22:49:09 -05:00
|
|
|
import android.util.Log;
|
2008-11-01 17:32:06 -04:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Account stores all of the settings for a single account defined by the user. It is able to save
|
|
|
|
* and delete itself given a Preferences to work with. Each account is defined by a UUID.
|
|
|
|
*/
|
|
|
|
public class Account implements Serializable {
|
|
|
|
public static final int DELETE_POLICY_NEVER = 0;
|
|
|
|
public static final int DELETE_POLICY_7DAYS = 1;
|
|
|
|
public static final int DELETE_POLICY_ON_DELETE = 2;
|
Complete merge of DAmail functionality into K9mail. Following
features are added to K9mail:
1) Show unread message count on each folder
2) Sum unread count of all shown folders in an account to the account display
3) Periodically check selected folders for new mail, not just Inbox
4) Don't refresh folder when opened (unless folder is empty)
5) Show date and time of last sync for each folder
6) Fix timer for automatic periodic sync (use wakelock to assure completion)
7) Optimize local folder queries (speeds up account and folder lists)
8) Show Loading... message in status bar indicating which folder is being synced
9) Eliminate redundant sync of new messages (performance enhancement)
10) Improve notification text for multiple accounts
11) Do not automatically sync folders more often than the account-specific period
12) Use user-configured date and time formats
13) Select which folders are shown, using configurable Classes
14) Select which folders are synced, using configurable Classes
15) Added context (long press) menu to folders, to provide for Refresh
and Folder Settings
16) Status light flashes purple when there are unread messages
17) Folder list more quickly eliminates display of deleted and out-of-Class folders.
18) Delete works
19) Mark all messages as read (in the folder context menu)
20) Notifications only for new unread messages
21) One minute synchronization frequency
22) Deleting an unread message decrements unread counter
23) Notifications work for POP3 accounts
24) Message deletes work for POP3 accounts
25) Explicit errors show in folder list
26) Stack traces saved to folder K9mail-errors
27) Clear pending actions (danger, for emergencies only!)
28) Delete policy in Account settings
29) DNS cache in InetAddress disabled
30) Trapped some crash-causing error conditions
31) Eliminate duplicate copies to Sent folder
32) Prevent crashes due to message listener concurrency
33) Empty Trash
34) Nuclear "Mark all messages as read" (marks all messages as read in
server-side folder, irrespective of which messages have been downloaded)
35) Forward (alternate) to allow forwarding email through other programs
36) Accept text/plain Intents to allow other programs to send email through K9mail
37) Displays Outbox sending status
38) Manual retry of outbox sending when "Refresh"ing Outbox
39) Folder error status is persisted
40) Ability to log to arbitrary file
Fixes K9 issues 11, 23, 24, 65, 69, 71, 79, 81, 82, 83, 87, 101, 104,
107, 120, 148, 154
2008-12-30 22:49:09 -05:00
|
|
|
public static final int DELETE_POLICY_MARK_AS_READ = 3;
|
2008-11-01 17:32:06 -04:00
|
|
|
|
|
|
|
private static final long serialVersionUID = 2975156672298625121L;
|
|
|
|
|
|
|
|
String mUuid;
|
|
|
|
String mStoreUri;
|
|
|
|
String mLocalStoreUri;
|
|
|
|
String mTransportUri;
|
|
|
|
String mDescription;
|
|
|
|
String mAlwaysBcc;
|
|
|
|
int mAutomaticCheckIntervalMinutes;
|
2008-12-11 00:25:59 -05:00
|
|
|
int mDisplayCount;
|
2008-11-01 17:32:06 -04:00
|
|
|
long mLastAutomaticCheckTime;
|
|
|
|
boolean mNotifyNewMail;
|
2009-11-22 14:02:57 -05:00
|
|
|
boolean mNotifySelfNewMail;
|
2008-11-01 17:32:06 -04:00
|
|
|
String mDraftsFolderName;
|
|
|
|
String mSentFolderName;
|
|
|
|
String mTrashFolderName;
|
|
|
|
String mOutboxFolderName;
|
2009-04-08 14:14:52 -04:00
|
|
|
String mAutoExpandFolderName;
|
Complete merge of DAmail functionality into K9mail. Following
features are added to K9mail:
1) Show unread message count on each folder
2) Sum unread count of all shown folders in an account to the account display
3) Periodically check selected folders for new mail, not just Inbox
4) Don't refresh folder when opened (unless folder is empty)
5) Show date and time of last sync for each folder
6) Fix timer for automatic periodic sync (use wakelock to assure completion)
7) Optimize local folder queries (speeds up account and folder lists)
8) Show Loading... message in status bar indicating which folder is being synced
9) Eliminate redundant sync of new messages (performance enhancement)
10) Improve notification text for multiple accounts
11) Do not automatically sync folders more often than the account-specific period
12) Use user-configured date and time formats
13) Select which folders are shown, using configurable Classes
14) Select which folders are synced, using configurable Classes
15) Added context (long press) menu to folders, to provide for Refresh
and Folder Settings
16) Status light flashes purple when there are unread messages
17) Folder list more quickly eliminates display of deleted and out-of-Class folders.
18) Delete works
19) Mark all messages as read (in the folder context menu)
20) Notifications only for new unread messages
21) One minute synchronization frequency
22) Deleting an unread message decrements unread counter
23) Notifications work for POP3 accounts
24) Message deletes work for POP3 accounts
25) Explicit errors show in folder list
26) Stack traces saved to folder K9mail-errors
27) Clear pending actions (danger, for emergencies only!)
28) Delete policy in Account settings
29) DNS cache in InetAddress disabled
30) Trapped some crash-causing error conditions
31) Eliminate duplicate copies to Sent folder
32) Prevent crashes due to message listener concurrency
33) Empty Trash
34) Nuclear "Mark all messages as read" (marks all messages as read in
server-side folder, irrespective of which messages have been downloaded)
35) Forward (alternate) to allow forwarding email through other programs
36) Accept text/plain Intents to allow other programs to send email through K9mail
37) Displays Outbox sending status
38) Manual retry of outbox sending when "Refresh"ing Outbox
39) Folder error status is persisted
40) Ability to log to arbitrary file
Fixes K9 issues 11, 23, 24, 65, 69, 71, 79, 81, 82, 83, 87, 101, 104,
107, 120, 148, 154
2008-12-30 22:49:09 -05:00
|
|
|
FolderMode mFolderDisplayMode;
|
|
|
|
FolderMode mFolderSyncMode;
|
2009-10-21 20:41:06 -04:00
|
|
|
FolderMode mFolderPushMode;
|
2009-03-05 02:32:45 -05:00
|
|
|
FolderMode mFolderTargetMode;
|
2008-11-01 17:32:06 -04:00
|
|
|
int mAccountNumber;
|
|
|
|
boolean mVibrate;
|
|
|
|
String mRingtoneUri;
|
2009-01-18 11:42:55 -05:00
|
|
|
boolean mNotifySync;
|
2009-01-24 13:58:40 -05:00
|
|
|
HideButtons mHideMessageViewButtons;
|
2009-05-17 02:02:02 -04:00
|
|
|
boolean mIsSignatureBeforeQuotedText;
|
2009-06-08 23:11:35 -04:00
|
|
|
List<Identity> identities;
|
2009-05-17 02:02:02 -04:00
|
|
|
|
Complete merge of DAmail functionality into K9mail. Following
features are added to K9mail:
1) Show unread message count on each folder
2) Sum unread count of all shown folders in an account to the account display
3) Periodically check selected folders for new mail, not just Inbox
4) Don't refresh folder when opened (unless folder is empty)
5) Show date and time of last sync for each folder
6) Fix timer for automatic periodic sync (use wakelock to assure completion)
7) Optimize local folder queries (speeds up account and folder lists)
8) Show Loading... message in status bar indicating which folder is being synced
9) Eliminate redundant sync of new messages (performance enhancement)
10) Improve notification text for multiple accounts
11) Do not automatically sync folders more often than the account-specific period
12) Use user-configured date and time formats
13) Select which folders are shown, using configurable Classes
14) Select which folders are synced, using configurable Classes
15) Added context (long press) menu to folders, to provide for Refresh
and Folder Settings
16) Status light flashes purple when there are unread messages
17) Folder list more quickly eliminates display of deleted and out-of-Class folders.
18) Delete works
19) Mark all messages as read (in the folder context menu)
20) Notifications only for new unread messages
21) One minute synchronization frequency
22) Deleting an unread message decrements unread counter
23) Notifications work for POP3 accounts
24) Message deletes work for POP3 accounts
25) Explicit errors show in folder list
26) Stack traces saved to folder K9mail-errors
27) Clear pending actions (danger, for emergencies only!)
28) Delete policy in Account settings
29) DNS cache in InetAddress disabled
30) Trapped some crash-causing error conditions
31) Eliminate duplicate copies to Sent folder
32) Prevent crashes due to message listener concurrency
33) Empty Trash
34) Nuclear "Mark all messages as read" (marks all messages as read in
server-side folder, irrespective of which messages have been downloaded)
35) Forward (alternate) to allow forwarding email through other programs
36) Accept text/plain Intents to allow other programs to send email through K9mail
37) Displays Outbox sending status
38) Manual retry of outbox sending when "Refresh"ing Outbox
39) Folder error status is persisted
40) Ability to log to arbitrary file
Fixes K9 issues 11, 23, 24, 65, 69, 71, 79, 81, 82, 83, 87, 101, 104,
107, 120, 148, 154
2008-12-30 22:49:09 -05:00
|
|
|
public enum FolderMode {
|
2009-10-21 20:41:06 -04:00
|
|
|
NONE, ALL, FIRST_CLASS, FIRST_AND_SECOND_CLASS, NOT_SECOND_CLASS;
|
Complete merge of DAmail functionality into K9mail. Following
features are added to K9mail:
1) Show unread message count on each folder
2) Sum unread count of all shown folders in an account to the account display
3) Periodically check selected folders for new mail, not just Inbox
4) Don't refresh folder when opened (unless folder is empty)
5) Show date and time of last sync for each folder
6) Fix timer for automatic periodic sync (use wakelock to assure completion)
7) Optimize local folder queries (speeds up account and folder lists)
8) Show Loading... message in status bar indicating which folder is being synced
9) Eliminate redundant sync of new messages (performance enhancement)
10) Improve notification text for multiple accounts
11) Do not automatically sync folders more often than the account-specific period
12) Use user-configured date and time formats
13) Select which folders are shown, using configurable Classes
14) Select which folders are synced, using configurable Classes
15) Added context (long press) menu to folders, to provide for Refresh
and Folder Settings
16) Status light flashes purple when there are unread messages
17) Folder list more quickly eliminates display of deleted and out-of-Class folders.
18) Delete works
19) Mark all messages as read (in the folder context menu)
20) Notifications only for new unread messages
21) One minute synchronization frequency
22) Deleting an unread message decrements unread counter
23) Notifications work for POP3 accounts
24) Message deletes work for POP3 accounts
25) Explicit errors show in folder list
26) Stack traces saved to folder K9mail-errors
27) Clear pending actions (danger, for emergencies only!)
28) Delete policy in Account settings
29) DNS cache in InetAddress disabled
30) Trapped some crash-causing error conditions
31) Eliminate duplicate copies to Sent folder
32) Prevent crashes due to message listener concurrency
33) Empty Trash
34) Nuclear "Mark all messages as read" (marks all messages as read in
server-side folder, irrespective of which messages have been downloaded)
35) Forward (alternate) to allow forwarding email through other programs
36) Accept text/plain Intents to allow other programs to send email through K9mail
37) Displays Outbox sending status
38) Manual retry of outbox sending when "Refresh"ing Outbox
39) Folder error status is persisted
40) Ability to log to arbitrary file
Fixes K9 issues 11, 23, 24, 65, 69, 71, 79, 81, 82, 83, 87, 101, 104,
107, 120, 148, 154
2008-12-30 22:49:09 -05:00
|
|
|
}
|
2009-01-24 13:58:40 -05:00
|
|
|
|
|
|
|
public enum HideButtons {
|
|
|
|
NEVER, ALWAYS, KEYBOARD_AVAILABLE;
|
|
|
|
}
|
2008-11-01 17:32:06 -04:00
|
|
|
|
|
|
|
/**
|
|
|
|
* <pre>
|
|
|
|
* 0 Never
|
|
|
|
* 1 After 7 days
|
|
|
|
* 2 When I delete from inbox
|
|
|
|
* </pre>
|
|
|
|
*/
|
|
|
|
int mDeletePolicy;
|
|
|
|
|
|
|
|
public Account(Context context) {
|
|
|
|
// TODO Change local store path to something readable / recognizable
|
|
|
|
mUuid = UUID.randomUUID().toString();
|
|
|
|
mLocalStoreUri = "local://localhost/" + context.getDatabasePath(mUuid + ".db");
|
|
|
|
mAutomaticCheckIntervalMinutes = -1;
|
2008-12-11 00:25:59 -05:00
|
|
|
mDisplayCount = -1;
|
2008-11-01 17:32:06 -04:00
|
|
|
mAccountNumber = -1;
|
|
|
|
mNotifyNewMail = true;
|
2009-01-18 11:42:55 -05:00
|
|
|
mNotifySync = true;
|
2008-11-01 17:32:06 -04:00
|
|
|
mVibrate = false;
|
2009-11-22 14:02:57 -05:00
|
|
|
mNotifySelfNewMail = true;
|
2009-01-02 20:47:24 -05:00
|
|
|
mFolderDisplayMode = FolderMode.NOT_SECOND_CLASS;
|
|
|
|
mFolderSyncMode = FolderMode.FIRST_CLASS;
|
2009-10-21 20:41:06 -04:00
|
|
|
mFolderPushMode = FolderMode.FIRST_CLASS;
|
2009-03-05 02:32:45 -05:00
|
|
|
mFolderTargetMode = FolderMode.NOT_SECOND_CLASS;
|
2009-01-24 13:58:40 -05:00
|
|
|
mHideMessageViewButtons = HideButtons.NEVER;
|
2008-11-01 17:32:06 -04:00
|
|
|
mRingtoneUri = "content://settings/system/notification_sound";
|
2009-05-17 02:02:02 -04:00
|
|
|
mIsSignatureBeforeQuotedText = false;
|
2009-11-14 20:12:26 -05:00
|
|
|
|
|
|
|
mAutoExpandFolderName = "INBOX";
|
2009-06-08 23:11:35 -04:00
|
|
|
|
|
|
|
identities = new ArrayList<Identity>();
|
|
|
|
|
|
|
|
Identity identity = new Identity();
|
|
|
|
identity.setSignature(context.getString(R.string.default_signature));
|
|
|
|
identity.setDescription(context.getString(R.string.default_identity_description));
|
|
|
|
identities.add(identity);
|
|
|
|
}
|
|
|
|
|
|
|
|
public class Identity implements Serializable
|
|
|
|
{
|
|
|
|
String mDescription;
|
|
|
|
String mName;
|
|
|
|
String mEmail;
|
|
|
|
String mSignature;
|
|
|
|
public String getName()
|
|
|
|
{
|
|
|
|
return mName;
|
|
|
|
}
|
|
|
|
public void setName(String name)
|
|
|
|
{
|
|
|
|
mName = name;
|
|
|
|
}
|
|
|
|
public String getEmail()
|
|
|
|
{
|
|
|
|
return mEmail;
|
|
|
|
}
|
|
|
|
public void setEmail(String email)
|
|
|
|
{
|
|
|
|
mEmail = email;
|
|
|
|
}
|
|
|
|
public String getSignature()
|
|
|
|
{
|
|
|
|
return mSignature;
|
|
|
|
}
|
|
|
|
public void setSignature(String signature)
|
|
|
|
{
|
|
|
|
mSignature = signature;
|
|
|
|
}
|
|
|
|
public String getDescription()
|
|
|
|
{
|
|
|
|
return mDescription;
|
|
|
|
}
|
|
|
|
public void setDescription(String description)
|
|
|
|
{
|
|
|
|
mDescription = description;
|
|
|
|
}
|
|
|
|
public String toString()
|
|
|
|
{
|
|
|
|
return "Account.Identity(description=" + mDescription + ", name=" + mName + ", email=" + mEmail + ", signature=" + mSignature;
|
|
|
|
}
|
2008-11-01 17:32:06 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
Account(Preferences preferences, String uuid) {
|
|
|
|
this.mUuid = uuid;
|
|
|
|
refresh(preferences);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Refresh the account from the stored settings.
|
|
|
|
*/
|
|
|
|
public void refresh(Preferences preferences) {
|
2009-04-11 10:33:54 -04:00
|
|
|
mStoreUri = Utility.base64Decode(preferences.getPreferences().getString(mUuid
|
2008-11-01 17:32:06 -04:00
|
|
|
+ ".storeUri", null));
|
2009-04-11 10:33:54 -04:00
|
|
|
mLocalStoreUri = preferences.getPreferences().getString(mUuid + ".localStoreUri", null);
|
|
|
|
mTransportUri = Utility.base64Decode(preferences.getPreferences().getString(mUuid
|
2008-11-01 17:32:06 -04:00
|
|
|
+ ".transportUri", null));
|
2009-04-11 10:33:54 -04:00
|
|
|
mDescription = preferences.getPreferences().getString(mUuid + ".description", null);
|
|
|
|
mAlwaysBcc = preferences.getPreferences().getString(mUuid + ".alwaysBcc", mAlwaysBcc);
|
|
|
|
mAutomaticCheckIntervalMinutes = preferences.getPreferences().getInt(mUuid
|
2008-11-01 17:32:06 -04:00
|
|
|
+ ".automaticCheckIntervalMinutes", -1);
|
2009-04-11 10:33:54 -04:00
|
|
|
mDisplayCount = preferences.getPreferences().getInt(mUuid + ".displayCount", -1);
|
|
|
|
mLastAutomaticCheckTime = preferences.getPreferences().getLong(mUuid
|
2008-11-01 17:32:06 -04:00
|
|
|
+ ".lastAutomaticCheckTime", 0);
|
2009-04-11 10:33:54 -04:00
|
|
|
mNotifyNewMail = preferences.getPreferences().getBoolean(mUuid + ".notifyNewMail",
|
2008-11-01 17:32:06 -04:00
|
|
|
false);
|
2009-11-22 14:42:44 -05:00
|
|
|
mNotifySelfNewMail = preferences.getPreferences().getBoolean(mUuid + ".notifySelfNewMail",
|
|
|
|
true);
|
2009-04-11 10:33:54 -04:00
|
|
|
mNotifySync = preferences.getPreferences().getBoolean(mUuid + ".notifyMailCheck",
|
2009-01-18 11:42:55 -05:00
|
|
|
false);
|
2009-04-11 10:33:54 -04:00
|
|
|
mDeletePolicy = preferences.getPreferences().getInt(mUuid + ".deletePolicy", 0);
|
|
|
|
mDraftsFolderName = preferences.getPreferences().getString(mUuid + ".draftsFolderName",
|
2008-11-01 17:32:06 -04:00
|
|
|
"Drafts");
|
2009-04-11 10:33:54 -04:00
|
|
|
mSentFolderName = preferences.getPreferences().getString(mUuid + ".sentFolderName",
|
2008-11-01 17:32:06 -04:00
|
|
|
"Sent");
|
2009-04-11 10:33:54 -04:00
|
|
|
mTrashFolderName = preferences.getPreferences().getString(mUuid + ".trashFolderName",
|
2008-11-01 17:32:06 -04:00
|
|
|
"Trash");
|
2009-04-11 10:33:54 -04:00
|
|
|
mOutboxFolderName = preferences.getPreferences().getString(mUuid + ".outboxFolderName",
|
2008-11-01 17:32:06 -04:00
|
|
|
"Outbox");
|
2009-04-11 10:33:54 -04:00
|
|
|
|
2009-04-10 21:26:44 -04:00
|
|
|
// Between r418 and r431 (version 0.103), folder names were set empty if the Incoming settings were
|
|
|
|
// opened for non-IMAP accounts. 0.103 was never a market release, so perhaps this code
|
|
|
|
// should be deleted sometime soon
|
|
|
|
if (mDraftsFolderName == null || mDraftsFolderName.equals(""))
|
|
|
|
{
|
|
|
|
mDraftsFolderName = "Drafts";
|
|
|
|
}
|
|
|
|
if (mSentFolderName == null || mSentFolderName.equals(""))
|
|
|
|
{
|
|
|
|
mSentFolderName = "Sent";
|
|
|
|
}
|
|
|
|
if (mTrashFolderName == null || mTrashFolderName.equals(""))
|
|
|
|
{
|
|
|
|
mTrashFolderName = "Trash";
|
|
|
|
}
|
|
|
|
if (mOutboxFolderName == null || mOutboxFolderName.equals(""))
|
|
|
|
{
|
|
|
|
mOutboxFolderName = "Outbox";
|
|
|
|
}
|
|
|
|
// End of 0.103 repair
|
|
|
|
|
2009-04-11 10:33:54 -04:00
|
|
|
mAutoExpandFolderName = preferences.getPreferences().getString(mUuid + ".autoExpandFolderName",
|
2009-05-04 20:24:18 -04:00
|
|
|
"INBOX");
|
2009-04-11 10:33:54 -04:00
|
|
|
|
|
|
|
mAccountNumber = preferences.getPreferences().getInt(mUuid + ".accountNumber", 0);
|
|
|
|
mVibrate = preferences.getPreferences().getBoolean(mUuid + ".vibrate", false);
|
2009-01-24 13:58:40 -05:00
|
|
|
|
|
|
|
try
|
|
|
|
{
|
2009-04-11 10:33:54 -04:00
|
|
|
mHideMessageViewButtons = HideButtons.valueOf(preferences.getPreferences().getString(mUuid + ".hideButtonsEnum",
|
2009-01-24 13:58:40 -05:00
|
|
|
HideButtons.NEVER.name()));
|
|
|
|
}
|
|
|
|
catch (Exception e)
|
|
|
|
{
|
|
|
|
mHideMessageViewButtons = HideButtons.NEVER;
|
|
|
|
}
|
|
|
|
|
2009-04-11 10:33:54 -04:00
|
|
|
mRingtoneUri = preferences.getPreferences().getString(mUuid + ".ringtone",
|
2008-11-01 17:32:06 -04:00
|
|
|
"content://settings/system/notification_sound");
|
Complete merge of DAmail functionality into K9mail. Following
features are added to K9mail:
1) Show unread message count on each folder
2) Sum unread count of all shown folders in an account to the account display
3) Periodically check selected folders for new mail, not just Inbox
4) Don't refresh folder when opened (unless folder is empty)
5) Show date and time of last sync for each folder
6) Fix timer for automatic periodic sync (use wakelock to assure completion)
7) Optimize local folder queries (speeds up account and folder lists)
8) Show Loading... message in status bar indicating which folder is being synced
9) Eliminate redundant sync of new messages (performance enhancement)
10) Improve notification text for multiple accounts
11) Do not automatically sync folders more often than the account-specific period
12) Use user-configured date and time formats
13) Select which folders are shown, using configurable Classes
14) Select which folders are synced, using configurable Classes
15) Added context (long press) menu to folders, to provide for Refresh
and Folder Settings
16) Status light flashes purple when there are unread messages
17) Folder list more quickly eliminates display of deleted and out-of-Class folders.
18) Delete works
19) Mark all messages as read (in the folder context menu)
20) Notifications only for new unread messages
21) One minute synchronization frequency
22) Deleting an unread message decrements unread counter
23) Notifications work for POP3 accounts
24) Message deletes work for POP3 accounts
25) Explicit errors show in folder list
26) Stack traces saved to folder K9mail-errors
27) Clear pending actions (danger, for emergencies only!)
28) Delete policy in Account settings
29) DNS cache in InetAddress disabled
30) Trapped some crash-causing error conditions
31) Eliminate duplicate copies to Sent folder
32) Prevent crashes due to message listener concurrency
33) Empty Trash
34) Nuclear "Mark all messages as read" (marks all messages as read in
server-side folder, irrespective of which messages have been downloaded)
35) Forward (alternate) to allow forwarding email through other programs
36) Accept text/plain Intents to allow other programs to send email through K9mail
37) Displays Outbox sending status
38) Manual retry of outbox sending when "Refresh"ing Outbox
39) Folder error status is persisted
40) Ability to log to arbitrary file
Fixes K9 issues 11, 23, 24, 65, 69, 71, 79, 81, 82, 83, 87, 101, 104,
107, 120, 148, 154
2008-12-30 22:49:09 -05:00
|
|
|
try
|
|
|
|
{
|
2009-04-11 10:33:54 -04:00
|
|
|
mFolderDisplayMode = FolderMode.valueOf(preferences.getPreferences().getString(mUuid + ".folderDisplayMode",
|
Complete merge of DAmail functionality into K9mail. Following
features are added to K9mail:
1) Show unread message count on each folder
2) Sum unread count of all shown folders in an account to the account display
3) Periodically check selected folders for new mail, not just Inbox
4) Don't refresh folder when opened (unless folder is empty)
5) Show date and time of last sync for each folder
6) Fix timer for automatic periodic sync (use wakelock to assure completion)
7) Optimize local folder queries (speeds up account and folder lists)
8) Show Loading... message in status bar indicating which folder is being synced
9) Eliminate redundant sync of new messages (performance enhancement)
10) Improve notification text for multiple accounts
11) Do not automatically sync folders more often than the account-specific period
12) Use user-configured date and time formats
13) Select which folders are shown, using configurable Classes
14) Select which folders are synced, using configurable Classes
15) Added context (long press) menu to folders, to provide for Refresh
and Folder Settings
16) Status light flashes purple when there are unread messages
17) Folder list more quickly eliminates display of deleted and out-of-Class folders.
18) Delete works
19) Mark all messages as read (in the folder context menu)
20) Notifications only for new unread messages
21) One minute synchronization frequency
22) Deleting an unread message decrements unread counter
23) Notifications work for POP3 accounts
24) Message deletes work for POP3 accounts
25) Explicit errors show in folder list
26) Stack traces saved to folder K9mail-errors
27) Clear pending actions (danger, for emergencies only!)
28) Delete policy in Account settings
29) DNS cache in InetAddress disabled
30) Trapped some crash-causing error conditions
31) Eliminate duplicate copies to Sent folder
32) Prevent crashes due to message listener concurrency
33) Empty Trash
34) Nuclear "Mark all messages as read" (marks all messages as read in
server-side folder, irrespective of which messages have been downloaded)
35) Forward (alternate) to allow forwarding email through other programs
36) Accept text/plain Intents to allow other programs to send email through K9mail
37) Displays Outbox sending status
38) Manual retry of outbox sending when "Refresh"ing Outbox
39) Folder error status is persisted
40) Ability to log to arbitrary file
Fixes K9 issues 11, 23, 24, 65, 69, 71, 79, 81, 82, 83, 87, 101, 104,
107, 120, 148, 154
2008-12-30 22:49:09 -05:00
|
|
|
FolderMode.NOT_SECOND_CLASS.name()));
|
|
|
|
}
|
|
|
|
catch (Exception e)
|
|
|
|
{
|
2009-01-02 20:47:24 -05:00
|
|
|
mFolderDisplayMode = FolderMode.NOT_SECOND_CLASS;
|
Complete merge of DAmail functionality into K9mail. Following
features are added to K9mail:
1) Show unread message count on each folder
2) Sum unread count of all shown folders in an account to the account display
3) Periodically check selected folders for new mail, not just Inbox
4) Don't refresh folder when opened (unless folder is empty)
5) Show date and time of last sync for each folder
6) Fix timer for automatic periodic sync (use wakelock to assure completion)
7) Optimize local folder queries (speeds up account and folder lists)
8) Show Loading... message in status bar indicating which folder is being synced
9) Eliminate redundant sync of new messages (performance enhancement)
10) Improve notification text for multiple accounts
11) Do not automatically sync folders more often than the account-specific period
12) Use user-configured date and time formats
13) Select which folders are shown, using configurable Classes
14) Select which folders are synced, using configurable Classes
15) Added context (long press) menu to folders, to provide for Refresh
and Folder Settings
16) Status light flashes purple when there are unread messages
17) Folder list more quickly eliminates display of deleted and out-of-Class folders.
18) Delete works
19) Mark all messages as read (in the folder context menu)
20) Notifications only for new unread messages
21) One minute synchronization frequency
22) Deleting an unread message decrements unread counter
23) Notifications work for POP3 accounts
24) Message deletes work for POP3 accounts
25) Explicit errors show in folder list
26) Stack traces saved to folder K9mail-errors
27) Clear pending actions (danger, for emergencies only!)
28) Delete policy in Account settings
29) DNS cache in InetAddress disabled
30) Trapped some crash-causing error conditions
31) Eliminate duplicate copies to Sent folder
32) Prevent crashes due to message listener concurrency
33) Empty Trash
34) Nuclear "Mark all messages as read" (marks all messages as read in
server-side folder, irrespective of which messages have been downloaded)
35) Forward (alternate) to allow forwarding email through other programs
36) Accept text/plain Intents to allow other programs to send email through K9mail
37) Displays Outbox sending status
38) Manual retry of outbox sending when "Refresh"ing Outbox
39) Folder error status is persisted
40) Ability to log to arbitrary file
Fixes K9 issues 11, 23, 24, 65, 69, 71, 79, 81, 82, 83, 87, 101, 104,
107, 120, 148, 154
2008-12-30 22:49:09 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
try
|
|
|
|
{
|
2009-04-11 10:33:54 -04:00
|
|
|
mFolderSyncMode = FolderMode.valueOf(preferences.getPreferences().getString(mUuid + ".folderSyncMode",
|
Complete merge of DAmail functionality into K9mail. Following
features are added to K9mail:
1) Show unread message count on each folder
2) Sum unread count of all shown folders in an account to the account display
3) Periodically check selected folders for new mail, not just Inbox
4) Don't refresh folder when opened (unless folder is empty)
5) Show date and time of last sync for each folder
6) Fix timer for automatic periodic sync (use wakelock to assure completion)
7) Optimize local folder queries (speeds up account and folder lists)
8) Show Loading... message in status bar indicating which folder is being synced
9) Eliminate redundant sync of new messages (performance enhancement)
10) Improve notification text for multiple accounts
11) Do not automatically sync folders more often than the account-specific period
12) Use user-configured date and time formats
13) Select which folders are shown, using configurable Classes
14) Select which folders are synced, using configurable Classes
15) Added context (long press) menu to folders, to provide for Refresh
and Folder Settings
16) Status light flashes purple when there are unread messages
17) Folder list more quickly eliminates display of deleted and out-of-Class folders.
18) Delete works
19) Mark all messages as read (in the folder context menu)
20) Notifications only for new unread messages
21) One minute synchronization frequency
22) Deleting an unread message decrements unread counter
23) Notifications work for POP3 accounts
24) Message deletes work for POP3 accounts
25) Explicit errors show in folder list
26) Stack traces saved to folder K9mail-errors
27) Clear pending actions (danger, for emergencies only!)
28) Delete policy in Account settings
29) DNS cache in InetAddress disabled
30) Trapped some crash-causing error conditions
31) Eliminate duplicate copies to Sent folder
32) Prevent crashes due to message listener concurrency
33) Empty Trash
34) Nuclear "Mark all messages as read" (marks all messages as read in
server-side folder, irrespective of which messages have been downloaded)
35) Forward (alternate) to allow forwarding email through other programs
36) Accept text/plain Intents to allow other programs to send email through K9mail
37) Displays Outbox sending status
38) Manual retry of outbox sending when "Refresh"ing Outbox
39) Folder error status is persisted
40) Ability to log to arbitrary file
Fixes K9 issues 11, 23, 24, 65, 69, 71, 79, 81, 82, 83, 87, 101, 104,
107, 120, 148, 154
2008-12-30 22:49:09 -05:00
|
|
|
FolderMode.FIRST_CLASS.name()));
|
|
|
|
}
|
|
|
|
catch (Exception e)
|
|
|
|
{
|
2009-01-02 20:47:24 -05:00
|
|
|
mFolderSyncMode = FolderMode.FIRST_CLASS;
|
Complete merge of DAmail functionality into K9mail. Following
features are added to K9mail:
1) Show unread message count on each folder
2) Sum unread count of all shown folders in an account to the account display
3) Periodically check selected folders for new mail, not just Inbox
4) Don't refresh folder when opened (unless folder is empty)
5) Show date and time of last sync for each folder
6) Fix timer for automatic periodic sync (use wakelock to assure completion)
7) Optimize local folder queries (speeds up account and folder lists)
8) Show Loading... message in status bar indicating which folder is being synced
9) Eliminate redundant sync of new messages (performance enhancement)
10) Improve notification text for multiple accounts
11) Do not automatically sync folders more often than the account-specific period
12) Use user-configured date and time formats
13) Select which folders are shown, using configurable Classes
14) Select which folders are synced, using configurable Classes
15) Added context (long press) menu to folders, to provide for Refresh
and Folder Settings
16) Status light flashes purple when there are unread messages
17) Folder list more quickly eliminates display of deleted and out-of-Class folders.
18) Delete works
19) Mark all messages as read (in the folder context menu)
20) Notifications only for new unread messages
21) One minute synchronization frequency
22) Deleting an unread message decrements unread counter
23) Notifications work for POP3 accounts
24) Message deletes work for POP3 accounts
25) Explicit errors show in folder list
26) Stack traces saved to folder K9mail-errors
27) Clear pending actions (danger, for emergencies only!)
28) Delete policy in Account settings
29) DNS cache in InetAddress disabled
30) Trapped some crash-causing error conditions
31) Eliminate duplicate copies to Sent folder
32) Prevent crashes due to message listener concurrency
33) Empty Trash
34) Nuclear "Mark all messages as read" (marks all messages as read in
server-side folder, irrespective of which messages have been downloaded)
35) Forward (alternate) to allow forwarding email through other programs
36) Accept text/plain Intents to allow other programs to send email through K9mail
37) Displays Outbox sending status
38) Manual retry of outbox sending when "Refresh"ing Outbox
39) Folder error status is persisted
40) Ability to log to arbitrary file
Fixes K9 issues 11, 23, 24, 65, 69, 71, 79, 81, 82, 83, 87, 101, 104,
107, 120, 148, 154
2008-12-30 22:49:09 -05:00
|
|
|
}
|
2009-03-05 02:32:45 -05:00
|
|
|
|
2009-10-21 20:41:06 -04:00
|
|
|
try
|
|
|
|
{
|
|
|
|
mFolderPushMode = FolderMode.valueOf(preferences.getPreferences().getString(mUuid + ".folderPushMode",
|
|
|
|
FolderMode.FIRST_CLASS.name()));
|
|
|
|
}
|
|
|
|
catch (Exception e)
|
|
|
|
{
|
|
|
|
mFolderPushMode = FolderMode.FIRST_CLASS;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2009-03-05 02:32:45 -05:00
|
|
|
try
|
|
|
|
{
|
2009-04-11 10:33:54 -04:00
|
|
|
mFolderTargetMode = FolderMode.valueOf(preferences.getPreferences().getString(mUuid + ".folderTargetMode",
|
2009-03-05 02:32:45 -05:00
|
|
|
FolderMode.NOT_SECOND_CLASS.name()));
|
|
|
|
}
|
|
|
|
catch (Exception e)
|
|
|
|
{
|
|
|
|
mFolderTargetMode = FolderMode.NOT_SECOND_CLASS;
|
|
|
|
}
|
Complete merge of DAmail functionality into K9mail. Following
features are added to K9mail:
1) Show unread message count on each folder
2) Sum unread count of all shown folders in an account to the account display
3) Periodically check selected folders for new mail, not just Inbox
4) Don't refresh folder when opened (unless folder is empty)
5) Show date and time of last sync for each folder
6) Fix timer for automatic periodic sync (use wakelock to assure completion)
7) Optimize local folder queries (speeds up account and folder lists)
8) Show Loading... message in status bar indicating which folder is being synced
9) Eliminate redundant sync of new messages (performance enhancement)
10) Improve notification text for multiple accounts
11) Do not automatically sync folders more often than the account-specific period
12) Use user-configured date and time formats
13) Select which folders are shown, using configurable Classes
14) Select which folders are synced, using configurable Classes
15) Added context (long press) menu to folders, to provide for Refresh
and Folder Settings
16) Status light flashes purple when there are unread messages
17) Folder list more quickly eliminates display of deleted and out-of-Class folders.
18) Delete works
19) Mark all messages as read (in the folder context menu)
20) Notifications only for new unread messages
21) One minute synchronization frequency
22) Deleting an unread message decrements unread counter
23) Notifications work for POP3 accounts
24) Message deletes work for POP3 accounts
25) Explicit errors show in folder list
26) Stack traces saved to folder K9mail-errors
27) Clear pending actions (danger, for emergencies only!)
28) Delete policy in Account settings
29) DNS cache in InetAddress disabled
30) Trapped some crash-causing error conditions
31) Eliminate duplicate copies to Sent folder
32) Prevent crashes due to message listener concurrency
33) Empty Trash
34) Nuclear "Mark all messages as read" (marks all messages as read in
server-side folder, irrespective of which messages have been downloaded)
35) Forward (alternate) to allow forwarding email through other programs
36) Accept text/plain Intents to allow other programs to send email through K9mail
37) Displays Outbox sending status
38) Manual retry of outbox sending when "Refresh"ing Outbox
39) Folder error status is persisted
40) Ability to log to arbitrary file
Fixes K9 issues 11, 23, 24, 65, 69, 71, 79, 81, 82, 83, 87, 101, 104,
107, 120, 148, 154
2008-12-30 22:49:09 -05:00
|
|
|
|
2009-05-17 02:02:02 -04:00
|
|
|
mIsSignatureBeforeQuotedText = preferences.getPreferences().getBoolean(mUuid + ".signatureBeforeQuotedText", false);
|
2009-06-08 23:11:35 -04:00
|
|
|
identities = loadIdentities(preferences.getPreferences());
|
|
|
|
}
|
|
|
|
|
|
|
|
private List<Identity> loadIdentities(SharedPreferences prefs)
|
|
|
|
{
|
|
|
|
List<Identity> newIdentities = new ArrayList<Identity>();
|
|
|
|
int ident = 0;
|
|
|
|
boolean gotOne = false;
|
|
|
|
do
|
|
|
|
{
|
|
|
|
gotOne = false;
|
|
|
|
String name = prefs.getString(mUuid + ".name." + ident, null);
|
|
|
|
String email = prefs.getString(mUuid + ".email." + ident, null);
|
|
|
|
String signature = prefs.getString(mUuid + ".signature." + ident, null);
|
|
|
|
String description = prefs.getString(mUuid + ".description." + ident, null);
|
|
|
|
if (email != null)
|
|
|
|
{
|
|
|
|
Identity identity = new Identity();
|
|
|
|
identity.setName(name);
|
|
|
|
identity.setEmail(email);
|
|
|
|
identity.setSignature(signature);
|
|
|
|
identity.setDescription(description);
|
|
|
|
newIdentities.add(identity);
|
|
|
|
gotOne = true;
|
|
|
|
}
|
|
|
|
ident++;
|
|
|
|
} while (gotOne);
|
|
|
|
|
|
|
|
if (newIdentities.size() == 0)
|
|
|
|
{
|
|
|
|
String name = prefs.getString(mUuid + ".name", null);
|
|
|
|
String email = prefs.getString(mUuid + ".email", null);
|
|
|
|
String signature = prefs.getString(mUuid + ".signature", null);
|
|
|
|
Identity identity = new Identity();
|
|
|
|
identity.setName(name);
|
|
|
|
identity.setEmail(email);
|
|
|
|
identity.setSignature(signature);
|
|
|
|
identity.setDescription(email);
|
|
|
|
newIdentities.add(identity);
|
|
|
|
}
|
|
|
|
|
|
|
|
return newIdentities;
|
|
|
|
}
|
|
|
|
|
|
|
|
private void deleteIdentities(SharedPreferences prefs, SharedPreferences.Editor editor)
|
|
|
|
{
|
|
|
|
int ident = 0;
|
|
|
|
boolean gotOne = false;
|
|
|
|
do
|
|
|
|
{
|
|
|
|
gotOne = false;
|
|
|
|
String email = prefs.getString(mUuid + ".email." + ident, null);
|
|
|
|
if (email != null)
|
|
|
|
{
|
|
|
|
editor.remove(mUuid + ".name." + ident);
|
|
|
|
editor.remove(mUuid + ".email." + ident);
|
|
|
|
editor.remove(mUuid + ".signature." + ident);
|
|
|
|
editor.remove(mUuid + ".description." + ident);
|
|
|
|
gotOne = true;
|
|
|
|
}
|
|
|
|
ident++;
|
|
|
|
} while (gotOne);
|
|
|
|
}
|
|
|
|
|
|
|
|
private void saveIdentities(SharedPreferences prefs, SharedPreferences.Editor editor)
|
|
|
|
{
|
|
|
|
deleteIdentities(prefs, editor);
|
|
|
|
int ident = 0;
|
|
|
|
|
|
|
|
for (Identity identity : identities)
|
|
|
|
{
|
|
|
|
editor.putString(mUuid + ".name." + ident, identity.getName());
|
|
|
|
editor.putString(mUuid + ".email." + ident, identity.getEmail());
|
|
|
|
editor.putString(mUuid + ".signature." + ident, identity.getSignature());
|
|
|
|
editor.putString(mUuid + ".description." + ident, identity.getDescription());
|
|
|
|
ident++;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
public List<Identity> getIdentities()
|
|
|
|
{
|
|
|
|
return identities;
|
|
|
|
}
|
|
|
|
|
|
|
|
public void setIdentities(List<Identity> newIdentities)
|
|
|
|
{
|
|
|
|
identities = newIdentities;
|
2008-11-01 17:32:06 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
public String getUuid() {
|
|
|
|
return mUuid;
|
|
|
|
}
|
|
|
|
|
|
|
|
public String getStoreUri() {
|
|
|
|
return mStoreUri;
|
|
|
|
}
|
|
|
|
|
|
|
|
public void setStoreUri(String storeUri) {
|
|
|
|
this.mStoreUri = storeUri;
|
|
|
|
}
|
|
|
|
|
|
|
|
public String getTransportUri() {
|
|
|
|
return mTransportUri;
|
|
|
|
}
|
|
|
|
|
|
|
|
public void setTransportUri(String transportUri) {
|
|
|
|
this.mTransportUri = transportUri;
|
|
|
|
}
|
|
|
|
|
|
|
|
public String getDescription() {
|
|
|
|
return mDescription;
|
|
|
|
}
|
|
|
|
|
|
|
|
public void setDescription(String description) {
|
|
|
|
this.mDescription = description;
|
|
|
|
}
|
|
|
|
|
|
|
|
public String getName() {
|
2009-06-08 23:11:35 -04:00
|
|
|
return identities.get(0).getName();
|
2008-11-01 17:32:06 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
public void setName(String name) {
|
2009-06-08 23:11:35 -04:00
|
|
|
identities.get(0).setName(name);
|
2008-11-01 17:32:06 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
public String getSignature() {
|
2009-06-08 23:11:35 -04:00
|
|
|
return identities.get(0).getSignature();
|
2008-11-01 17:32:06 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
public void setSignature(String signature) {
|
2009-06-08 23:11:35 -04:00
|
|
|
identities.get(0).setSignature(signature);
|
2008-11-01 17:32:06 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
public String getEmail() {
|
2009-06-08 23:11:35 -04:00
|
|
|
return identities.get(0).getEmail();
|
2008-11-01 17:32:06 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
public void setEmail(String email) {
|
2009-06-08 23:11:35 -04:00
|
|
|
identities.get(0).setEmail(email);
|
2008-11-01 17:32:06 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
public String getAlwaysBcc() {
|
|
|
|
return mAlwaysBcc;
|
|
|
|
}
|
|
|
|
|
|
|
|
public void setAlwaysBcc(String alwaysBcc) {
|
|
|
|
this.mAlwaysBcc = alwaysBcc;
|
|
|
|
}
|
|
|
|
|
2009-06-08 23:11:35 -04:00
|
|
|
public Identity getIdentity(int i)
|
|
|
|
{
|
|
|
|
if (i < identities.size())
|
|
|
|
{
|
|
|
|
return identities.get(i);
|
|
|
|
}
|
|
|
|
return null;
|
|
|
|
}
|
2008-11-01 17:32:06 -04:00
|
|
|
|
|
|
|
public boolean isVibrate() {
|
|
|
|
return mVibrate;
|
|
|
|
}
|
|
|
|
|
|
|
|
public void setVibrate(boolean vibrate) {
|
|
|
|
mVibrate = vibrate;
|
|
|
|
}
|
|
|
|
|
|
|
|
public String getRingtone() {
|
|
|
|
return mRingtoneUri;
|
|
|
|
}
|
|
|
|
|
|
|
|
public void setRingtone(String ringtoneUri) {
|
|
|
|
mRingtoneUri = ringtoneUri;
|
|
|
|
}
|
|
|
|
|
|
|
|
public void delete(Preferences preferences) {
|
2009-04-11 10:33:54 -04:00
|
|
|
String[] uuids = preferences.getPreferences().getString("accountUuids", "").split(",");
|
2008-11-01 17:32:06 -04:00
|
|
|
StringBuffer sb = new StringBuffer();
|
|
|
|
for (int i = 0, length = uuids.length; i < length; i++) {
|
|
|
|
if (!uuids[i].equals(mUuid)) {
|
|
|
|
if (sb.length() > 0) {
|
|
|
|
sb.append(',');
|
|
|
|
}
|
|
|
|
sb.append(uuids[i]);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
String accountUuids = sb.toString();
|
2009-04-11 10:33:54 -04:00
|
|
|
SharedPreferences.Editor editor = preferences.getPreferences().edit();
|
2008-11-01 17:32:06 -04:00
|
|
|
editor.putString("accountUuids", accountUuids);
|
|
|
|
|
|
|
|
editor.remove(mUuid + ".storeUri");
|
|
|
|
editor.remove(mUuid + ".localStoreUri");
|
|
|
|
editor.remove(mUuid + ".transportUri");
|
|
|
|
editor.remove(mUuid + ".description");
|
|
|
|
editor.remove(mUuid + ".name");
|
|
|
|
editor.remove(mUuid + ".email");
|
|
|
|
editor.remove(mUuid + ".alwaysBcc");
|
|
|
|
editor.remove(mUuid + ".automaticCheckIntervalMinutes");
|
|
|
|
editor.remove(mUuid + ".lastAutomaticCheckTime");
|
|
|
|
editor.remove(mUuid + ".notifyNewMail");
|
2009-11-22 14:42:44 -05:00
|
|
|
editor.remove(mUuid + ".notifySelfNewMail");
|
2008-11-01 17:32:06 -04:00
|
|
|
editor.remove(mUuid + ".deletePolicy");
|
|
|
|
editor.remove(mUuid + ".draftsFolderName");
|
|
|
|
editor.remove(mUuid + ".sentFolderName");
|
|
|
|
editor.remove(mUuid + ".trashFolderName");
|
|
|
|
editor.remove(mUuid + ".outboxFolderName");
|
2009-04-08 14:14:52 -04:00
|
|
|
editor.remove(mUuid + ".autoExpandFolderName");
|
2008-11-01 17:32:06 -04:00
|
|
|
editor.remove(mUuid + ".accountNumber");
|
|
|
|
editor.remove(mUuid + ".vibrate");
|
|
|
|
editor.remove(mUuid + ".ringtone");
|
Complete merge of DAmail functionality into K9mail. Following
features are added to K9mail:
1) Show unread message count on each folder
2) Sum unread count of all shown folders in an account to the account display
3) Periodically check selected folders for new mail, not just Inbox
4) Don't refresh folder when opened (unless folder is empty)
5) Show date and time of last sync for each folder
6) Fix timer for automatic periodic sync (use wakelock to assure completion)
7) Optimize local folder queries (speeds up account and folder lists)
8) Show Loading... message in status bar indicating which folder is being synced
9) Eliminate redundant sync of new messages (performance enhancement)
10) Improve notification text for multiple accounts
11) Do not automatically sync folders more often than the account-specific period
12) Use user-configured date and time formats
13) Select which folders are shown, using configurable Classes
14) Select which folders are synced, using configurable Classes
15) Added context (long press) menu to folders, to provide for Refresh
and Folder Settings
16) Status light flashes purple when there are unread messages
17) Folder list more quickly eliminates display of deleted and out-of-Class folders.
18) Delete works
19) Mark all messages as read (in the folder context menu)
20) Notifications only for new unread messages
21) One minute synchronization frequency
22) Deleting an unread message decrements unread counter
23) Notifications work for POP3 accounts
24) Message deletes work for POP3 accounts
25) Explicit errors show in folder list
26) Stack traces saved to folder K9mail-errors
27) Clear pending actions (danger, for emergencies only!)
28) Delete policy in Account settings
29) DNS cache in InetAddress disabled
30) Trapped some crash-causing error conditions
31) Eliminate duplicate copies to Sent folder
32) Prevent crashes due to message listener concurrency
33) Empty Trash
34) Nuclear "Mark all messages as read" (marks all messages as read in
server-side folder, irrespective of which messages have been downloaded)
35) Forward (alternate) to allow forwarding email through other programs
36) Accept text/plain Intents to allow other programs to send email through K9mail
37) Displays Outbox sending status
38) Manual retry of outbox sending when "Refresh"ing Outbox
39) Folder error status is persisted
40) Ability to log to arbitrary file
Fixes K9 issues 11, 23, 24, 65, 69, 71, 79, 81, 82, 83, 87, 101, 104,
107, 120, 148, 154
2008-12-30 22:49:09 -05:00
|
|
|
editor.remove(mUuid + ".lastFullSync");
|
|
|
|
editor.remove(mUuid + ".folderDisplayMode");
|
|
|
|
editor.remove(mUuid + ".folderSyncMode");
|
2009-10-21 20:41:06 -04:00
|
|
|
editor.remove(mUuid + ".folderPushMode");
|
2009-03-05 02:32:45 -05:00
|
|
|
editor.remove(mUuid + ".folderTargetMode");
|
2009-01-24 13:58:40 -05:00
|
|
|
editor.remove(mUuid + ".hideButtonsEnum");
|
2009-05-17 02:02:02 -04:00
|
|
|
editor.remove(mUuid + ".signatureBeforeQuotedText");
|
2009-06-08 23:11:35 -04:00
|
|
|
deleteIdentities(preferences.getPreferences(), editor);
|
2008-11-01 17:32:06 -04:00
|
|
|
editor.commit();
|
|
|
|
}
|
|
|
|
|
|
|
|
public void save(Preferences preferences) {
|
2009-04-11 10:33:54 -04:00
|
|
|
SharedPreferences.Editor editor = preferences.getPreferences().edit();
|
2009-01-09 01:13:28 -05:00
|
|
|
|
2009-04-11 10:33:54 -04:00
|
|
|
if (!preferences.getPreferences().getString("accountUuids", "").contains(mUuid)) {
|
2008-11-01 17:32:06 -04:00
|
|
|
/*
|
|
|
|
* When the account is first created we assign it a unique account number. The
|
|
|
|
* account number will be unique to that account for the lifetime of the account.
|
|
|
|
* So, we get all the existing account numbers, sort them ascending, loop through
|
|
|
|
* the list and check if the number is greater than 1 + the previous number. If so
|
|
|
|
* we use the previous number + 1 as the account number. This refills gaps.
|
|
|
|
* mAccountNumber starts as -1 on a newly created account. It must be -1 for this
|
|
|
|
* algorithm to work.
|
|
|
|
*
|
|
|
|
* I bet there is a much smarter way to do this. Anyone like to suggest it?
|
|
|
|
*/
|
|
|
|
Account[] accounts = preferences.getAccounts();
|
|
|
|
int[] accountNumbers = new int[accounts.length];
|
|
|
|
for (int i = 0; i < accounts.length; i++) {
|
|
|
|
accountNumbers[i] = accounts[i].getAccountNumber();
|
|
|
|
}
|
|
|
|
Arrays.sort(accountNumbers);
|
|
|
|
for (int accountNumber : accountNumbers) {
|
|
|
|
if (accountNumber > mAccountNumber + 1) {
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
mAccountNumber = accountNumber;
|
|
|
|
}
|
|
|
|
mAccountNumber++;
|
|
|
|
|
2009-04-11 10:33:54 -04:00
|
|
|
String accountUuids = preferences.getPreferences().getString("accountUuids", "");
|
2008-11-01 17:32:06 -04:00
|
|
|
accountUuids += (accountUuids.length() != 0 ? "," : "") + mUuid;
|
|
|
|
editor.putString("accountUuids", accountUuids);
|
|
|
|
}
|
|
|
|
|
|
|
|
editor.putString(mUuid + ".storeUri", Utility.base64Encode(mStoreUri));
|
|
|
|
editor.putString(mUuid + ".localStoreUri", mLocalStoreUri);
|
|
|
|
editor.putString(mUuid + ".transportUri", Utility.base64Encode(mTransportUri));
|
|
|
|
editor.putString(mUuid + ".description", mDescription);
|
|
|
|
editor.putString(mUuid + ".alwaysBcc", mAlwaysBcc);
|
|
|
|
editor.putInt(mUuid + ".automaticCheckIntervalMinutes", mAutomaticCheckIntervalMinutes);
|
2008-12-11 00:25:59 -05:00
|
|
|
editor.putInt(mUuid + ".displayCount", mDisplayCount);
|
2008-11-01 17:32:06 -04:00
|
|
|
editor.putLong(mUuid + ".lastAutomaticCheckTime", mLastAutomaticCheckTime);
|
|
|
|
editor.putBoolean(mUuid + ".notifyNewMail", mNotifyNewMail);
|
2009-11-22 14:42:44 -05:00
|
|
|
editor.putBoolean(mUuid + ".notifySelfNewMail", mNotifySelfNewMail);
|
2009-01-18 11:42:55 -05:00
|
|
|
editor.putBoolean(mUuid + ".notifyMailCheck", mNotifySync);
|
2008-11-01 17:32:06 -04:00
|
|
|
editor.putInt(mUuid + ".deletePolicy", mDeletePolicy);
|
|
|
|
editor.putString(mUuid + ".draftsFolderName", mDraftsFolderName);
|
|
|
|
editor.putString(mUuid + ".sentFolderName", mSentFolderName);
|
|
|
|
editor.putString(mUuid + ".trashFolderName", mTrashFolderName);
|
|
|
|
editor.putString(mUuid + ".outboxFolderName", mOutboxFolderName);
|
2009-04-08 14:14:52 -04:00
|
|
|
editor.putString(mUuid + ".autoExpandFolderName", mAutoExpandFolderName);
|
2008-11-01 17:32:06 -04:00
|
|
|
editor.putInt(mUuid + ".accountNumber", mAccountNumber);
|
|
|
|
editor.putBoolean(mUuid + ".vibrate", mVibrate);
|
2009-01-24 13:58:40 -05:00
|
|
|
editor.putString(mUuid + ".hideButtonsEnum", mHideMessageViewButtons.name());
|
2008-11-01 17:32:06 -04:00
|
|
|
editor.putString(mUuid + ".ringtone", mRingtoneUri);
|
Complete merge of DAmail functionality into K9mail. Following
features are added to K9mail:
1) Show unread message count on each folder
2) Sum unread count of all shown folders in an account to the account display
3) Periodically check selected folders for new mail, not just Inbox
4) Don't refresh folder when opened (unless folder is empty)
5) Show date and time of last sync for each folder
6) Fix timer for automatic periodic sync (use wakelock to assure completion)
7) Optimize local folder queries (speeds up account and folder lists)
8) Show Loading... message in status bar indicating which folder is being synced
9) Eliminate redundant sync of new messages (performance enhancement)
10) Improve notification text for multiple accounts
11) Do not automatically sync folders more often than the account-specific period
12) Use user-configured date and time formats
13) Select which folders are shown, using configurable Classes
14) Select which folders are synced, using configurable Classes
15) Added context (long press) menu to folders, to provide for Refresh
and Folder Settings
16) Status light flashes purple when there are unread messages
17) Folder list more quickly eliminates display of deleted and out-of-Class folders.
18) Delete works
19) Mark all messages as read (in the folder context menu)
20) Notifications only for new unread messages
21) One minute synchronization frequency
22) Deleting an unread message decrements unread counter
23) Notifications work for POP3 accounts
24) Message deletes work for POP3 accounts
25) Explicit errors show in folder list
26) Stack traces saved to folder K9mail-errors
27) Clear pending actions (danger, for emergencies only!)
28) Delete policy in Account settings
29) DNS cache in InetAddress disabled
30) Trapped some crash-causing error conditions
31) Eliminate duplicate copies to Sent folder
32) Prevent crashes due to message listener concurrency
33) Empty Trash
34) Nuclear "Mark all messages as read" (marks all messages as read in
server-side folder, irrespective of which messages have been downloaded)
35) Forward (alternate) to allow forwarding email through other programs
36) Accept text/plain Intents to allow other programs to send email through K9mail
37) Displays Outbox sending status
38) Manual retry of outbox sending when "Refresh"ing Outbox
39) Folder error status is persisted
40) Ability to log to arbitrary file
Fixes K9 issues 11, 23, 24, 65, 69, 71, 79, 81, 82, 83, 87, 101, 104,
107, 120, 148, 154
2008-12-30 22:49:09 -05:00
|
|
|
editor.putString(mUuid + ".folderDisplayMode", mFolderDisplayMode.name());
|
|
|
|
editor.putString(mUuid + ".folderSyncMode", mFolderSyncMode.name());
|
2009-10-21 20:41:06 -04:00
|
|
|
editor.putString(mUuid + ".folderPushMode", mFolderPushMode.name());
|
2009-03-05 02:32:45 -05:00
|
|
|
editor.putString(mUuid + ".folderTargetMode", mFolderTargetMode.name());
|
2009-05-17 02:02:02 -04:00
|
|
|
editor.putBoolean(mUuid + ".signatureBeforeQuotedText", this.mIsSignatureBeforeQuotedText);
|
Complete merge of DAmail functionality into K9mail. Following
features are added to K9mail:
1) Show unread message count on each folder
2) Sum unread count of all shown folders in an account to the account display
3) Periodically check selected folders for new mail, not just Inbox
4) Don't refresh folder when opened (unless folder is empty)
5) Show date and time of last sync for each folder
6) Fix timer for automatic periodic sync (use wakelock to assure completion)
7) Optimize local folder queries (speeds up account and folder lists)
8) Show Loading... message in status bar indicating which folder is being synced
9) Eliminate redundant sync of new messages (performance enhancement)
10) Improve notification text for multiple accounts
11) Do not automatically sync folders more often than the account-specific period
12) Use user-configured date and time formats
13) Select which folders are shown, using configurable Classes
14) Select which folders are synced, using configurable Classes
15) Added context (long press) menu to folders, to provide for Refresh
and Folder Settings
16) Status light flashes purple when there are unread messages
17) Folder list more quickly eliminates display of deleted and out-of-Class folders.
18) Delete works
19) Mark all messages as read (in the folder context menu)
20) Notifications only for new unread messages
21) One minute synchronization frequency
22) Deleting an unread message decrements unread counter
23) Notifications work for POP3 accounts
24) Message deletes work for POP3 accounts
25) Explicit errors show in folder list
26) Stack traces saved to folder K9mail-errors
27) Clear pending actions (danger, for emergencies only!)
28) Delete policy in Account settings
29) DNS cache in InetAddress disabled
30) Trapped some crash-causing error conditions
31) Eliminate duplicate copies to Sent folder
32) Prevent crashes due to message listener concurrency
33) Empty Trash
34) Nuclear "Mark all messages as read" (marks all messages as read in
server-side folder, irrespective of which messages have been downloaded)
35) Forward (alternate) to allow forwarding email through other programs
36) Accept text/plain Intents to allow other programs to send email through K9mail
37) Displays Outbox sending status
38) Manual retry of outbox sending when "Refresh"ing Outbox
39) Folder error status is persisted
40) Ability to log to arbitrary file
Fixes K9 issues 11, 23, 24, 65, 69, 71, 79, 81, 82, 83, 87, 101, 104,
107, 120, 148, 154
2008-12-30 22:49:09 -05:00
|
|
|
|
2009-06-08 23:11:35 -04:00
|
|
|
saveIdentities(preferences.getPreferences(), editor);
|
|
|
|
|
2008-11-01 17:32:06 -04:00
|
|
|
editor.commit();
|
|
|
|
}
|
|
|
|
|
|
|
|
public String toString() {
|
|
|
|
return mDescription;
|
|
|
|
}
|
|
|
|
|
|
|
|
public Uri getContentUri() {
|
|
|
|
return Uri.parse("content://accounts/" + getUuid());
|
|
|
|
}
|
|
|
|
|
|
|
|
public String getLocalStoreUri() {
|
|
|
|
return mLocalStoreUri;
|
|
|
|
}
|
|
|
|
|
|
|
|
public void setLocalStoreUri(String localStoreUri) {
|
|
|
|
this.mLocalStoreUri = localStoreUri;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Returns -1 for never.
|
|
|
|
*/
|
|
|
|
public int getAutomaticCheckIntervalMinutes() {
|
|
|
|
return mAutomaticCheckIntervalMinutes;
|
|
|
|
}
|
Complete merge of DAmail functionality into K9mail. Following
features are added to K9mail:
1) Show unread message count on each folder
2) Sum unread count of all shown folders in an account to the account display
3) Periodically check selected folders for new mail, not just Inbox
4) Don't refresh folder when opened (unless folder is empty)
5) Show date and time of last sync for each folder
6) Fix timer for automatic periodic sync (use wakelock to assure completion)
7) Optimize local folder queries (speeds up account and folder lists)
8) Show Loading... message in status bar indicating which folder is being synced
9) Eliminate redundant sync of new messages (performance enhancement)
10) Improve notification text for multiple accounts
11) Do not automatically sync folders more often than the account-specific period
12) Use user-configured date and time formats
13) Select which folders are shown, using configurable Classes
14) Select which folders are synced, using configurable Classes
15) Added context (long press) menu to folders, to provide for Refresh
and Folder Settings
16) Status light flashes purple when there are unread messages
17) Folder list more quickly eliminates display of deleted and out-of-Class folders.
18) Delete works
19) Mark all messages as read (in the folder context menu)
20) Notifications only for new unread messages
21) One minute synchronization frequency
22) Deleting an unread message decrements unread counter
23) Notifications work for POP3 accounts
24) Message deletes work for POP3 accounts
25) Explicit errors show in folder list
26) Stack traces saved to folder K9mail-errors
27) Clear pending actions (danger, for emergencies only!)
28) Delete policy in Account settings
29) DNS cache in InetAddress disabled
30) Trapped some crash-causing error conditions
31) Eliminate duplicate copies to Sent folder
32) Prevent crashes due to message listener concurrency
33) Empty Trash
34) Nuclear "Mark all messages as read" (marks all messages as read in
server-side folder, irrespective of which messages have been downloaded)
35) Forward (alternate) to allow forwarding email through other programs
36) Accept text/plain Intents to allow other programs to send email through K9mail
37) Displays Outbox sending status
38) Manual retry of outbox sending when "Refresh"ing Outbox
39) Folder error status is persisted
40) Ability to log to arbitrary file
Fixes K9 issues 11, 23, 24, 65, 69, 71, 79, 81, 82, 83, 87, 101, 104,
107, 120, 148, 154
2008-12-30 22:49:09 -05:00
|
|
|
|
|
|
|
public int getUnreadMessageCount(Context context, Application application) throws MessagingException
|
|
|
|
{
|
|
|
|
int unreadMessageCount = 0;
|
|
|
|
LocalStore localStore = (LocalStore) Store.getInstance(
|
|
|
|
getLocalStoreUri(),
|
|
|
|
application);
|
|
|
|
Account.FolderMode aMode = getFolderDisplayMode();
|
|
|
|
Preferences prefs = Preferences.getPreferences(context);
|
|
|
|
for (LocalFolder folder : localStore.getPersonalNamespaces())
|
|
|
|
{
|
|
|
|
folder.refresh(prefs);
|
|
|
|
Folder.FolderClass fMode = folder.getDisplayClass();
|
|
|
|
|
|
|
|
if (folder.getName().equals(getTrashFolderName()) == false &&
|
|
|
|
folder.getName().equals(getDraftsFolderName()) == false &&
|
|
|
|
folder.getName().equals(getOutboxFolderName()) == false &&
|
|
|
|
folder.getName().equals(getSentFolderName()) == false &&
|
|
|
|
folder.getName().equals(getErrorFolderName()) == false)
|
|
|
|
{
|
2009-10-21 20:41:06 -04:00
|
|
|
if (aMode == Account.FolderMode.NONE)
|
|
|
|
{
|
|
|
|
continue;
|
|
|
|
}
|
Complete merge of DAmail functionality into K9mail. Following
features are added to K9mail:
1) Show unread message count on each folder
2) Sum unread count of all shown folders in an account to the account display
3) Periodically check selected folders for new mail, not just Inbox
4) Don't refresh folder when opened (unless folder is empty)
5) Show date and time of last sync for each folder
6) Fix timer for automatic periodic sync (use wakelock to assure completion)
7) Optimize local folder queries (speeds up account and folder lists)
8) Show Loading... message in status bar indicating which folder is being synced
9) Eliminate redundant sync of new messages (performance enhancement)
10) Improve notification text for multiple accounts
11) Do not automatically sync folders more often than the account-specific period
12) Use user-configured date and time formats
13) Select which folders are shown, using configurable Classes
14) Select which folders are synced, using configurable Classes
15) Added context (long press) menu to folders, to provide for Refresh
and Folder Settings
16) Status light flashes purple when there are unread messages
17) Folder list more quickly eliminates display of deleted and out-of-Class folders.
18) Delete works
19) Mark all messages as read (in the folder context menu)
20) Notifications only for new unread messages
21) One minute synchronization frequency
22) Deleting an unread message decrements unread counter
23) Notifications work for POP3 accounts
24) Message deletes work for POP3 accounts
25) Explicit errors show in folder list
26) Stack traces saved to folder K9mail-errors
27) Clear pending actions (danger, for emergencies only!)
28) Delete policy in Account settings
29) DNS cache in InetAddress disabled
30) Trapped some crash-causing error conditions
31) Eliminate duplicate copies to Sent folder
32) Prevent crashes due to message listener concurrency
33) Empty Trash
34) Nuclear "Mark all messages as read" (marks all messages as read in
server-side folder, irrespective of which messages have been downloaded)
35) Forward (alternate) to allow forwarding email through other programs
36) Accept text/plain Intents to allow other programs to send email through K9mail
37) Displays Outbox sending status
38) Manual retry of outbox sending when "Refresh"ing Outbox
39) Folder error status is persisted
40) Ability to log to arbitrary file
Fixes K9 issues 11, 23, 24, 65, 69, 71, 79, 81, 82, 83, 87, 101, 104,
107, 120, 148, 154
2008-12-30 22:49:09 -05:00
|
|
|
if (aMode == Account.FolderMode.FIRST_CLASS &&
|
|
|
|
fMode != Folder.FolderClass.FIRST_CLASS)
|
|
|
|
{
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
if (aMode == Account.FolderMode.FIRST_AND_SECOND_CLASS &&
|
|
|
|
fMode != Folder.FolderClass.FIRST_CLASS &&
|
|
|
|
fMode != Folder.FolderClass.SECOND_CLASS)
|
|
|
|
{
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
if (aMode == Account.FolderMode.NOT_SECOND_CLASS &&
|
|
|
|
fMode == Folder.FolderClass.SECOND_CLASS)
|
|
|
|
{
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
unreadMessageCount += folder.getUnreadMessageCount();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return unreadMessageCount;
|
|
|
|
|
|
|
|
}
|
2009-02-28 12:40:39 -05:00
|
|
|
|
2009-11-22 14:02:57 -05:00
|
|
|
public boolean isAnIdentity(Address[] addrs)
|
|
|
|
{
|
|
|
|
if (addrs == null)
|
|
|
|
{
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
for (Address addr : addrs)
|
|
|
|
{
|
|
|
|
if (findIdentity(addr) != null)
|
|
|
|
{
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2009-02-28 12:40:39 -05:00
|
|
|
public boolean isAnIdentity(Address addr)
|
|
|
|
{
|
2009-07-24 01:12:17 -04:00
|
|
|
return findIdentity(addr) != null;
|
2009-06-08 23:11:35 -04:00
|
|
|
}
|
2009-07-24 01:12:17 -04:00
|
|
|
|
|
|
|
public Identity findIdentity(Address addr)
|
|
|
|
{
|
|
|
|
for (Identity identity : identities)
|
|
|
|
{
|
|
|
|
String email = identity.getEmail();
|
|
|
|
if (email != null && email.equalsIgnoreCase(addr.getAddress()))
|
|
|
|
{
|
|
|
|
return identity;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return null;
|
2009-02-28 12:40:39 -05:00
|
|
|
}
|
2008-11-01 17:32:06 -04:00
|
|
|
|
2008-12-11 00:25:59 -05:00
|
|
|
public int getDisplayCount() {
|
|
|
|
if (mDisplayCount == -1) {
|
2008-12-16 18:34:01 -05:00
|
|
|
this.mDisplayCount = Email.DEFAULT_VISIBLE_LIMIT;
|
2008-12-11 00:25:59 -05:00
|
|
|
}
|
|
|
|
return mDisplayCount;
|
|
|
|
}
|
|
|
|
|
2008-11-01 17:32:06 -04:00
|
|
|
/**
|
|
|
|
* @param automaticCheckIntervalMinutes or -1 for never.
|
|
|
|
*/
|
|
|
|
public void setAutomaticCheckIntervalMinutes(int automaticCheckIntervalMinutes) {
|
|
|
|
this.mAutomaticCheckIntervalMinutes = automaticCheckIntervalMinutes;
|
|
|
|
}
|
|
|
|
|
2008-12-11 00:25:59 -05:00
|
|
|
/**
|
|
|
|
* @param displayCount
|
|
|
|
*/
|
|
|
|
public void setDisplayCount(int displayCount) {
|
|
|
|
if (displayCount != -1) {
|
|
|
|
this.mDisplayCount = displayCount;
|
|
|
|
} else {
|
2008-12-16 18:34:01 -05:00
|
|
|
this.mDisplayCount = Email.DEFAULT_VISIBLE_LIMIT;
|
2008-12-11 00:25:59 -05:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2008-11-01 17:32:06 -04:00
|
|
|
public long getLastAutomaticCheckTime() {
|
|
|
|
return mLastAutomaticCheckTime;
|
|
|
|
}
|
|
|
|
|
|
|
|
public void setLastAutomaticCheckTime(long lastAutomaticCheckTime) {
|
|
|
|
this.mLastAutomaticCheckTime = lastAutomaticCheckTime;
|
|
|
|
}
|
|
|
|
|
|
|
|
public boolean isNotifyNewMail() {
|
|
|
|
return mNotifyNewMail;
|
|
|
|
}
|
|
|
|
|
|
|
|
public void setNotifyNewMail(boolean notifyNewMail) {
|
|
|
|
this.mNotifyNewMail = notifyNewMail;
|
|
|
|
}
|
|
|
|
|
|
|
|
public int getDeletePolicy() {
|
|
|
|
return mDeletePolicy;
|
|
|
|
}
|
|
|
|
|
|
|
|
public void setDeletePolicy(int deletePolicy) {
|
|
|
|
this.mDeletePolicy = deletePolicy;
|
|
|
|
}
|
|
|
|
|
|
|
|
public String getDraftsFolderName() {
|
|
|
|
return mDraftsFolderName;
|
|
|
|
}
|
|
|
|
|
|
|
|
public void setDraftsFolderName(String draftsFolderName) {
|
|
|
|
mDraftsFolderName = draftsFolderName;
|
|
|
|
}
|
|
|
|
|
|
|
|
public String getSentFolderName() {
|
|
|
|
return mSentFolderName;
|
|
|
|
}
|
Complete merge of DAmail functionality into K9mail. Following
features are added to K9mail:
1) Show unread message count on each folder
2) Sum unread count of all shown folders in an account to the account display
3) Periodically check selected folders for new mail, not just Inbox
4) Don't refresh folder when opened (unless folder is empty)
5) Show date and time of last sync for each folder
6) Fix timer for automatic periodic sync (use wakelock to assure completion)
7) Optimize local folder queries (speeds up account and folder lists)
8) Show Loading... message in status bar indicating which folder is being synced
9) Eliminate redundant sync of new messages (performance enhancement)
10) Improve notification text for multiple accounts
11) Do not automatically sync folders more often than the account-specific period
12) Use user-configured date and time formats
13) Select which folders are shown, using configurable Classes
14) Select which folders are synced, using configurable Classes
15) Added context (long press) menu to folders, to provide for Refresh
and Folder Settings
16) Status light flashes purple when there are unread messages
17) Folder list more quickly eliminates display of deleted and out-of-Class folders.
18) Delete works
19) Mark all messages as read (in the folder context menu)
20) Notifications only for new unread messages
21) One minute synchronization frequency
22) Deleting an unread message decrements unread counter
23) Notifications work for POP3 accounts
24) Message deletes work for POP3 accounts
25) Explicit errors show in folder list
26) Stack traces saved to folder K9mail-errors
27) Clear pending actions (danger, for emergencies only!)
28) Delete policy in Account settings
29) DNS cache in InetAddress disabled
30) Trapped some crash-causing error conditions
31) Eliminate duplicate copies to Sent folder
32) Prevent crashes due to message listener concurrency
33) Empty Trash
34) Nuclear "Mark all messages as read" (marks all messages as read in
server-side folder, irrespective of which messages have been downloaded)
35) Forward (alternate) to allow forwarding email through other programs
36) Accept text/plain Intents to allow other programs to send email through K9mail
37) Displays Outbox sending status
38) Manual retry of outbox sending when "Refresh"ing Outbox
39) Folder error status is persisted
40) Ability to log to arbitrary file
Fixes K9 issues 11, 23, 24, 65, 69, 71, 79, 81, 82, 83, 87, 101, 104,
107, 120, 148, 154
2008-12-30 22:49:09 -05:00
|
|
|
|
|
|
|
public String getErrorFolderName()
|
|
|
|
{
|
|
|
|
return Email.ERROR_FOLDER_NAME;
|
|
|
|
}
|
2008-11-01 17:32:06 -04:00
|
|
|
|
|
|
|
public void setSentFolderName(String sentFolderName) {
|
|
|
|
mSentFolderName = sentFolderName;
|
|
|
|
}
|
|
|
|
|
|
|
|
public String getTrashFolderName() {
|
|
|
|
return mTrashFolderName;
|
|
|
|
}
|
|
|
|
|
|
|
|
public void setTrashFolderName(String trashFolderName) {
|
|
|
|
mTrashFolderName = trashFolderName;
|
|
|
|
}
|
|
|
|
|
|
|
|
public String getOutboxFolderName() {
|
|
|
|
return mOutboxFolderName;
|
|
|
|
}
|
|
|
|
|
|
|
|
public void setOutboxFolderName(String outboxFolderName) {
|
|
|
|
mOutboxFolderName = outboxFolderName;
|
|
|
|
}
|
|
|
|
|
2009-04-08 14:14:52 -04:00
|
|
|
public String getAutoExpandFolderName() {
|
|
|
|
return mAutoExpandFolderName;
|
|
|
|
}
|
|
|
|
|
|
|
|
public void setAutoExpandFolderName(String autoExpandFolderName) {
|
|
|
|
mAutoExpandFolderName = autoExpandFolderName;
|
|
|
|
}
|
|
|
|
|
2008-11-01 17:32:06 -04:00
|
|
|
public int getAccountNumber() {
|
|
|
|
return mAccountNumber;
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public boolean equals(Object o) {
|
|
|
|
if (o instanceof Account) {
|
|
|
|
return ((Account)o).mUuid.equals(mUuid);
|
|
|
|
}
|
|
|
|
return super.equals(o);
|
|
|
|
}
|
Complete merge of DAmail functionality into K9mail. Following
features are added to K9mail:
1) Show unread message count on each folder
2) Sum unread count of all shown folders in an account to the account display
3) Periodically check selected folders for new mail, not just Inbox
4) Don't refresh folder when opened (unless folder is empty)
5) Show date and time of last sync for each folder
6) Fix timer for automatic periodic sync (use wakelock to assure completion)
7) Optimize local folder queries (speeds up account and folder lists)
8) Show Loading... message in status bar indicating which folder is being synced
9) Eliminate redundant sync of new messages (performance enhancement)
10) Improve notification text for multiple accounts
11) Do not automatically sync folders more often than the account-specific period
12) Use user-configured date and time formats
13) Select which folders are shown, using configurable Classes
14) Select which folders are synced, using configurable Classes
15) Added context (long press) menu to folders, to provide for Refresh
and Folder Settings
16) Status light flashes purple when there are unread messages
17) Folder list more quickly eliminates display of deleted and out-of-Class folders.
18) Delete works
19) Mark all messages as read (in the folder context menu)
20) Notifications only for new unread messages
21) One minute synchronization frequency
22) Deleting an unread message decrements unread counter
23) Notifications work for POP3 accounts
24) Message deletes work for POP3 accounts
25) Explicit errors show in folder list
26) Stack traces saved to folder K9mail-errors
27) Clear pending actions (danger, for emergencies only!)
28) Delete policy in Account settings
29) DNS cache in InetAddress disabled
30) Trapped some crash-causing error conditions
31) Eliminate duplicate copies to Sent folder
32) Prevent crashes due to message listener concurrency
33) Empty Trash
34) Nuclear "Mark all messages as read" (marks all messages as read in
server-side folder, irrespective of which messages have been downloaded)
35) Forward (alternate) to allow forwarding email through other programs
36) Accept text/plain Intents to allow other programs to send email through K9mail
37) Displays Outbox sending status
38) Manual retry of outbox sending when "Refresh"ing Outbox
39) Folder error status is persisted
40) Ability to log to arbitrary file
Fixes K9 issues 11, 23, 24, 65, 69, 71, 79, 81, 82, 83, 87, 101, 104,
107, 120, 148, 154
2008-12-30 22:49:09 -05:00
|
|
|
|
|
|
|
public FolderMode getFolderDisplayMode()
|
|
|
|
{
|
|
|
|
return mFolderDisplayMode;
|
|
|
|
}
|
|
|
|
|
|
|
|
public void setFolderDisplayMode(FolderMode displayMode)
|
|
|
|
{
|
|
|
|
mFolderDisplayMode = displayMode;
|
|
|
|
}
|
|
|
|
|
|
|
|
public FolderMode getFolderSyncMode()
|
|
|
|
{
|
|
|
|
return mFolderSyncMode;
|
|
|
|
}
|
|
|
|
|
|
|
|
public void setFolderSyncMode(FolderMode syncMode)
|
|
|
|
{
|
|
|
|
mFolderSyncMode = syncMode;
|
|
|
|
}
|
2009-10-21 20:41:06 -04:00
|
|
|
|
|
|
|
public FolderMode getFolderPushMode()
|
|
|
|
{
|
|
|
|
return mFolderPushMode;
|
|
|
|
}
|
|
|
|
|
|
|
|
public void setFolderPushMode(FolderMode syncMode)
|
|
|
|
{
|
|
|
|
mFolderPushMode = syncMode;
|
|
|
|
}
|
Complete merge of DAmail functionality into K9mail. Following
features are added to K9mail:
1) Show unread message count on each folder
2) Sum unread count of all shown folders in an account to the account display
3) Periodically check selected folders for new mail, not just Inbox
4) Don't refresh folder when opened (unless folder is empty)
5) Show date and time of last sync for each folder
6) Fix timer for automatic periodic sync (use wakelock to assure completion)
7) Optimize local folder queries (speeds up account and folder lists)
8) Show Loading... message in status bar indicating which folder is being synced
9) Eliminate redundant sync of new messages (performance enhancement)
10) Improve notification text for multiple accounts
11) Do not automatically sync folders more often than the account-specific period
12) Use user-configured date and time formats
13) Select which folders are shown, using configurable Classes
14) Select which folders are synced, using configurable Classes
15) Added context (long press) menu to folders, to provide for Refresh
and Folder Settings
16) Status light flashes purple when there are unread messages
17) Folder list more quickly eliminates display of deleted and out-of-Class folders.
18) Delete works
19) Mark all messages as read (in the folder context menu)
20) Notifications only for new unread messages
21) One minute synchronization frequency
22) Deleting an unread message decrements unread counter
23) Notifications work for POP3 accounts
24) Message deletes work for POP3 accounts
25) Explicit errors show in folder list
26) Stack traces saved to folder K9mail-errors
27) Clear pending actions (danger, for emergencies only!)
28) Delete policy in Account settings
29) DNS cache in InetAddress disabled
30) Trapped some crash-causing error conditions
31) Eliminate duplicate copies to Sent folder
32) Prevent crashes due to message listener concurrency
33) Empty Trash
34) Nuclear "Mark all messages as read" (marks all messages as read in
server-side folder, irrespective of which messages have been downloaded)
35) Forward (alternate) to allow forwarding email through other programs
36) Accept text/plain Intents to allow other programs to send email through K9mail
37) Displays Outbox sending status
38) Manual retry of outbox sending when "Refresh"ing Outbox
39) Folder error status is persisted
40) Ability to log to arbitrary file
Fixes K9 issues 11, 23, 24, 65, 69, 71, 79, 81, 82, 83, 87, 101, 104,
107, 120, 148, 154
2008-12-30 22:49:09 -05:00
|
|
|
|
2009-01-13 00:52:37 -05:00
|
|
|
public boolean isShowOngoing()
|
|
|
|
{
|
2009-01-18 11:42:55 -05:00
|
|
|
return mNotifySync;
|
2009-01-13 00:52:37 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
public void setShowOngoing(boolean showOngoing)
|
|
|
|
{
|
2009-01-18 11:42:55 -05:00
|
|
|
this.mNotifySync = showOngoing;
|
2009-01-13 00:52:37 -05:00
|
|
|
}
|
|
|
|
|
2009-01-24 13:58:40 -05:00
|
|
|
public HideButtons getHideMessageViewButtons()
|
2009-01-19 09:54:05 -05:00
|
|
|
{
|
|
|
|
return mHideMessageViewButtons;
|
|
|
|
}
|
|
|
|
|
2009-01-24 13:58:40 -05:00
|
|
|
public void setHideMessageViewButtons(HideButtons hideMessageViewButtons)
|
2009-01-19 09:54:05 -05:00
|
|
|
{
|
|
|
|
mHideMessageViewButtons = hideMessageViewButtons;
|
|
|
|
}
|
|
|
|
|
2009-03-05 02:32:45 -05:00
|
|
|
public FolderMode getFolderTargetMode()
|
|
|
|
{
|
|
|
|
return mFolderTargetMode;
|
|
|
|
}
|
|
|
|
|
|
|
|
public void setFolderTargetMode(FolderMode folderTargetMode)
|
|
|
|
{
|
|
|
|
mFolderTargetMode = folderTargetMode;
|
|
|
|
}
|
|
|
|
|
2009-05-17 02:02:02 -04:00
|
|
|
public boolean isSignatureBeforeQuotedText() {
|
|
|
|
return mIsSignatureBeforeQuotedText;
|
|
|
|
}
|
|
|
|
|
|
|
|
public void setSignatureBeforeQuotedText(boolean mIsSignatureBeforeQuotedText) {
|
|
|
|
this.mIsSignatureBeforeQuotedText = mIsSignatureBeforeQuotedText;
|
|
|
|
}
|
|
|
|
|
2009-11-22 14:02:57 -05:00
|
|
|
public boolean isNotifySelfNewMail()
|
|
|
|
{
|
|
|
|
return mNotifySelfNewMail;
|
|
|
|
}
|
|
|
|
|
|
|
|
public void setNotifySelfNewMail(boolean notifySelfNewMail)
|
|
|
|
{
|
|
|
|
mNotifySelfNewMail = notifySelfNewMail;
|
|
|
|
}
|
|
|
|
|
2008-11-01 17:32:06 -04:00
|
|
|
}
|