2008-11-01 17:32:06 -04:00
|
|
|
|
2009-12-14 21:50:53 -05:00
|
|
|
package com.fsck.k9.activity.setup;
|
2008-11-01 17:32:06 -04:00
|
|
|
|
2012-06-06 09:09:45 -04:00
|
|
|
import android.app.Dialog;
|
2008-11-01 17:32:06 -04:00
|
|
|
import android.content.Context;
|
|
|
|
import android.content.Intent;
|
|
|
|
import android.content.SharedPreferences;
|
2010-12-24 17:48:29 -05:00
|
|
|
import android.os.AsyncTask;
|
2008-11-01 17:32:06 -04:00
|
|
|
import android.os.Bundle;
|
2010-08-28 10:00:34 -04:00
|
|
|
import android.os.Vibrator;
|
2011-01-05 18:58:14 -05:00
|
|
|
import android.preference.*;
|
2009-10-21 20:41:06 -04:00
|
|
|
import android.util.Log;
|
2010-07-27 08:10:09 -04:00
|
|
|
|
2011-02-19 22:47:28 -05:00
|
|
|
import java.util.Iterator;
|
2010-11-13 16:40:56 -05:00
|
|
|
import java.util.Map;
|
2010-11-16 22:43:02 -05:00
|
|
|
import java.util.LinkedList;
|
|
|
|
import java.util.List;
|
2010-11-13 16:40:56 -05:00
|
|
|
|
2010-07-27 08:10:09 -04:00
|
|
|
import com.fsck.k9.Account;
|
2010-02-07 16:23:33 -05:00
|
|
|
import com.fsck.k9.Account.FolderMode;
|
2011-01-05 18:58:14 -05:00
|
|
|
import com.fsck.k9.Account.QuoteStyle;
|
2010-07-27 08:10:09 -04:00
|
|
|
import com.fsck.k9.K9;
|
2010-11-28 15:29:14 -05:00
|
|
|
import com.fsck.k9.NotificationSetting;
|
2010-07-27 08:10:09 -04:00
|
|
|
import com.fsck.k9.Preferences;
|
|
|
|
import com.fsck.k9.R;
|
2010-11-16 22:43:02 -05:00
|
|
|
import com.fsck.k9.mail.Folder;
|
2009-12-14 21:50:53 -05:00
|
|
|
import com.fsck.k9.activity.ChooseFolder;
|
|
|
|
import com.fsck.k9.activity.ChooseIdentity;
|
2010-05-19 14:17:06 -04:00
|
|
|
import com.fsck.k9.activity.ColorPickerDialog;
|
|
|
|
import com.fsck.k9.activity.K9PreferenceActivity;
|
2009-12-14 21:50:53 -05:00
|
|
|
import com.fsck.k9.activity.ManageIdentities;
|
2010-07-27 08:10:09 -04:00
|
|
|
import com.fsck.k9.crypto.Apg;
|
2009-12-14 21:50:53 -05:00
|
|
|
import com.fsck.k9.mail.Store;
|
2010-02-07 16:23:33 -05:00
|
|
|
import com.fsck.k9.service.MailService;
|
2008-11-01 17:32:06 -04:00
|
|
|
|
2010-11-13 16:40:56 -05:00
|
|
|
import com.fsck.k9.mail.store.StorageManager;
|
|
|
|
import com.fsck.k9.mail.store.LocalStore.LocalFolder;
|
|
|
|
|
|
|
|
|
2011-02-06 17:09:48 -05:00
|
|
|
public class AccountSettings extends K9PreferenceActivity {
|
2008-11-01 17:32:06 -04:00
|
|
|
private static final String EXTRA_ACCOUNT = "account";
|
2009-11-21 17:45:39 -05:00
|
|
|
|
2012-06-06 09:09:45 -04:00
|
|
|
private static final int DIALOG_COLOR_PICKER_ACCOUNT = 1;
|
|
|
|
private static final int DIALOG_COLOR_PICKER_LED = 2;
|
|
|
|
|
2009-04-08 14:14:52 -04:00
|
|
|
private static final int SELECT_AUTO_EXPAND_FOLDER = 1;
|
2008-11-01 17:32:06 -04:00
|
|
|
|
2009-06-08 23:11:35 -04:00
|
|
|
private static final int ACTIVITY_MANAGE_IDENTITIES = 2;
|
|
|
|
|
2011-01-05 18:58:14 -05:00
|
|
|
private static final String PREFERENCE_SCREEN_COMPOSING = "composing";
|
2011-07-13 22:15:36 -04:00
|
|
|
private static final String PREFERENCE_SCREEN_INCOMING = "incoming_prefs";
|
|
|
|
private static final String PREFERENCE_SCREEN_PUSH_ADVANCED = "push_advanced";
|
2011-01-05 18:58:14 -05:00
|
|
|
|
2008-11-01 17:32:06 -04:00
|
|
|
private static final String PREFERENCE_DESCRIPTION = "account_description";
|
2012-03-18 23:44:41 -04:00
|
|
|
private static final String PREFERENCE_MARK_MESSAGE_AS_READ_ON_VIEW = "mark_message_as_read_on_view";
|
2008-11-01 17:32:06 -04:00
|
|
|
private static final String PREFERENCE_COMPOSITION = "composition";
|
2009-06-08 23:11:35 -04:00
|
|
|
private static final String PREFERENCE_MANAGE_IDENTITIES = "manage_identities";
|
2008-11-01 17:32:06 -04:00
|
|
|
private static final String PREFERENCE_FREQUENCY = "account_check_frequency";
|
2008-12-11 00:25:59 -05:00
|
|
|
private static final String PREFERENCE_DISPLAY_COUNT = "account_display_count";
|
2008-11-01 17:32:06 -04:00
|
|
|
private static final String PREFERENCE_DEFAULT = "account_default";
|
2010-08-07 18:38:08 -04:00
|
|
|
private static final String PREFERENCE_SHOW_PICTURES = "show_pictures_enum";
|
2010-07-05 09:41:52 -04:00
|
|
|
private static final String PREFERENCE_ENABLE_MOVE_BUTTONS = "enable_move_buttons";
|
2008-11-01 17:32:06 -04:00
|
|
|
private static final String PREFERENCE_NOTIFY = "account_notify";
|
2009-11-22 14:42:44 -05:00
|
|
|
private static final String PREFERENCE_NOTIFY_SELF = "account_notify_self";
|
2009-01-18 11:42:55 -05:00
|
|
|
private static final String PREFERENCE_NOTIFY_SYNC = "account_notify_sync";
|
2008-11-01 17:32:06 -04:00
|
|
|
private static final String PREFERENCE_VIBRATE = "account_vibrate";
|
2010-07-02 10:47:01 -04:00
|
|
|
private static final String PREFERENCE_VIBRATE_PATTERN = "account_vibrate_pattern";
|
|
|
|
private static final String PREFERENCE_VIBRATE_TIMES = "account_vibrate_times";
|
2008-11-01 17:32:06 -04:00
|
|
|
private static final String PREFERENCE_RINGTONE = "account_ringtone";
|
2010-09-19 16:54:43 -04:00
|
|
|
private static final String PREFERENCE_NOTIFICATION_LED = "account_led";
|
2008-11-01 17:32:06 -04:00
|
|
|
private static final String PREFERENCE_INCOMING = "incoming";
|
|
|
|
private static final String PREFERENCE_OUTGOING = "outgoing";
|
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
|
|
|
private static final String PREFERENCE_DISPLAY_MODE = "folder_display_mode";
|
|
|
|
private static final String PREFERENCE_SYNC_MODE = "folder_sync_mode";
|
2009-10-21 20:41:06 -04:00
|
|
|
private static final String PREFERENCE_PUSH_MODE = "folder_push_mode";
|
2010-10-10 20:08:47 -04:00
|
|
|
private static final String PREFERENCE_PUSH_POLL_ON_CONNECT = "push_poll_on_connect";
|
|
|
|
private static final String PREFERENCE_MAX_PUSH_FOLDERS = "max_push_folders";
|
|
|
|
private static final String PREFERENCE_IDLE_REFRESH_PERIOD = "idle_refresh_period";
|
2009-03-05 02:32:45 -05:00
|
|
|
private static final String PREFERENCE_TARGET_MODE = "folder_target_mode";
|
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
|
|
|
private static final String PREFERENCE_DELETE_POLICY = "delete_policy";
|
Implementation of complete IMAP two-phase "delete/expunge" behavior.
On each IMAP account, the expunge behavior can be set to expunge
messages in a folder as soon as a move or delete is performed on the
folder ("immediately"), each time the folder is polled, or only when
executed manually.
In the Message List, there is now an Expunge action in the option
menu.
In the Folder List, there is now an Expunge action in the context
menu (long-press on the folder).
For IMAP accounts, it is also possible to disable the copying of deleted messages to the
Trash folder, by setting the Trash folder to -NONE-.
Fixes Issue 536.
Separately, in WebDAV accounts, the user can now choose the
server-side equivalents of the special folders, just like for IMAP.
2009-12-20 18:13:49 -05:00
|
|
|
private static final String PREFERENCE_EXPUNGE_POLICY = "expunge_policy";
|
2009-04-08 14:14:52 -04:00
|
|
|
private static final String PREFERENCE_AUTO_EXPAND_FOLDER = "account_setup_auto_expand_folder";
|
2010-04-05 22:54:48 -04:00
|
|
|
private static final String PREFERENCE_SEARCHABLE_FOLDERS = "searchable_folders";
|
2010-04-25 04:47:24 -04:00
|
|
|
private static final String PREFERENCE_CHIP_COLOR = "chip_color";
|
2010-05-15 16:35:59 -04:00
|
|
|
private static final String PREFERENCE_LED_COLOR = "led_color";
|
2010-05-12 01:35:08 -04:00
|
|
|
private static final String PREFERENCE_NOTIFICATION_OPENS_UNREAD = "notification_opens_unread";
|
2011-01-11 20:23:17 -05:00
|
|
|
private static final String PREFERENCE_NOTIFICATION_UNREAD_COUNT = "notification_unread_count";
|
2010-05-30 17:20:47 -04:00
|
|
|
private static final String PREFERENCE_MESSAGE_AGE = "account_message_age";
|
2010-07-11 07:59:14 -04:00
|
|
|
private static final String PREFERENCE_MESSAGE_SIZE = "account_autodownload_size";
|
2010-10-10 20:08:39 -04:00
|
|
|
private static final String PREFERENCE_SAVE_ALL_HEADERS = "account_save_all_headers";
|
2011-01-12 18:48:28 -05:00
|
|
|
private static final String PREFERENCE_MESSAGE_FORMAT = "message_format";
|
2011-08-27 20:42:27 -04:00
|
|
|
private static final String PREFERENCE_MESSAGE_READ_RECEIPT = "message_read_receipt";
|
2010-06-20 10:07:03 -04:00
|
|
|
private static final String PREFERENCE_QUOTE_PREFIX = "account_quote_prefix";
|
2011-01-05 18:58:14 -05:00
|
|
|
private static final String PREFERENCE_QUOTE_STYLE = "quote_style";
|
2011-05-14 11:15:01 -04:00
|
|
|
private static final String PREFERENCE_DEFAULT_QUOTED_TEXT_SHOWN = "default_quoted_text_shown";
|
2010-08-29 20:00:34 -04:00
|
|
|
private static final String PREFERENCE_REPLY_AFTER_QUOTE = "reply_after_quote";
|
2011-11-14 16:58:01 -05:00
|
|
|
private static final String PREFERENCE_STRIP_SIGNATURE = "strip_signature";
|
2010-07-03 09:10:38 -04:00
|
|
|
private static final String PREFERENCE_SYNC_REMOTE_DELETIONS = "account_sync_remote_deletetions";
|
2010-07-27 08:10:09 -04:00
|
|
|
private static final String PREFERENCE_CRYPTO_APP = "crypto_app";
|
|
|
|
private static final String PREFERENCE_CRYPTO_AUTO_SIGNATURE = "crypto_auto_signature";
|
2011-11-19 01:49:04 -05:00
|
|
|
private static final String PREFERENCE_CRYPTO_AUTO_ENCRYPT = "crypto_auto_encrypt";
|
2010-11-13 16:40:56 -05:00
|
|
|
private static final String PREFERENCE_LOCAL_STORAGE_PROVIDER = "local_storage_provider";
|
2012-02-24 23:05:21 -05:00
|
|
|
private static final String PREFERENCE_CATEGORY_FOLDERS = "folders";
|
2010-11-16 22:43:02 -05:00
|
|
|
private static final String PREFERENCE_ARCHIVE_FOLDER = "archive_folder";
|
|
|
|
private static final String PREFERENCE_DRAFTS_FOLDER = "drafts_folder";
|
|
|
|
private static final String PREFERENCE_SENT_FOLDER = "sent_folder";
|
|
|
|
private static final String PREFERENCE_SPAM_FOLDER = "spam_folder";
|
|
|
|
private static final String PREFERENCE_TRASH_FOLDER = "trash_folder";
|
|
|
|
|
|
|
|
|
|
|
|
|
2008-11-01 17:32:06 -04:00
|
|
|
private Account mAccount;
|
2011-04-01 00:44:50 -04:00
|
|
|
private boolean mIsMoveCapable = false;
|
2010-10-13 16:56:44 -04:00
|
|
|
private boolean mIsPushCapable = false;
|
|
|
|
private boolean mIsExpungeCapable = false;
|
2008-11-01 17:32:06 -04:00
|
|
|
|
2011-01-05 18:58:14 -05:00
|
|
|
private PreferenceScreen mComposingScreen;
|
|
|
|
|
2008-11-01 17:32:06 -04:00
|
|
|
private EditTextPreference mAccountDescription;
|
2012-03-18 23:44:41 -04:00
|
|
|
private CheckBoxPreference mMarkMessageAsReadOnView;
|
2008-11-01 17:32:06 -04:00
|
|
|
private ListPreference mCheckFrequency;
|
2008-12-11 00:25:59 -05:00
|
|
|
private ListPreference mDisplayCount;
|
2010-05-30 17:20:47 -04:00
|
|
|
private ListPreference mMessageAge;
|
2010-07-11 07:59:14 -04:00
|
|
|
private ListPreference mMessageSize;
|
2008-11-01 17:32:06 -04:00
|
|
|
private CheckBoxPreference mAccountDefault;
|
|
|
|
private CheckBoxPreference mAccountNotify;
|
2009-11-22 14:42:44 -05:00
|
|
|
private CheckBoxPreference mAccountNotifySelf;
|
2010-08-07 18:38:08 -04:00
|
|
|
private ListPreference mAccountShowPictures;
|
2010-07-05 09:41:52 -04:00
|
|
|
private CheckBoxPreference mAccountEnableMoveButtons;
|
2009-01-18 11:42:55 -05:00
|
|
|
private CheckBoxPreference mAccountNotifySync;
|
2008-11-01 17:32:06 -04:00
|
|
|
private CheckBoxPreference mAccountVibrate;
|
2010-09-19 16:54:43 -04:00
|
|
|
private CheckBoxPreference mAccountLed;
|
2010-07-02 10:47:01 -04:00
|
|
|
private ListPreference mAccountVibratePattern;
|
2010-08-28 10:00:34 -04:00
|
|
|
private ListPreference mAccountVibrateTimes;
|
2008-11-01 17:32:06 -04:00
|
|
|
private RingtonePreference mAccountRingtone;
|
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
|
|
|
private ListPreference mDisplayMode;
|
|
|
|
private ListPreference mSyncMode;
|
2009-10-21 20:41:06 -04:00
|
|
|
private ListPreference mPushMode;
|
2009-03-05 02:32:45 -05:00
|
|
|
private ListPreference mTargetMode;
|
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
|
|
|
private ListPreference mDeletePolicy;
|
Implementation of complete IMAP two-phase "delete/expunge" behavior.
On each IMAP account, the expunge behavior can be set to expunge
messages in a folder as soon as a move or delete is performed on the
folder ("immediately"), each time the folder is polled, or only when
executed manually.
In the Message List, there is now an Expunge action in the option
menu.
In the Folder List, there is now an Expunge action in the context
menu (long-press on the folder).
For IMAP accounts, it is also possible to disable the copying of deleted messages to the
Trash folder, by setting the Trash folder to -NONE-.
Fixes Issue 536.
Separately, in WebDAV accounts, the user can now choose the
server-side equivalents of the special folders, just like for IMAP.
2009-12-20 18:13:49 -05:00
|
|
|
private ListPreference mExpungePolicy;
|
2010-04-05 22:54:48 -04:00
|
|
|
private ListPreference mSearchableFolders;
|
2010-11-16 22:43:02 -05:00
|
|
|
private ListPreference mAutoExpandFolder;
|
2010-04-25 04:47:24 -04:00
|
|
|
private Preference mChipColor;
|
2010-05-15 16:35:59 -04:00
|
|
|
private Preference mLedColor;
|
2010-02-07 16:23:33 -05:00
|
|
|
private boolean mIncomingChanged = false;
|
2010-05-12 01:35:08 -04:00
|
|
|
private CheckBoxPreference mNotificationOpensUnread;
|
2011-01-11 20:23:17 -05:00
|
|
|
private CheckBoxPreference mNotificationUnreadCount;
|
2011-01-12 18:48:28 -05:00
|
|
|
private ListPreference mMessageFormat;
|
2011-08-27 20:42:27 -04:00
|
|
|
private CheckBoxPreference mMessageReadReceipt;
|
2011-01-05 18:58:14 -05:00
|
|
|
private ListPreference mQuoteStyle;
|
2010-06-20 10:07:03 -04:00
|
|
|
private EditTextPreference mAccountQuotePrefix;
|
2011-05-14 11:15:01 -04:00
|
|
|
private CheckBoxPreference mAccountDefaultQuotedTextShown;
|
2010-08-29 20:00:34 -04:00
|
|
|
private CheckBoxPreference mReplyAfterQuote;
|
2011-11-14 16:58:01 -05:00
|
|
|
private CheckBoxPreference mStripSignature;
|
2010-07-03 09:10:38 -04:00
|
|
|
private CheckBoxPreference mSyncRemoteDeletions;
|
2010-10-10 20:08:39 -04:00
|
|
|
private CheckBoxPreference mSaveAllHeaders;
|
2010-10-10 20:08:47 -04:00
|
|
|
private CheckBoxPreference mPushPollOnConnect;
|
|
|
|
private ListPreference mIdleRefreshPeriod;
|
|
|
|
private ListPreference mMaxPushFolders;
|
2010-07-27 08:10:09 -04:00
|
|
|
private ListPreference mCryptoApp;
|
|
|
|
private CheckBoxPreference mCryptoAutoSignature;
|
2011-11-19 01:49:04 -05:00
|
|
|
private CheckBoxPreference mCryptoAutoEncrypt;
|
2010-11-13 16:40:56 -05:00
|
|
|
private ListPreference mLocalStorageProvider;
|
2010-11-16 22:43:02 -05:00
|
|
|
private ListPreference mArchiveFolder;
|
|
|
|
private ListPreference mDraftsFolder;
|
|
|
|
private ListPreference mSentFolder;
|
|
|
|
private ListPreference mSpamFolder;
|
|
|
|
private ListPreference mTrashFolder;
|
|
|
|
|
|
|
|
|
2011-02-06 17:09:48 -05:00
|
|
|
public static void actionSettings(Context context, Account account) {
|
2008-11-01 17:32:06 -04:00
|
|
|
Intent i = new Intent(context, AccountSettings.class);
|
2010-03-03 23:00:30 -05:00
|
|
|
i.putExtra(EXTRA_ACCOUNT, account.getUuid());
|
2008-11-01 17:32:06 -04:00
|
|
|
context.startActivity(i);
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
2011-02-06 17:09:48 -05:00
|
|
|
public void onCreate(Bundle savedInstanceState) {
|
2008-11-01 17:32:06 -04:00
|
|
|
super.onCreate(savedInstanceState);
|
|
|
|
|
2010-03-03 23:00:30 -05:00
|
|
|
String accountUuid = getIntent().getStringExtra(EXTRA_ACCOUNT);
|
|
|
|
mAccount = Preferences.getPreferences(this).getAccount(accountUuid);
|
2008-11-01 17:32:06 -04:00
|
|
|
|
2011-02-06 17:09:48 -05:00
|
|
|
try {
|
2010-08-07 18:38:08 -04:00
|
|
|
final Store store = mAccount.getRemoteStore();
|
2011-04-01 00:44:50 -04:00
|
|
|
mIsMoveCapable = store.isMoveCapable();
|
2010-10-13 16:49:34 -04:00
|
|
|
mIsPushCapable = store.isPushCapable();
|
|
|
|
mIsExpungeCapable = store.isExpungeCapable();
|
2011-02-06 17:09:48 -05:00
|
|
|
} catch (Exception e) {
|
2009-12-14 21:50:53 -05:00
|
|
|
Log.e(K9.LOG_TAG, "Could not get remote store", e);
|
2009-10-21 20:41:06 -04:00
|
|
|
}
|
2009-11-21 17:45:39 -05:00
|
|
|
|
2008-11-01 17:32:06 -04:00
|
|
|
addPreferencesFromResource(R.xml.account_settings_preferences);
|
|
|
|
|
|
|
|
mAccountDescription = (EditTextPreference) findPreference(PREFERENCE_DESCRIPTION);
|
|
|
|
mAccountDescription.setSummary(mAccount.getDescription());
|
|
|
|
mAccountDescription.setText(mAccount.getDescription());
|
2011-02-06 17:09:48 -05:00
|
|
|
mAccountDescription.setOnPreferenceChangeListener(new Preference.OnPreferenceChangeListener() {
|
|
|
|
public boolean onPreferenceChange(Preference preference, Object newValue) {
|
2008-11-01 17:32:06 -04:00
|
|
|
final String summary = newValue.toString();
|
|
|
|
mAccountDescription.setSummary(summary);
|
|
|
|
mAccountDescription.setText(summary);
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
2012-03-18 23:44:41 -04:00
|
|
|
mMarkMessageAsReadOnView = (CheckBoxPreference) findPreference(PREFERENCE_MARK_MESSAGE_AS_READ_ON_VIEW);
|
|
|
|
mMarkMessageAsReadOnView.setChecked(mAccount.isMarkMessageAsReadOnView());
|
|
|
|
|
2011-01-12 18:48:28 -05:00
|
|
|
mMessageFormat = (ListPreference) findPreference(PREFERENCE_MESSAGE_FORMAT);
|
|
|
|
mMessageFormat.setValue(mAccount.getMessageFormat().name());
|
|
|
|
mMessageFormat.setSummary(mMessageFormat.getEntry());
|
2011-02-06 17:09:48 -05:00
|
|
|
mMessageFormat.setOnPreferenceChangeListener(new Preference.OnPreferenceChangeListener() {
|
|
|
|
public boolean onPreferenceChange(Preference preference, Object newValue) {
|
2011-01-12 18:48:28 -05:00
|
|
|
final String summary = newValue.toString();
|
|
|
|
int index = mMessageFormat.findIndexOfValue(summary);
|
|
|
|
mMessageFormat.setSummary(mMessageFormat.getEntries()[index]);
|
|
|
|
mMessageFormat.setValue(summary);
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
2011-08-27 20:42:27 -04:00
|
|
|
mMessageReadReceipt = (CheckBoxPreference) findPreference(PREFERENCE_MESSAGE_READ_RECEIPT);
|
|
|
|
mMessageReadReceipt.setChecked(mAccount.isMessageReadReceiptAlways());
|
|
|
|
|
2010-06-20 10:07:03 -04:00
|
|
|
mAccountQuotePrefix = (EditTextPreference) findPreference(PREFERENCE_QUOTE_PREFIX);
|
|
|
|
mAccountQuotePrefix.setSummary(mAccount.getQuotePrefix());
|
|
|
|
mAccountQuotePrefix.setText(mAccount.getQuotePrefix());
|
2011-02-06 17:09:48 -05:00
|
|
|
mAccountQuotePrefix.setOnPreferenceChangeListener(new Preference.OnPreferenceChangeListener() {
|
2010-06-20 10:07:03 -04:00
|
|
|
@Override
|
2011-02-06 17:09:48 -05:00
|
|
|
public boolean onPreferenceChange(Preference preference, Object newValue) {
|
2010-06-20 10:07:03 -04:00
|
|
|
final String value = newValue.toString();
|
|
|
|
mAccountQuotePrefix.setSummary(value);
|
|
|
|
mAccountQuotePrefix.setText(value);
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
});
|
2008-11-01 17:32:06 -04:00
|
|
|
|
2011-05-14 11:15:01 -04:00
|
|
|
mAccountDefaultQuotedTextShown = (CheckBoxPreference) findPreference(PREFERENCE_DEFAULT_QUOTED_TEXT_SHOWN);
|
|
|
|
mAccountDefaultQuotedTextShown.setChecked(mAccount.isDefaultQuotedTextShown());
|
|
|
|
|
2010-08-29 20:00:34 -04:00
|
|
|
mReplyAfterQuote = (CheckBoxPreference) findPreference(PREFERENCE_REPLY_AFTER_QUOTE);
|
|
|
|
mReplyAfterQuote.setChecked(mAccount.isReplyAfterQuote());
|
|
|
|
|
2011-11-14 16:58:01 -05:00
|
|
|
mStripSignature = (CheckBoxPreference) findPreference(PREFERENCE_STRIP_SIGNATURE);
|
|
|
|
mStripSignature.setChecked(mAccount.isStripSignature());
|
|
|
|
|
2011-01-05 18:58:14 -05:00
|
|
|
mComposingScreen = (PreferenceScreen) findPreference(PREFERENCE_SCREEN_COMPOSING);
|
|
|
|
|
2011-02-06 17:09:48 -05:00
|
|
|
Preference.OnPreferenceChangeListener quoteStyleListener = new Preference.OnPreferenceChangeListener() {
|
2011-01-05 18:58:14 -05:00
|
|
|
@Override
|
2011-02-06 17:09:48 -05:00
|
|
|
public boolean onPreferenceChange(Preference preference, Object newValue) {
|
2011-01-05 18:58:14 -05:00
|
|
|
final QuoteStyle style = QuoteStyle.valueOf(newValue.toString());
|
|
|
|
int index = mQuoteStyle.findIndexOfValue(newValue.toString());
|
|
|
|
mQuoteStyle.setSummary(mQuoteStyle.getEntries()[index]);
|
2011-02-06 17:09:48 -05:00
|
|
|
if (style == QuoteStyle.PREFIX) {
|
2011-01-05 18:58:14 -05:00
|
|
|
mComposingScreen.addPreference(mAccountQuotePrefix);
|
|
|
|
mComposingScreen.addPreference(mReplyAfterQuote);
|
2011-02-06 17:09:48 -05:00
|
|
|
} else if (style == QuoteStyle.HEADER) {
|
2011-01-05 18:58:14 -05:00
|
|
|
mComposingScreen.removePreference(mAccountQuotePrefix);
|
|
|
|
mComposingScreen.removePreference(mReplyAfterQuote);
|
|
|
|
}
|
|
|
|
return true;
|
|
|
|
}
|
2011-01-06 02:05:57 -05:00
|
|
|
};
|
|
|
|
mQuoteStyle = (ListPreference) findPreference(PREFERENCE_QUOTE_STYLE);
|
|
|
|
mQuoteStyle.setValue(mAccount.getQuoteStyle().name());
|
|
|
|
mQuoteStyle.setSummary(mQuoteStyle.getEntry());
|
|
|
|
mQuoteStyle.setOnPreferenceChangeListener(quoteStyleListener);
|
|
|
|
// Call the onPreferenceChange() handler on startup to update the Preference dialogue based
|
|
|
|
// upon the existing quote style setting.
|
|
|
|
quoteStyleListener.onPreferenceChange(mQuoteStyle, mAccount.getQuoteStyle().name());
|
2011-01-05 18:58:14 -05:00
|
|
|
|
2008-11-01 17:32:06 -04:00
|
|
|
mCheckFrequency = (ListPreference) findPreference(PREFERENCE_FREQUENCY);
|
|
|
|
mCheckFrequency.setValue(String.valueOf(mAccount.getAutomaticCheckIntervalMinutes()));
|
|
|
|
mCheckFrequency.setSummary(mCheckFrequency.getEntry());
|
2011-02-06 17:09:48 -05:00
|
|
|
mCheckFrequency.setOnPreferenceChangeListener(new Preference.OnPreferenceChangeListener() {
|
|
|
|
public boolean onPreferenceChange(Preference preference, Object newValue) {
|
2008-11-01 17:32:06 -04:00
|
|
|
final String summary = newValue.toString();
|
|
|
|
int index = mCheckFrequency.findIndexOfValue(summary);
|
|
|
|
mCheckFrequency.setSummary(mCheckFrequency.getEntries()[index]);
|
|
|
|
mCheckFrequency.setValue(summary);
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
});
|
2009-11-21 17:45:39 -05: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
|
|
|
mDisplayMode = (ListPreference) findPreference(PREFERENCE_DISPLAY_MODE);
|
|
|
|
mDisplayMode.setValue(mAccount.getFolderDisplayMode().name());
|
|
|
|
mDisplayMode.setSummary(mDisplayMode.getEntry());
|
2011-02-06 17:09:48 -05:00
|
|
|
mDisplayMode.setOnPreferenceChangeListener(new Preference.OnPreferenceChangeListener() {
|
|
|
|
public boolean onPreferenceChange(Preference preference, Object newValue) {
|
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
|
|
|
final String summary = newValue.toString();
|
|
|
|
int index = mDisplayMode.findIndexOfValue(summary);
|
|
|
|
mDisplayMode.setSummary(mDisplayMode.getEntries()[index]);
|
|
|
|
mDisplayMode.setValue(summary);
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
});
|
2009-11-21 17:45:39 -05: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
|
|
|
mSyncMode = (ListPreference) findPreference(PREFERENCE_SYNC_MODE);
|
|
|
|
mSyncMode.setValue(mAccount.getFolderSyncMode().name());
|
|
|
|
mSyncMode.setSummary(mSyncMode.getEntry());
|
2011-02-06 17:09:48 -05:00
|
|
|
mSyncMode.setOnPreferenceChangeListener(new Preference.OnPreferenceChangeListener() {
|
|
|
|
public boolean onPreferenceChange(Preference preference, Object newValue) {
|
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
|
|
|
final String summary = newValue.toString();
|
|
|
|
int index = mSyncMode.findIndexOfValue(summary);
|
|
|
|
mSyncMode.setSummary(mSyncMode.getEntries()[index]);
|
|
|
|
mSyncMode.setValue(summary);
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
});
|
2009-11-21 17:45:39 -05:00
|
|
|
|
2010-01-02 20:50:51 -05:00
|
|
|
|
2009-03-05 02:32:45 -05:00
|
|
|
mTargetMode = (ListPreference) findPreference(PREFERENCE_TARGET_MODE);
|
|
|
|
mTargetMode.setValue(mAccount.getFolderTargetMode().name());
|
|
|
|
mTargetMode.setSummary(mTargetMode.getEntry());
|
2011-02-06 17:09:48 -05:00
|
|
|
mTargetMode.setOnPreferenceChangeListener(new Preference.OnPreferenceChangeListener() {
|
|
|
|
public boolean onPreferenceChange(Preference preference, Object newValue) {
|
2009-03-05 02:32:45 -05:00
|
|
|
final String summary = newValue.toString();
|
|
|
|
int index = mTargetMode.findIndexOfValue(summary);
|
|
|
|
mTargetMode.setSummary(mTargetMode.getEntries()[index]);
|
|
|
|
mTargetMode.setValue(summary);
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
});
|
2009-11-21 17:45:39 -05: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
|
|
|
mDeletePolicy = (ListPreference) findPreference(PREFERENCE_DELETE_POLICY);
|
|
|
|
mDeletePolicy.setValue("" + mAccount.getDeletePolicy());
|
|
|
|
mDeletePolicy.setSummary(mDeletePolicy.getEntry());
|
2011-02-06 17:09:48 -05:00
|
|
|
mDeletePolicy.setOnPreferenceChangeListener(new Preference.OnPreferenceChangeListener() {
|
|
|
|
public boolean onPreferenceChange(Preference preference, Object newValue) {
|
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
|
|
|
final String summary = newValue.toString();
|
|
|
|
int index = mDeletePolicy.findIndexOfValue(summary);
|
|
|
|
mDeletePolicy.setSummary(mDeletePolicy.getEntries()[index]);
|
|
|
|
mDeletePolicy.setValue(summary);
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
});
|
2010-01-02 20:50:51 -05:00
|
|
|
|
2011-07-13 22:15:36 -04:00
|
|
|
|
Implementation of complete IMAP two-phase "delete/expunge" behavior.
On each IMAP account, the expunge behavior can be set to expunge
messages in a folder as soon as a move or delete is performed on the
folder ("immediately"), each time the folder is polled, or only when
executed manually.
In the Message List, there is now an Expunge action in the option
menu.
In the Folder List, there is now an Expunge action in the context
menu (long-press on the folder).
For IMAP accounts, it is also possible to disable the copying of deleted messages to the
Trash folder, by setting the Trash folder to -NONE-.
Fixes Issue 536.
Separately, in WebDAV accounts, the user can now choose the
server-side equivalents of the special folders, just like for IMAP.
2009-12-20 18:13:49 -05:00
|
|
|
mExpungePolicy = (ListPreference) findPreference(PREFERENCE_EXPUNGE_POLICY);
|
2011-07-13 22:15:36 -04:00
|
|
|
if (mIsExpungeCapable) {
|
2012-02-21 09:16:36 -05:00
|
|
|
mExpungePolicy.setValue(mAccount.getExpungePolicy());
|
|
|
|
mExpungePolicy.setSummary(mExpungePolicy.getEntry());
|
|
|
|
mExpungePolicy.setOnPreferenceChangeListener(new Preference.OnPreferenceChangeListener() {
|
|
|
|
public boolean onPreferenceChange(Preference preference, Object newValue) {
|
|
|
|
final String summary = newValue.toString();
|
|
|
|
int index = mExpungePolicy.findIndexOfValue(summary);
|
|
|
|
mExpungePolicy.setSummary(mExpungePolicy.getEntries()[index]);
|
|
|
|
mExpungePolicy.setValue(summary);
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
});
|
2011-07-13 22:15:36 -04:00
|
|
|
} else {
|
|
|
|
((PreferenceScreen) findPreference(PREFERENCE_SCREEN_INCOMING)).removePreference(mExpungePolicy);
|
|
|
|
}
|
|
|
|
|
2010-07-06 06:29:26 -04:00
|
|
|
|
2010-07-03 09:10:38 -04:00
|
|
|
mSyncRemoteDeletions = (CheckBoxPreference) findPreference(PREFERENCE_SYNC_REMOTE_DELETIONS);
|
|
|
|
mSyncRemoteDeletions.setChecked(mAccount.syncRemoteDeletions());
|
2010-04-29 00:59:14 -04:00
|
|
|
|
2010-10-10 20:08:39 -04:00
|
|
|
mSaveAllHeaders = (CheckBoxPreference) findPreference(PREFERENCE_SAVE_ALL_HEADERS);
|
|
|
|
mSaveAllHeaders.setChecked(mAccount.saveAllHeaders());
|
|
|
|
|
2010-04-05 22:54:48 -04:00
|
|
|
mSearchableFolders = (ListPreference) findPreference(PREFERENCE_SEARCHABLE_FOLDERS);
|
|
|
|
mSearchableFolders.setValue(mAccount.getSearchableFolders().name());
|
|
|
|
mSearchableFolders.setSummary(mSearchableFolders.getEntry());
|
2011-02-06 17:09:48 -05:00
|
|
|
mSearchableFolders.setOnPreferenceChangeListener(new Preference.OnPreferenceChangeListener() {
|
|
|
|
public boolean onPreferenceChange(Preference preference, Object newValue) {
|
2010-04-05 22:54:48 -04:00
|
|
|
final String summary = newValue.toString();
|
|
|
|
int index = mSearchableFolders.findIndexOfValue(summary);
|
|
|
|
mSearchableFolders.setSummary(mSearchableFolders.getEntries()[index]);
|
|
|
|
mSearchableFolders.setValue(summary);
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
});
|
2010-01-02 20:50:51 -05:00
|
|
|
|
2008-12-11 00:25:59 -05:00
|
|
|
mDisplayCount = (ListPreference) findPreference(PREFERENCE_DISPLAY_COUNT);
|
|
|
|
mDisplayCount.setValue(String.valueOf(mAccount.getDisplayCount()));
|
|
|
|
mDisplayCount.setSummary(mDisplayCount.getEntry());
|
2011-02-06 17:09:48 -05:00
|
|
|
mDisplayCount.setOnPreferenceChangeListener(new Preference.OnPreferenceChangeListener() {
|
|
|
|
public boolean onPreferenceChange(Preference preference, Object newValue) {
|
2008-12-11 00:25:59 -05:00
|
|
|
final String summary = newValue.toString();
|
|
|
|
int index = mDisplayCount.findIndexOfValue(summary);
|
|
|
|
mDisplayCount.setSummary(mDisplayCount.getEntries()[index]);
|
|
|
|
mDisplayCount.setValue(summary);
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
});
|
2010-07-05 09:41:52 -04:00
|
|
|
|
2012-02-21 09:16:36 -05:00
|
|
|
|
2011-07-12 21:47:37 -04:00
|
|
|
|
2010-05-30 17:20:47 -04:00
|
|
|
mMessageAge = (ListPreference) findPreference(PREFERENCE_MESSAGE_AGE);
|
2011-07-12 21:47:37 -04:00
|
|
|
|
|
|
|
if (!mAccount.isSearchByDateCapable()) {
|
2011-07-13 22:15:36 -04:00
|
|
|
((PreferenceScreen) findPreference(PREFERENCE_SCREEN_INCOMING)).removePreference(mMessageAge);
|
|
|
|
} else {
|
2012-02-21 09:16:36 -05:00
|
|
|
mMessageAge.setValue(String.valueOf(mAccount.getMaximumPolledMessageAge()));
|
|
|
|
mMessageAge.setSummary(mMessageAge.getEntry());
|
|
|
|
mMessageAge.setOnPreferenceChangeListener(new Preference.OnPreferenceChangeListener() {
|
|
|
|
public boolean onPreferenceChange(Preference preference, Object newValue) {
|
|
|
|
final String summary = newValue.toString();
|
|
|
|
int index = mMessageAge.findIndexOfValue(summary);
|
|
|
|
mMessageAge.setSummary(mMessageAge.getEntries()[index]);
|
|
|
|
mMessageAge.setValue(summary);
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
2011-07-12 21:47:37 -04:00
|
|
|
}
|
2009-11-21 17:45:39 -05:00
|
|
|
|
2010-07-11 07:59:14 -04:00
|
|
|
mMessageSize = (ListPreference) findPreference(PREFERENCE_MESSAGE_SIZE);
|
|
|
|
mMessageSize.setValue(String.valueOf(mAccount.getMaximumAutoDownloadMessageSize()));
|
|
|
|
mMessageSize.setSummary(mMessageSize.getEntry());
|
2011-02-06 17:09:48 -05:00
|
|
|
mMessageSize.setOnPreferenceChangeListener(new Preference.OnPreferenceChangeListener() {
|
|
|
|
public boolean onPreferenceChange(Preference preference, Object newValue) {
|
2010-07-11 07:59:14 -04:00
|
|
|
final String summary = newValue.toString();
|
|
|
|
int index = mMessageSize.findIndexOfValue(summary);
|
|
|
|
mMessageSize.setSummary(mMessageSize.getEntries()[index]);
|
|
|
|
mMessageSize.setValue(summary);
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
2008-11-01 17:32:06 -04:00
|
|
|
mAccountDefault = (CheckBoxPreference) findPreference(PREFERENCE_DEFAULT);
|
|
|
|
mAccountDefault.setChecked(
|
2009-11-21 17:45:39 -05:00
|
|
|
mAccount.equals(Preferences.getPreferences(this).getDefaultAccount()));
|
2008-11-01 17:32:06 -04:00
|
|
|
|
2010-07-05 09:41:52 -04:00
|
|
|
mAccountEnableMoveButtons = (CheckBoxPreference) findPreference(PREFERENCE_ENABLE_MOVE_BUTTONS);
|
2011-04-01 00:44:50 -04:00
|
|
|
mAccountEnableMoveButtons.setEnabled(mIsMoveCapable);
|
2010-07-05 09:41:52 -04:00
|
|
|
mAccountEnableMoveButtons.setChecked(mAccount.getEnableMoveButtons());
|
|
|
|
|
2010-08-07 18:38:08 -04:00
|
|
|
mAccountShowPictures = (ListPreference) findPreference(PREFERENCE_SHOW_PICTURES);
|
|
|
|
mAccountShowPictures.setValue("" + mAccount.getShowPictures());
|
|
|
|
mAccountShowPictures.setSummary(mAccountShowPictures.getEntry());
|
2011-02-06 17:09:48 -05:00
|
|
|
mAccountShowPictures.setOnPreferenceChangeListener(new Preference.OnPreferenceChangeListener() {
|
|
|
|
public boolean onPreferenceChange(Preference preference, Object newValue) {
|
2010-08-07 18:38:08 -04:00
|
|
|
final String summary = newValue.toString();
|
|
|
|
int index = mAccountShowPictures.findIndexOfValue(summary);
|
|
|
|
mAccountShowPictures.setSummary(mAccountShowPictures.getEntries()[index]);
|
|
|
|
mAccountShowPictures.setValue(summary);
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
2010-10-10 20:08:47 -04:00
|
|
|
|
2010-11-13 16:40:56 -05:00
|
|
|
mLocalStorageProvider = (ListPreference) findPreference(PREFERENCE_LOCAL_STORAGE_PROVIDER);
|
|
|
|
{
|
|
|
|
final Map<String, String> providers;
|
|
|
|
providers = StorageManager.getInstance(K9.app).getAvailableProviders();
|
|
|
|
int i = 0;
|
|
|
|
final String[] providerLabels = new String[providers.size()];
|
|
|
|
final String[] providerIds = new String[providers.size()];
|
2011-02-06 17:09:48 -05:00
|
|
|
for (final Map.Entry<String, String> entry : providers.entrySet()) {
|
2010-11-13 16:40:56 -05:00
|
|
|
providerIds[i] = entry.getKey();
|
|
|
|
providerLabels[i] = entry.getValue();
|
|
|
|
i++;
|
|
|
|
}
|
|
|
|
mLocalStorageProvider.setEntryValues(providerIds);
|
|
|
|
mLocalStorageProvider.setEntries(providerLabels);
|
|
|
|
mLocalStorageProvider.setValue(mAccount.getLocalStorageProviderId());
|
2011-01-18 20:21:27 -05:00
|
|
|
mLocalStorageProvider.setSummary(providers.get(mAccount.getLocalStorageProviderId()));
|
2010-11-13 16:40:56 -05:00
|
|
|
|
2011-02-06 17:09:48 -05:00
|
|
|
mLocalStorageProvider.setOnPreferenceChangeListener(new Preference.OnPreferenceChangeListener() {
|
|
|
|
public boolean onPreferenceChange(Preference preference, Object newValue) {
|
2010-11-13 16:40:56 -05:00
|
|
|
mLocalStorageProvider.setSummary(providers.get(newValue));
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
});
|
|
|
|
}
|
2010-10-10 20:08:47 -04:00
|
|
|
// IMAP-specific preferences
|
|
|
|
|
|
|
|
mPushPollOnConnect = (CheckBoxPreference) findPreference(PREFERENCE_PUSH_POLL_ON_CONNECT);
|
|
|
|
mIdleRefreshPeriod = (ListPreference) findPreference(PREFERENCE_IDLE_REFRESH_PERIOD);
|
|
|
|
mMaxPushFolders = (ListPreference) findPreference(PREFERENCE_MAX_PUSH_FOLDERS);
|
2011-02-06 17:09:48 -05:00
|
|
|
if (mIsPushCapable) {
|
2010-10-10 20:08:47 -04:00
|
|
|
mPushPollOnConnect.setChecked(mAccount.isPushPollOnConnect());
|
|
|
|
|
|
|
|
mIdleRefreshPeriod.setValue(String.valueOf(mAccount.getIdleRefreshMinutes()));
|
|
|
|
mIdleRefreshPeriod.setSummary(mIdleRefreshPeriod.getEntry());
|
2011-02-06 17:09:48 -05:00
|
|
|
mIdleRefreshPeriod.setOnPreferenceChangeListener(new Preference.OnPreferenceChangeListener() {
|
|
|
|
public boolean onPreferenceChange(Preference preference, Object newValue) {
|
2010-10-10 20:08:47 -04:00
|
|
|
final String summary = newValue.toString();
|
|
|
|
int index = mIdleRefreshPeriod.findIndexOfValue(summary);
|
|
|
|
mIdleRefreshPeriod.setSummary(mIdleRefreshPeriod.getEntries()[index]);
|
|
|
|
mIdleRefreshPeriod.setValue(summary);
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
|
|
|
mMaxPushFolders.setValue(String.valueOf(mAccount.getMaxPushFolders()));
|
|
|
|
mMaxPushFolders.setSummary(mMaxPushFolders.getEntry());
|
2011-02-06 17:09:48 -05:00
|
|
|
mMaxPushFolders.setOnPreferenceChangeListener(new Preference.OnPreferenceChangeListener() {
|
|
|
|
public boolean onPreferenceChange(Preference preference, Object newValue) {
|
2010-10-10 20:08:47 -04:00
|
|
|
final String summary = newValue.toString();
|
|
|
|
int index = mMaxPushFolders.findIndexOfValue(summary);
|
|
|
|
mMaxPushFolders.setSummary(mMaxPushFolders.getEntries()[index]);
|
|
|
|
mMaxPushFolders.setValue(summary);
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
});
|
2012-02-21 09:16:36 -05:00
|
|
|
mPushMode = (ListPreference) findPreference(PREFERENCE_PUSH_MODE);
|
|
|
|
mPushMode.setValue(mAccount.getFolderPushMode().name());
|
|
|
|
mPushMode.setSummary(mPushMode.getEntry());
|
|
|
|
mPushMode.setOnPreferenceChangeListener(new Preference.OnPreferenceChangeListener() {
|
|
|
|
public boolean onPreferenceChange(Preference preference, Object newValue) {
|
|
|
|
final String summary = newValue.toString();
|
|
|
|
int index = mPushMode.findIndexOfValue(summary);
|
|
|
|
mPushMode.setSummary(mPushMode.getEntries()[index]);
|
|
|
|
mPushMode.setValue(summary);
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
});
|
2011-02-06 17:09:48 -05:00
|
|
|
} else {
|
2011-07-13 22:15:36 -04:00
|
|
|
PreferenceScreen incomingPrefs = (PreferenceScreen) findPreference(PREFERENCE_SCREEN_INCOMING);
|
|
|
|
incomingPrefs.removePreference( (PreferenceScreen) findPreference(PREFERENCE_SCREEN_PUSH_ADVANCED));
|
|
|
|
incomingPrefs.removePreference( (ListPreference) findPreference(PREFERENCE_PUSH_MODE));
|
2010-10-10 20:08:47 -04:00
|
|
|
}
|
|
|
|
|
2008-11-01 17:32:06 -04:00
|
|
|
mAccountNotify = (CheckBoxPreference) findPreference(PREFERENCE_NOTIFY);
|
|
|
|
mAccountNotify.setChecked(mAccount.isNotifyNewMail());
|
2009-11-24 19:40:29 -05:00
|
|
|
|
2009-11-22 14:42:44 -05:00
|
|
|
mAccountNotifySelf = (CheckBoxPreference) findPreference(PREFERENCE_NOTIFY_SELF);
|
|
|
|
mAccountNotifySelf.setChecked(mAccount.isNotifySelfNewMail());
|
2008-11-01 17:32:06 -04:00
|
|
|
|
2009-01-18 11:42:55 -05:00
|
|
|
mAccountNotifySync = (CheckBoxPreference) findPreference(PREFERENCE_NOTIFY_SYNC);
|
|
|
|
mAccountNotifySync.setChecked(mAccount.isShowOngoing());
|
|
|
|
|
2008-11-01 17:32:06 -04:00
|
|
|
mAccountRingtone = (RingtonePreference) findPreference(PREFERENCE_RINGTONE);
|
|
|
|
|
|
|
|
// XXX: The following two lines act as a workaround for the RingtonePreference
|
|
|
|
// which does not let us set/get the value programmatically
|
|
|
|
SharedPreferences prefs = mAccountRingtone.getPreferenceManager().getSharedPreferences();
|
2010-09-19 16:54:43 -04:00
|
|
|
String currentRingtone = (!mAccount.getNotificationSetting().shouldRing() ? null : mAccount.getNotificationSetting().getRingtone());
|
2010-01-17 13:14:17 -05:00
|
|
|
prefs.edit().putString(PREFERENCE_RINGTONE, currentRingtone).commit();
|
2010-01-17 17:49:03 -05:00
|
|
|
|
2008-11-01 17:32:06 -04:00
|
|
|
mAccountVibrate = (CheckBoxPreference) findPreference(PREFERENCE_VIBRATE);
|
2010-11-28 15:29:09 -05:00
|
|
|
mAccountVibrate.setChecked(mAccount.getNotificationSetting().shouldVibrate());
|
2010-05-15 15:46:16 -04:00
|
|
|
|
2010-07-02 10:47:01 -04:00
|
|
|
mAccountVibratePattern = (ListPreference) findPreference(PREFERENCE_VIBRATE_PATTERN);
|
2010-09-19 16:54:43 -04:00
|
|
|
mAccountVibratePattern.setValue(String.valueOf(mAccount.getNotificationSetting().getVibratePattern()));
|
2010-07-02 10:47:01 -04:00
|
|
|
mAccountVibratePattern.setSummary(mAccountVibratePattern.getEntry());
|
2011-02-06 17:09:48 -05:00
|
|
|
mAccountVibratePattern.setOnPreferenceChangeListener(new Preference.OnPreferenceChangeListener() {
|
|
|
|
public boolean onPreferenceChange(Preference preference, Object newValue) {
|
2010-07-02 10:47:01 -04:00
|
|
|
final String summary = newValue.toString();
|
|
|
|
int index = mAccountVibratePattern.findIndexOfValue(summary);
|
|
|
|
mAccountVibratePattern.setSummary(mAccountVibratePattern.getEntries()[index]);
|
|
|
|
mAccountVibratePattern.setValue(summary);
|
2010-08-28 10:00:34 -04:00
|
|
|
doVibrateTest(preference);
|
2010-07-02 10:47:01 -04:00
|
|
|
return false;
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
2010-08-28 10:00:34 -04:00
|
|
|
mAccountVibrateTimes = (ListPreference) findPreference(PREFERENCE_VIBRATE_TIMES);
|
2010-09-19 16:54:43 -04:00
|
|
|
mAccountVibrateTimes.setValue(String.valueOf(mAccount.getNotificationSetting().getVibrateTimes()));
|
|
|
|
mAccountVibrateTimes.setSummary(String.valueOf(mAccount.getNotificationSetting().getVibrateTimes()));
|
2011-02-06 17:09:48 -05:00
|
|
|
mAccountVibrateTimes.setOnPreferenceChangeListener(new Preference.OnPreferenceChangeListener() {
|
2010-07-02 10:47:01 -04:00
|
|
|
@Override
|
2011-02-06 17:09:48 -05:00
|
|
|
public boolean onPreferenceChange(Preference preference, Object newValue) {
|
2010-07-02 10:47:01 -04:00
|
|
|
final String value = newValue.toString();
|
|
|
|
mAccountVibrateTimes.setSummary(value);
|
2010-08-28 10:00:34 -04:00
|
|
|
mAccountVibrateTimes.setValue(value);
|
|
|
|
doVibrateTest(preference);
|
2010-07-02 10:47:01 -04:00
|
|
|
return false;
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
2010-09-19 16:54:43 -04:00
|
|
|
mAccountLed = (CheckBoxPreference) findPreference(PREFERENCE_NOTIFICATION_LED);
|
|
|
|
mAccountLed.setChecked(mAccount.getNotificationSetting().isLed());
|
|
|
|
|
2010-05-12 01:35:08 -04:00
|
|
|
mNotificationOpensUnread = (CheckBoxPreference)findPreference(PREFERENCE_NOTIFICATION_OPENS_UNREAD);
|
|
|
|
mNotificationOpensUnread.setChecked(mAccount.goToUnreadMessageSearch());
|
2010-05-15 15:46:16 -04:00
|
|
|
|
2011-01-11 20:23:17 -05:00
|
|
|
mNotificationUnreadCount = (CheckBoxPreference)findPreference(PREFERENCE_NOTIFICATION_UNREAD_COUNT);
|
|
|
|
mNotificationUnreadCount.setChecked(mAccount.isNotificationShowsUnreadCount());
|
|
|
|
|
2010-12-24 17:48:29 -05:00
|
|
|
new PopulateFolderPrefsTask().execute();
|
2010-04-25 04:47:24 -04:00
|
|
|
|
2010-11-30 22:06:12 -05:00
|
|
|
mChipColor = findPreference(PREFERENCE_CHIP_COLOR);
|
2011-02-06 17:09:48 -05:00
|
|
|
mChipColor.setOnPreferenceClickListener(new Preference.OnPreferenceClickListener() {
|
|
|
|
public boolean onPreferenceClick(Preference preference) {
|
2010-04-25 04:47:24 -04:00
|
|
|
onChooseChipColor();
|
|
|
|
return false;
|
|
|
|
}
|
2010-10-13 16:56:44 -04:00
|
|
|
});
|
2010-04-25 04:47:24 -04:00
|
|
|
|
2010-11-30 22:06:12 -05:00
|
|
|
mLedColor = findPreference(PREFERENCE_LED_COLOR);
|
2011-02-06 17:09:48 -05:00
|
|
|
mLedColor.setOnPreferenceClickListener(new Preference.OnPreferenceClickListener() {
|
|
|
|
public boolean onPreferenceClick(Preference preference) {
|
2010-05-15 16:35:59 -04:00
|
|
|
onChooseLedColor();
|
|
|
|
return false;
|
|
|
|
}
|
2010-10-13 16:56:44 -04:00
|
|
|
});
|
2009-11-21 17:45:39 -05:00
|
|
|
|
2008-11-01 17:32:06 -04:00
|
|
|
findPreference(PREFERENCE_COMPOSITION).setOnPreferenceClickListener(
|
2011-02-06 17:09:48 -05:00
|
|
|
new Preference.OnPreferenceClickListener() {
|
|
|
|
public boolean onPreferenceClick(Preference preference) {
|
2009-11-21 17:45:39 -05:00
|
|
|
onCompositionSettings();
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
});
|
2008-11-01 17:32:06 -04:00
|
|
|
|
2009-06-08 23:11:35 -04:00
|
|
|
findPreference(PREFERENCE_MANAGE_IDENTITIES).setOnPreferenceClickListener(
|
2011-02-06 17:09:48 -05:00
|
|
|
new Preference.OnPreferenceClickListener() {
|
|
|
|
public boolean onPreferenceClick(Preference preference) {
|
2009-11-21 17:45:39 -05:00
|
|
|
onManageIdentities();
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
});
|
2009-06-08 23:11:35 -04:00
|
|
|
|
2008-11-01 17:32:06 -04:00
|
|
|
findPreference(PREFERENCE_INCOMING).setOnPreferenceClickListener(
|
2011-02-06 17:09:48 -05:00
|
|
|
new Preference.OnPreferenceClickListener() {
|
|
|
|
public boolean onPreferenceClick(Preference preference) {
|
2010-02-07 16:23:33 -05:00
|
|
|
mIncomingChanged = true;
|
2009-11-21 17:45:39 -05:00
|
|
|
onIncomingSettings();
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
});
|
2008-11-01 17:32:06 -04:00
|
|
|
|
|
|
|
findPreference(PREFERENCE_OUTGOING).setOnPreferenceClickListener(
|
2011-02-06 17:09:48 -05:00
|
|
|
new Preference.OnPreferenceClickListener() {
|
|
|
|
public boolean onPreferenceClick(Preference preference) {
|
2009-11-21 17:45:39 -05:00
|
|
|
onOutgoingSettings();
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
});
|
2010-07-27 08:10:09 -04:00
|
|
|
|
|
|
|
mCryptoApp = (ListPreference) findPreference(PREFERENCE_CRYPTO_APP);
|
|
|
|
CharSequence cryptoAppEntries[] = mCryptoApp.getEntries();
|
2011-02-06 17:09:48 -05:00
|
|
|
if (!new Apg().isAvailable(this)) {
|
2010-07-27 08:10:09 -04:00
|
|
|
int apgIndex = mCryptoApp.findIndexOfValue(Apg.NAME);
|
2011-02-06 17:09:48 -05:00
|
|
|
if (apgIndex >= 0) {
|
2010-07-27 08:10:09 -04:00
|
|
|
cryptoAppEntries[apgIndex] = "APG (" + getResources().getString(R.string.account_settings_crypto_app_not_available) + ")";
|
|
|
|
mCryptoApp.setEntries(cryptoAppEntries);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
mCryptoApp.setValue(String.valueOf(mAccount.getCryptoApp()));
|
|
|
|
mCryptoApp.setSummary(mCryptoApp.getEntry());
|
2011-02-06 17:09:48 -05:00
|
|
|
mCryptoApp.setOnPreferenceChangeListener(new Preference.OnPreferenceChangeListener() {
|
|
|
|
public boolean onPreferenceChange(Preference preference, Object newValue) {
|
2010-07-27 08:10:09 -04:00
|
|
|
String value = newValue.toString();
|
|
|
|
int index = mCryptoApp.findIndexOfValue(value);
|
|
|
|
mCryptoApp.setSummary(mCryptoApp.getEntries()[index]);
|
|
|
|
mCryptoApp.setValue(value);
|
|
|
|
handleCryptoAppDependencies();
|
2011-02-06 17:09:48 -05:00
|
|
|
if (Apg.NAME.equals(value)) {
|
2010-07-27 08:10:09 -04:00
|
|
|
Apg.createInstance(null).test(AccountSettings.this);
|
|
|
|
}
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
|
|
|
mCryptoAutoSignature = (CheckBoxPreference) findPreference(PREFERENCE_CRYPTO_AUTO_SIGNATURE);
|
|
|
|
mCryptoAutoSignature.setChecked(mAccount.getCryptoAutoSignature());
|
|
|
|
|
2011-11-19 01:49:04 -05:00
|
|
|
mCryptoAutoEncrypt = (CheckBoxPreference) findPreference(PREFERENCE_CRYPTO_AUTO_ENCRYPT);
|
|
|
|
mCryptoAutoEncrypt.setChecked(mAccount.isCryptoAutoEncrypt());
|
|
|
|
|
2010-07-27 08:10:09 -04:00
|
|
|
handleCryptoAppDependencies();
|
|
|
|
}
|
|
|
|
|
2011-02-06 17:09:48 -05:00
|
|
|
private void handleCryptoAppDependencies() {
|
|
|
|
if ("".equals(mCryptoApp.getValue())) {
|
2010-07-27 08:10:09 -04:00
|
|
|
mCryptoAutoSignature.setEnabled(false);
|
2011-11-19 01:49:04 -05:00
|
|
|
mCryptoAutoEncrypt.setEnabled(false);
|
2011-02-06 17:09:48 -05:00
|
|
|
} else {
|
2010-07-27 08:10:09 -04:00
|
|
|
mCryptoAutoSignature.setEnabled(true);
|
2011-11-19 01:49:04 -05:00
|
|
|
mCryptoAutoEncrypt.setEnabled(true);
|
2010-07-27 08:10:09 -04:00
|
|
|
}
|
2008-11-01 17:32:06 -04:00
|
|
|
}
|
|
|
|
|
2011-02-06 17:09:48 -05:00
|
|
|
private void saveSettings() {
|
|
|
|
if (mAccountDefault.isChecked()) {
|
2008-11-01 17:32:06 -04:00
|
|
|
Preferences.getPreferences(this).setDefaultAccount(mAccount);
|
|
|
|
}
|
2010-02-07 16:23:33 -05:00
|
|
|
|
2008-11-01 17:32:06 -04:00
|
|
|
mAccount.setDescription(mAccountDescription.getText());
|
2012-03-18 23:44:41 -04:00
|
|
|
mAccount.setMarkMessageAsReadOnView(mMarkMessageAsReadOnView.isChecked());
|
2008-11-01 17:32:06 -04:00
|
|
|
mAccount.setNotifyNewMail(mAccountNotify.isChecked());
|
2009-11-22 14:42:44 -05:00
|
|
|
mAccount.setNotifySelfNewMail(mAccountNotifySelf.isChecked());
|
2009-01-18 11:42:55 -05:00
|
|
|
mAccount.setShowOngoing(mAccountNotifySync.isChecked());
|
2008-12-11 00:25:59 -05:00
|
|
|
mAccount.setDisplayCount(Integer.parseInt(mDisplayCount.getValue()));
|
2010-07-11 07:59:14 -04:00
|
|
|
mAccount.setMaximumAutoDownloadMessageSize(Integer.parseInt(mMessageSize.getValue()));
|
2011-07-12 21:47:37 -04:00
|
|
|
if (mAccount.isSearchByDateCapable()) {
|
|
|
|
mAccount.setMaximumPolledMessageAge(Integer.parseInt(mMessageAge.getValue()));
|
|
|
|
}
|
2010-09-19 16:54:43 -04:00
|
|
|
mAccount.getNotificationSetting().setVibrate(mAccountVibrate.isChecked());
|
|
|
|
mAccount.getNotificationSetting().setVibratePattern(Integer.parseInt(mAccountVibratePattern.getValue()));
|
|
|
|
mAccount.getNotificationSetting().setVibrateTimes(Integer.parseInt(mAccountVibrateTimes.getValue()));
|
|
|
|
mAccount.getNotificationSetting().setLed(mAccountLed.isChecked());
|
2010-05-12 01:35:08 -04:00
|
|
|
mAccount.setGoToUnreadMessageSearch(mNotificationOpensUnread.isChecked());
|
2011-01-11 20:23:17 -05:00
|
|
|
mAccount.setNotificationShowsUnreadCount(mNotificationUnreadCount.isChecked());
|
2009-03-05 02:32:45 -05:00
|
|
|
mAccount.setFolderTargetMode(Account.FolderMode.valueOf(mTargetMode.getValue()));
|
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
|
|
|
mAccount.setDeletePolicy(Integer.parseInt(mDeletePolicy.getValue()));
|
2011-07-13 22:15:36 -04:00
|
|
|
if (mIsExpungeCapable) {
|
|
|
|
mAccount.setExpungePolicy(mExpungePolicy.getValue());
|
2011-12-25 17:45:10 -05:00
|
|
|
}
|
2010-07-03 09:10:38 -04:00
|
|
|
mAccount.setSyncRemoteDeletions(mSyncRemoteDeletions.isChecked());
|
2010-10-10 20:08:39 -04:00
|
|
|
mAccount.setSaveAllHeaders(mSaveAllHeaders.isChecked());
|
2010-04-05 22:54:48 -04:00
|
|
|
mAccount.setSearchableFolders(Account.Searchable.valueOf(mSearchableFolders.getValue()));
|
2011-01-12 18:48:28 -05:00
|
|
|
mAccount.setMessageFormat(Account.MessageFormat.valueOf(mMessageFormat.getValue()));
|
2011-08-27 20:42:27 -04:00
|
|
|
mAccount.setMessageReadReceipt(mMessageReadReceipt.isChecked());
|
2011-01-05 18:58:14 -05:00
|
|
|
mAccount.setQuoteStyle(QuoteStyle.valueOf(mQuoteStyle.getValue()));
|
2010-06-20 10:07:03 -04:00
|
|
|
mAccount.setQuotePrefix(mAccountQuotePrefix.getText());
|
2011-05-14 11:15:01 -04:00
|
|
|
mAccount.setDefaultQuotedTextShown(mAccountDefaultQuotedTextShown.isChecked());
|
2010-08-29 20:00:34 -04:00
|
|
|
mAccount.setReplyAfterQuote(mReplyAfterQuote.isChecked());
|
2011-11-14 16:58:01 -05:00
|
|
|
mAccount.setStripSignature(mStripSignature.isChecked());
|
2010-07-27 08:10:09 -04:00
|
|
|
mAccount.setCryptoApp(mCryptoApp.getValue());
|
|
|
|
mAccount.setCryptoAutoSignature(mCryptoAutoSignature.isChecked());
|
2011-11-19 01:49:04 -05:00
|
|
|
mAccount.setCryptoAutoEncrypt(mCryptoAutoEncrypt.isChecked());
|
2010-11-13 16:40:56 -05:00
|
|
|
mAccount.setLocalStorageProviderId(mLocalStorageProvider.getValue());
|
|
|
|
|
2011-04-05 05:14:56 -04:00
|
|
|
// In webdav account we use the exact folder name also for inbox,
|
|
|
|
// since it varies because of internationalization
|
2011-04-12 08:17:22 -04:00
|
|
|
if (mAccount.getStoreUri().startsWith("webdav"))
|
|
|
|
mAccount.setAutoExpandFolderName(mAutoExpandFolder.getValue());
|
2011-04-05 05:14:56 -04:00
|
|
|
else
|
2011-04-12 08:17:22 -04:00
|
|
|
mAccount.setAutoExpandFolderName(reverseTranslateFolder(mAutoExpandFolder.getValue()));
|
2011-04-05 05:14:56 -04:00
|
|
|
|
2012-02-24 23:05:21 -05:00
|
|
|
if (mIsMoveCapable) {
|
|
|
|
mAccount.setArchiveFolderName(mArchiveFolder.getValue());
|
|
|
|
mAccount.setDraftsFolderName(mDraftsFolder.getValue());
|
|
|
|
mAccount.setSentFolderName(mSentFolder.getValue());
|
|
|
|
mAccount.setSpamFolderName(mSpamFolder.getValue());
|
|
|
|
mAccount.setTrashFolderName(mTrashFolder.getValue());
|
|
|
|
}
|
2010-11-16 22:43:02 -05:00
|
|
|
|
2010-04-29 00:59:14 -04:00
|
|
|
|
2011-02-06 17:09:48 -05:00
|
|
|
if (mIsPushCapable) {
|
2010-10-13 16:49:34 -04:00
|
|
|
mAccount.setPushPollOnConnect(mPushPollOnConnect.isChecked());
|
|
|
|
mAccount.setIdleRefreshMinutes(Integer.parseInt(mIdleRefreshPeriod.getValue()));
|
|
|
|
mAccount.setMaxPushFolders(Integer.parseInt(mMaxPushFolders.getValue()));
|
|
|
|
}
|
2010-10-10 20:08:47 -04:00
|
|
|
|
2011-04-01 00:44:50 -04:00
|
|
|
if (!mIsMoveCapable) {
|
|
|
|
mAccount.setEnableMoveButtons(false);
|
|
|
|
} else {
|
|
|
|
mAccount.setEnableMoveButtons(mAccountEnableMoveButtons.isChecked());
|
|
|
|
}
|
|
|
|
|
2010-02-07 16:23:33 -05:00
|
|
|
boolean needsRefresh = mAccount.setAutomaticCheckIntervalMinutes(Integer.parseInt(mCheckFrequency.getValue()));
|
|
|
|
needsRefresh |= mAccount.setFolderSyncMode(Account.FolderMode.valueOf(mSyncMode.getValue()));
|
2010-04-29 00:59:14 -04:00
|
|
|
|
2010-05-22 10:28:04 -04:00
|
|
|
boolean displayModeChanged = mAccount.setFolderDisplayMode(Account.FolderMode.valueOf(mDisplayMode.getValue()));
|
2010-05-30 00:17:00 -04:00
|
|
|
|
2008-11-01 17:32:06 -04:00
|
|
|
SharedPreferences prefs = mAccountRingtone.getPreferenceManager().getSharedPreferences();
|
2010-01-17 13:14:17 -05:00
|
|
|
String newRingtone = prefs.getString(PREFERENCE_RINGTONE, null);
|
2011-02-06 17:09:48 -05:00
|
|
|
if (newRingtone != null) {
|
2010-09-19 16:54:43 -04:00
|
|
|
mAccount.getNotificationSetting().setRing(true);
|
|
|
|
mAccount.getNotificationSetting().setRingtone(newRingtone);
|
2011-02-06 17:09:48 -05:00
|
|
|
} else {
|
|
|
|
if (mAccount.getNotificationSetting().shouldRing()) {
|
2010-09-19 16:54:43 -04:00
|
|
|
mAccount.getNotificationSetting().setRingtone(null);
|
2010-01-17 13:14:17 -05:00
|
|
|
}
|
|
|
|
}
|
2010-01-17 17:49:03 -05:00
|
|
|
|
2010-08-07 18:38:08 -04:00
|
|
|
mAccount.setShowPictures(Account.ShowPictures.valueOf(mAccountShowPictures.getValue()));
|
2012-02-21 09:16:36 -05:00
|
|
|
|
|
|
|
if (mIsPushCapable) {
|
|
|
|
boolean needsPushRestart = mAccount.setFolderPushMode(Account.FolderMode.valueOf(mPushMode.getValue()));
|
|
|
|
if (mAccount.getFolderPushMode() != FolderMode.NONE) {
|
|
|
|
needsPushRestart |= displayModeChanged;
|
|
|
|
needsPushRestart |= mIncomingChanged;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (needsRefresh && needsPushRestart) {
|
|
|
|
MailService.actionReset(this, null);
|
|
|
|
} else if (needsRefresh) {
|
|
|
|
MailService.actionReschedulePoll(this, null);
|
|
|
|
} else if (needsPushRestart) {
|
|
|
|
MailService.actionRestartPushers(this, null);
|
|
|
|
}
|
|
|
|
}
|
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
|
|
|
// TODO: refresh folder list here
|
2012-01-06 20:12:40 -05:00
|
|
|
mAccount.save(Preferences.getPreferences(this));
|
2008-11-01 17:32:06 -04:00
|
|
|
}
|
2009-11-21 17:45:39 -05:00
|
|
|
|
2009-04-08 14:14:52 -04:00
|
|
|
@Override
|
2011-02-06 17:09:48 -05:00
|
|
|
public void onActivityResult(int requestCode, int resultCode, Intent data) {
|
|
|
|
if (resultCode == RESULT_OK) {
|
|
|
|
switch (requestCode) {
|
|
|
|
case SELECT_AUTO_EXPAND_FOLDER:
|
|
|
|
mAutoExpandFolder.setSummary(translateFolder(data.getStringExtra(ChooseFolder.EXTRA_NEW_FOLDER)));
|
|
|
|
break;
|
2009-11-21 17:45:39 -05:00
|
|
|
}
|
2009-04-08 14:14:52 -04:00
|
|
|
}
|
2009-04-28 08:23:57 -04:00
|
|
|
super.onActivityResult(requestCode, resultCode, data);
|
2009-04-08 14:14:52 -04:00
|
|
|
}
|
2008-11-01 17:32:06 -04:00
|
|
|
|
|
|
|
@Override
|
2012-01-06 20:27:10 -05:00
|
|
|
protected void onPause() {
|
2011-11-09 23:34:34 -05:00
|
|
|
saveSettings();
|
2012-01-06 20:27:10 -05:00
|
|
|
super.onPause();
|
2008-11-01 17:32:06 -04:00
|
|
|
}
|
|
|
|
|
2011-02-06 17:09:48 -05:00
|
|
|
private void onCompositionSettings() {
|
2008-11-01 17:32:06 -04:00
|
|
|
AccountSetupComposition.actionEditCompositionSettings(this, mAccount);
|
|
|
|
}
|
|
|
|
|
2011-02-06 17:09:48 -05:00
|
|
|
private void onManageIdentities() {
|
2009-11-21 17:45:39 -05:00
|
|
|
Intent intent = new Intent(this, ManageIdentities.class);
|
2010-03-03 23:00:30 -05:00
|
|
|
intent.putExtra(ChooseIdentity.EXTRA_ACCOUNT, mAccount.getUuid());
|
2009-11-21 17:45:39 -05:00
|
|
|
startActivityForResult(intent, ACTIVITY_MANAGE_IDENTITIES);
|
|
|
|
}
|
2009-06-08 23:11:35 -04:00
|
|
|
|
2011-02-06 17:09:48 -05:00
|
|
|
private void onIncomingSettings() {
|
2008-11-01 17:32:06 -04:00
|
|
|
AccountSetupIncoming.actionEditIncomingSettings(this, mAccount);
|
|
|
|
}
|
|
|
|
|
2011-02-06 17:09:48 -05:00
|
|
|
private void onOutgoingSettings() {
|
2008-11-01 17:32:06 -04:00
|
|
|
AccountSetupOutgoing.actionEditOutgoingSettings(this, mAccount);
|
|
|
|
}
|
|
|
|
|
2011-02-06 17:09:48 -05:00
|
|
|
public void onChooseChipColor() {
|
2012-06-06 09:09:45 -04:00
|
|
|
showDialog(DIALOG_COLOR_PICKER_ACCOUNT);
|
2010-04-25 04:47:24 -04:00
|
|
|
}
|
|
|
|
|
2012-06-06 09:09:45 -04:00
|
|
|
|
2011-02-06 17:09:48 -05:00
|
|
|
public void onChooseLedColor() {
|
2012-06-06 09:09:45 -04:00
|
|
|
showDialog(DIALOG_COLOR_PICKER_LED);
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public Dialog onCreateDialog(int id) {
|
|
|
|
Dialog dialog = null;
|
|
|
|
|
|
|
|
switch (id) {
|
|
|
|
case DIALOG_COLOR_PICKER_ACCOUNT: {
|
|
|
|
dialog = new ColorPickerDialog(this,
|
|
|
|
new ColorPickerDialog.OnColorChangedListener() {
|
|
|
|
public void colorChanged(int color) {
|
|
|
|
mAccount.setChipColor(color);
|
|
|
|
}
|
|
|
|
},
|
|
|
|
mAccount.getChipColor()).create();
|
|
|
|
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case DIALOG_COLOR_PICKER_LED: {
|
|
|
|
dialog = new ColorPickerDialog(this,
|
|
|
|
new ColorPickerDialog.OnColorChangedListener() {
|
|
|
|
public void colorChanged(int color) {
|
|
|
|
mAccount.getNotificationSetting().setLedColor(color);
|
|
|
|
}
|
|
|
|
},
|
|
|
|
mAccount.getNotificationSetting().getLedColor()).create();
|
|
|
|
|
|
|
|
break;
|
2010-05-15 16:35:59 -04:00
|
|
|
}
|
2012-06-06 09:09:45 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
return dialog;
|
2010-05-15 16:35:59 -04:00
|
|
|
}
|
|
|
|
|
2011-02-06 17:09:48 -05:00
|
|
|
public void onChooseAutoExpandFolder() {
|
2009-04-08 14:14:52 -04:00
|
|
|
Intent selectIntent = new Intent(this, ChooseFolder.class);
|
2010-03-03 23:00:30 -05:00
|
|
|
selectIntent.putExtra(ChooseFolder.EXTRA_ACCOUNT, mAccount.getUuid());
|
2009-04-08 14:14:52 -04:00
|
|
|
|
|
|
|
selectIntent.putExtra(ChooseFolder.EXTRA_CUR_FOLDER, mAutoExpandFolder.getSummary());
|
|
|
|
selectIntent.putExtra(ChooseFolder.EXTRA_SHOW_CURRENT, "yes");
|
|
|
|
selectIntent.putExtra(ChooseFolder.EXTRA_SHOW_FOLDER_NONE, "yes");
|
|
|
|
selectIntent.putExtra(ChooseFolder.EXTRA_SHOW_DISPLAYABLE_ONLY, "yes");
|
2009-11-21 17:45:39 -05:00
|
|
|
startActivityForResult(selectIntent, SELECT_AUTO_EXPAND_FOLDER);
|
2009-04-08 14:14:52 -04:00
|
|
|
}
|
2009-11-21 17:45:39 -05:00
|
|
|
|
2011-02-06 17:09:48 -05:00
|
|
|
private String translateFolder(String in) {
|
2011-04-05 05:14:56 -04:00
|
|
|
if (mAccount.getInboxFolderName().equalsIgnoreCase(in)) {
|
2009-11-21 17:45:39 -05:00
|
|
|
return getString(R.string.special_mailbox_name_inbox);
|
2011-02-06 17:09:48 -05:00
|
|
|
} else {
|
2009-11-21 17:45:39 -05:00
|
|
|
return in;
|
|
|
|
}
|
2009-04-08 14:14:52 -04:00
|
|
|
}
|
2009-11-21 17:45:39 -05:00
|
|
|
|
2011-02-06 17:09:48 -05:00
|
|
|
private String reverseTranslateFolder(String in) {
|
|
|
|
if (getString(R.string.special_mailbox_name_inbox).equals(in)) {
|
2011-04-05 05:14:56 -04:00
|
|
|
return mAccount.getInboxFolderName();
|
2011-02-06 17:09:48 -05:00
|
|
|
} else {
|
2009-11-21 17:45:39 -05:00
|
|
|
return in;
|
|
|
|
}
|
2009-04-08 14:14:52 -04:00
|
|
|
}
|
|
|
|
|
2011-02-06 17:09:48 -05:00
|
|
|
private void doVibrateTest(Preference preference) {
|
2010-08-28 10:00:34 -04:00
|
|
|
// Do the vibration to show the user what it's like.
|
|
|
|
Vibrator vibrate = (Vibrator)preference.getContext().getSystemService(Context.VIBRATOR_SERVICE);
|
2010-11-28 15:29:14 -05:00
|
|
|
vibrate.vibrate(NotificationSetting.getVibration(
|
|
|
|
Integer.parseInt(mAccountVibratePattern.getValue()),
|
|
|
|
Integer.parseInt(mAccountVibrateTimes.getValue())), -1);
|
2010-08-28 10:00:34 -04:00
|
|
|
}
|
2010-12-24 17:48:26 -05:00
|
|
|
|
2011-02-06 17:09:48 -05:00
|
|
|
private class PopulateFolderPrefsTask extends AsyncTask<Void, Void, Void> {
|
|
|
|
List <? extends Folder > folders = new LinkedList<LocalFolder>();
|
2010-12-24 17:48:29 -05:00
|
|
|
String[] allFolderValues;
|
|
|
|
String[] allFolderLabels;
|
2011-01-18 18:54:49 -05:00
|
|
|
|
|
|
|
@Override
|
2011-02-06 17:09:48 -05:00
|
|
|
protected Void doInBackground(Void... params) {
|
|
|
|
try {
|
2010-12-24 17:48:29 -05:00
|
|
|
folders = mAccount.getLocalStore().getPersonalNamespaces(false);
|
2011-02-06 17:09:48 -05:00
|
|
|
} catch (Exception e) {
|
2010-12-24 17:48:29 -05:00
|
|
|
/// this can't be checked in
|
|
|
|
}
|
2010-12-24 17:48:26 -05:00
|
|
|
|
2011-02-19 22:47:28 -05:00
|
|
|
// TODO: In the future the call above should be changed to only return remote folders.
|
|
|
|
// For now we just remove the Outbox folder if present.
|
2011-03-22 03:07:32 -04:00
|
|
|
Iterator <? extends Folder > iter = folders.iterator();
|
|
|
|
while (iter.hasNext()) {
|
2011-02-19 22:47:28 -05:00
|
|
|
Folder folder = iter.next();
|
2011-05-07 17:57:47 -04:00
|
|
|
if (mAccount.getOutboxFolderName().equals(folder.getName())) {
|
2011-02-19 22:47:28 -05:00
|
|
|
iter.remove();
|
|
|
|
}
|
|
|
|
}
|
2010-12-24 17:48:26 -05:00
|
|
|
|
2011-07-16 16:10:20 -04:00
|
|
|
allFolderValues = new String[folders.size() + 1];
|
|
|
|
allFolderLabels = new String[folders.size() + 1];
|
2010-12-24 17:48:26 -05:00
|
|
|
|
2011-02-19 22:47:28 -05:00
|
|
|
allFolderValues[0] = K9.FOLDER_NONE;
|
|
|
|
allFolderLabels[0] = K9.FOLDER_NONE;
|
2010-12-24 17:48:29 -05:00
|
|
|
|
2011-02-19 22:47:28 -05:00
|
|
|
int i = 1;
|
2011-02-06 17:09:48 -05:00
|
|
|
for (Folder folder : folders) {
|
2010-12-24 17:48:29 -05:00
|
|
|
allFolderLabels[i] = folder.getName();
|
|
|
|
allFolderValues[i] = folder.getName();
|
|
|
|
i++;
|
|
|
|
}
|
|
|
|
return null;
|
2010-12-24 17:48:26 -05:00
|
|
|
}
|
|
|
|
|
2011-01-18 18:54:49 -05:00
|
|
|
@Override
|
2011-02-06 17:09:48 -05:00
|
|
|
protected void onPreExecute() {
|
2010-12-24 17:48:29 -05:00
|
|
|
mAutoExpandFolder = (ListPreference)findPreference(PREFERENCE_AUTO_EXPAND_FOLDER);
|
|
|
|
mAutoExpandFolder.setEnabled(false);
|
|
|
|
mArchiveFolder = (ListPreference)findPreference(PREFERENCE_ARCHIVE_FOLDER);
|
|
|
|
mArchiveFolder.setEnabled(false);
|
|
|
|
mDraftsFolder = (ListPreference)findPreference(PREFERENCE_DRAFTS_FOLDER);
|
|
|
|
mDraftsFolder.setEnabled(false);
|
|
|
|
mSentFolder = (ListPreference)findPreference(PREFERENCE_SENT_FOLDER);
|
|
|
|
mSentFolder.setEnabled(false);
|
|
|
|
mSpamFolder = (ListPreference)findPreference(PREFERENCE_SPAM_FOLDER);
|
|
|
|
mSpamFolder.setEnabled(false);
|
|
|
|
mTrashFolder = (ListPreference)findPreference(PREFERENCE_TRASH_FOLDER);
|
|
|
|
mTrashFolder.setEnabled(false);
|
2010-12-24 17:48:26 -05:00
|
|
|
|
2012-02-24 23:05:21 -05:00
|
|
|
if (!mIsMoveCapable) {
|
|
|
|
PreferenceScreen foldersCategory =
|
|
|
|
(PreferenceScreen) findPreference(PREFERENCE_CATEGORY_FOLDERS);
|
|
|
|
foldersCategory.removePreference(mArchiveFolder);
|
|
|
|
foldersCategory.removePreference(mSpamFolder);
|
|
|
|
foldersCategory.removePreference(mDraftsFolder);
|
|
|
|
foldersCategory.removePreference(mSentFolder);
|
|
|
|
foldersCategory.removePreference(mTrashFolder);
|
|
|
|
}
|
2010-12-24 17:48:29 -05:00
|
|
|
}
|
2011-01-18 18:54:49 -05:00
|
|
|
|
|
|
|
@Override
|
2011-02-06 17:09:48 -05:00
|
|
|
protected void onPostExecute(Void res) {
|
|
|
|
initListPreference(mAutoExpandFolder, mAccount.getAutoExpandFolderName(), allFolderLabels, allFolderValues);
|
2010-12-24 17:48:29 -05:00
|
|
|
mAutoExpandFolder.setEnabled(true);
|
2012-02-24 23:05:21 -05:00
|
|
|
if (mIsMoveCapable) {
|
|
|
|
initListPreference(mArchiveFolder, mAccount.getArchiveFolderName(), allFolderLabels, allFolderValues);
|
|
|
|
initListPreference(mDraftsFolder, mAccount.getDraftsFolderName(), allFolderLabels, allFolderValues);
|
|
|
|
initListPreference(mSentFolder, mAccount.getSentFolderName(), allFolderLabels, allFolderValues);
|
|
|
|
initListPreference(mSpamFolder, mAccount.getSpamFolderName(), allFolderLabels, allFolderValues);
|
|
|
|
initListPreference(mTrashFolder, mAccount.getTrashFolderName(), allFolderLabels, allFolderValues);
|
|
|
|
mArchiveFolder.setEnabled(true);
|
|
|
|
mSpamFolder.setEnabled(true);
|
|
|
|
mDraftsFolder.setEnabled(true);
|
|
|
|
mSentFolder.setEnabled(true);
|
|
|
|
mTrashFolder.setEnabled(true);
|
|
|
|
}
|
2010-12-24 17:48:29 -05:00
|
|
|
}
|
|
|
|
}
|
2008-11-01 17:32:06 -04:00
|
|
|
}
|