1
0
mirror of https://github.com/moparisthebest/k-9 synced 2024-11-23 18:02:15 -05:00

Added user preference for the display limit of messages. The display limit is also used for the visible limit increment. If no limit is specified, the default limit is used. The limit is also account specific and not global.

This commit is contained in:
Matthew Brace 2008-12-11 05:25:59 +00:00
parent 8d3579fe74
commit f273805ee3
14 changed files with 282 additions and 144 deletions

View File

@ -14,6 +14,16 @@
android:id="@+id/account_check_frequency" android:id="@+id/account_check_frequency"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_width="fill_parent" /> android:layout_width="fill_parent" />
<TextView
android:text="@string/account_setup_options_mail_display_count_label"
android:layout_height="wrap_content"
android:layout_width="fill_parent"
android:textAppearance="?android:attr/textAppearanceSmall"
android:textColor="?android:attr/textColorPrimary" />
<Spinner
android:id="@+id/account_display_count"
android:layout_height="wrap_content"
android:layout_width="fill_parent" />
<CheckBox <CheckBox
android:id="@+id/account_default" android:id="@+id/account_default"
android:layout_height="wrap_content" android:layout_height="wrap_content"

View File

@ -34,4 +34,17 @@
<item>60</item> <item>60</item>
</string-array> </string-array>
<string-array name="account_settings_display_count_entries">
<item>@string/account_setup_options_mail_display_count_10</item>
<item>@string/account_setup_options_mail_display_count_25</item>
<item>@string/account_setup_options_mail_display_count_50</item>
<item>@string/account_setup_options_mail_display_count_100</item>
</string-array>
<string-array name="account_settings_display_count_values">
<item>10</item>
<item>25</item>
<item>50</item>
<item>100</item>
</string-array>
</resources> </resources>

View File

@ -217,6 +217,13 @@ Welcome to K-9 Mail setup. K-9 is an open source email client for Android based
<string name="account_setup_options_default_label">Send email from this account by default.</string> <string name="account_setup_options_default_label">Send email from this account by default.</string>
<string name="account_setup_options_notify_label">Notify me when email arrives.</string> <string name="account_setup_options_notify_label">Notify me when email arrives.</string>
<!-- Number of displayed messages, also used in account_settings_* -->
<string name="account_setup_options_mail_display_count_label">Number of emails to display</string>
<string name="account_setup_options_mail_display_count_10">10 Messages</string>
<string name="account_setup_options_mail_display_count_25">25 Messages</string>
<string name="account_setup_options_mail_display_count_50">50 Messages</string>
<string name="account_setup_options_mail_display_count_100">100 Messages</string>
<string name="account_setup_failed_dlg_title">Setup could not finish</string> <string name="account_setup_failed_dlg_title">Setup could not finish</string>
<string name="account_setup_failed_dlg_auth_message_fmt">Username or password incorrect.\n(<xliff:g id="error">%s</xliff:g>)</string> <!-- Username or password incorrect\n(ERR01 Account does not exist) --> <string name="account_setup_failed_dlg_auth_message_fmt">Username or password incorrect.\n(<xliff:g id="error">%s</xliff:g>)</string> <!-- Username or password incorrect\n(ERR01 Account does not exist) -->
<string name="account_setup_failed_dlg_certificate_message_fmt">Cannot safely connect to server.\n(<xliff:g id="error">%s</xliff:g>)</string> <!-- Cannot safely connect to server\n(Invalid certificate) --> <string name="account_setup_failed_dlg_certificate_message_fmt">Cannot safely connect to server.\n(<xliff:g id="error">%s</xliff:g>)</string> <!-- Cannot safely connect to server\n(Invalid certificate) -->
@ -232,6 +239,7 @@ Welcome to K-9 Mail setup. K-9 is an open source email client for Android based
<string name="account_settings_notify_summary">Notify in status bar when email arrives</string> <string name="account_settings_notify_summary">Notify in status bar when email arrives</string>
<string name="account_settings_show_combined_label">Show combined Inbox</string> <string name="account_settings_show_combined_label">Show combined Inbox</string>
<string name="account_settings_mail_check_frequency_label">Email check frequency</string> <string name="account_settings_mail_check_frequency_label">Email check frequency</string>
<string name="account_settings_mail_display_count_label">Number of emails to display</string>
<string name="account_settings_incoming_label">Incoming settings</string> <string name="account_settings_incoming_label">Incoming settings</string>
<string name="account_settings_incoming_summary">Configure the incoming email server</string> <string name="account_settings_incoming_summary">Configure the incoming email server</string>
<string name="account_settings_outgoing_label">Outgoing settings</string> <string name="account_settings_outgoing_label">Outgoing settings</string>

View File

@ -33,6 +33,12 @@
android:entryValues="@array/account_settings_check_frequency_values" android:entryValues="@array/account_settings_check_frequency_values"
android:dialogTitle="@string/account_settings_mail_check_frequency_label" /> android:dialogTitle="@string/account_settings_mail_check_frequency_label" />
<ListPreference
android:key="account_display_count"
android:title="@string/account_settings_mail_display_count_label"
android:entries="@array/account_settings_display_count_entries"
android:entryValues="@array/account_settings_display_count_values"
android:dialogTitle="@string/account_settings_mail_display_count_label" />
<PreferenceScreen <PreferenceScreen
android:key="composition" android:key="composition"

View File

@ -30,6 +30,7 @@ public class Account implements Serializable {
String mSignature; String mSignature;
String mAlwaysBcc; String mAlwaysBcc;
int mAutomaticCheckIntervalMinutes; int mAutomaticCheckIntervalMinutes;
int mDisplayCount;
long mLastAutomaticCheckTime; long mLastAutomaticCheckTime;
boolean mNotifyNewMail; boolean mNotifyNewMail;
String mDraftsFolderName; String mDraftsFolderName;
@ -54,6 +55,7 @@ public class Account implements Serializable {
mUuid = UUID.randomUUID().toString(); mUuid = UUID.randomUUID().toString();
mLocalStoreUri = "local://localhost/" + context.getDatabasePath(mUuid + ".db"); mLocalStoreUri = "local://localhost/" + context.getDatabasePath(mUuid + ".db");
mAutomaticCheckIntervalMinutes = -1; mAutomaticCheckIntervalMinutes = -1;
mDisplayCount = -1;
mAccountNumber = -1; mAccountNumber = -1;
mNotifyNewMail = true; mNotifyNewMail = true;
mSignature = "Sent from my Android phone with K-9. Please excuse my brevity."; mSignature = "Sent from my Android phone with K-9. Please excuse my brevity.";
@ -82,6 +84,7 @@ public class Account implements Serializable {
mSignature = preferences.mSharedPreferences.getString(mUuid + ".signature", mSignature); mSignature = preferences.mSharedPreferences.getString(mUuid + ".signature", mSignature);
mAutomaticCheckIntervalMinutes = preferences.mSharedPreferences.getInt(mUuid mAutomaticCheckIntervalMinutes = preferences.mSharedPreferences.getInt(mUuid
+ ".automaticCheckIntervalMinutes", -1); + ".automaticCheckIntervalMinutes", -1);
mDisplayCount = preferences.mSharedPreferences.getInt(mUuid + ".displayCount", -1);
mLastAutomaticCheckTime = preferences.mSharedPreferences.getLong(mUuid mLastAutomaticCheckTime = preferences.mSharedPreferences.getLong(mUuid
+ ".lastAutomaticCheckTime", 0); + ".lastAutomaticCheckTime", 0);
mNotifyNewMail = preferences.mSharedPreferences.getBoolean(mUuid + ".notifyNewMail", mNotifyNewMail = preferences.mSharedPreferences.getBoolean(mUuid + ".notifyNewMail",
@ -259,6 +262,7 @@ public class Account implements Serializable {
editor.putString(mUuid + ".signature", mSignature); editor.putString(mUuid + ".signature", mSignature);
editor.putString(mUuid + ".alwaysBcc", mAlwaysBcc); editor.putString(mUuid + ".alwaysBcc", mAlwaysBcc);
editor.putInt(mUuid + ".automaticCheckIntervalMinutes", mAutomaticCheckIntervalMinutes); editor.putInt(mUuid + ".automaticCheckIntervalMinutes", mAutomaticCheckIntervalMinutes);
editor.putInt(mUuid + ".displayCount", mDisplayCount);
editor.putLong(mUuid + ".lastAutomaticCheckTime", mLastAutomaticCheckTime); editor.putLong(mUuid + ".lastAutomaticCheckTime", mLastAutomaticCheckTime);
editor.putBoolean(mUuid + ".notifyNewMail", mNotifyNewMail); editor.putBoolean(mUuid + ".notifyNewMail", mNotifyNewMail);
editor.putInt(mUuid + ".deletePolicy", mDeletePolicy); editor.putInt(mUuid + ".deletePolicy", mDeletePolicy);
@ -295,6 +299,13 @@ public class Account implements Serializable {
return mAutomaticCheckIntervalMinutes; return mAutomaticCheckIntervalMinutes;
} }
public int getDisplayCount() {
if (mDisplayCount == -1) {
this.mDisplayCount = k9.DEFAULT_VISIBLE_LIMIT;
}
return mDisplayCount;
}
/** /**
* @param automaticCheckIntervalMinutes or -1 for never. * @param automaticCheckIntervalMinutes or -1 for never.
*/ */
@ -302,6 +313,17 @@ public class Account implements Serializable {
this.mAutomaticCheckIntervalMinutes = automaticCheckIntervalMinutes; this.mAutomaticCheckIntervalMinutes = automaticCheckIntervalMinutes;
} }
/**
* @param displayCount
*/
public void setDisplayCount(int displayCount) {
if (displayCount != -1) {
this.mDisplayCount = displayCount;
} else {
this.mDisplayCount = k9.DEFAULT_VISIBLE_LIMIT;
}
}
public long getLastAutomaticCheckTime() { public long getLastAutomaticCheckTime() {
return mLastAutomaticCheckTime; return mLastAutomaticCheckTime;
} }

View File

@ -206,7 +206,7 @@ public class MessagingController implements Runnable {
Folder localFolder = localStore.getFolder(remoteFolders[i].getName()); Folder localFolder = localStore.getFolder(remoteFolders[i].getName());
if (!localFolder.exists()) { if (!localFolder.exists()) {
localFolder.create(FolderType.HOLDS_MESSAGES); localFolder.create(FolderType.HOLDS_MESSAGES, account.getDisplayCount());
} }
remoteFolderNames.add(remoteFolders[i].getName()); remoteFolderNames.add(remoteFolders[i].getName());
} }
@ -297,7 +297,7 @@ public class MessagingController implements Runnable {
mApplication); mApplication);
LocalFolder localFolder = (LocalFolder) localStore.getFolder(folder); LocalFolder localFolder = (LocalFolder) localStore.getFolder(folder);
localFolder.setVisibleLimit(localFolder.getVisibleLimit() localFolder.setVisibleLimit(localFolder.getVisibleLimit()
+ k9.VISIBLE_LIMIT_INCREMENT); + account.getDisplayCount());
synchronizeMailbox(account, folder, listener); synchronizeMailbox(account, folder, listener);
} }
catch (MessagingException me) { catch (MessagingException me) {
@ -310,7 +310,7 @@ public class MessagingController implements Runnable {
try { try {
LocalStore localStore = LocalStore localStore =
(LocalStore) Store.getInstance(account.getLocalStoreUri(), mApplication); (LocalStore) Store.getInstance(account.getLocalStoreUri(), mApplication);
localStore.resetVisibleLimits(); localStore.resetVisibleLimits(account.getDisplayCount());
} }
catch (MessagingException e) { catch (MessagingException e) {
Log.e(k9.LOG_TAG, "Unable to reset visible limits", e); Log.e(k9.LOG_TAG, "Unable to reset visible limits", e);

View File

@ -11,6 +11,8 @@ public final class R {
public static final class array { public static final class array {
public static final int account_settings_check_frequency_entries=0x7f050000; public static final int account_settings_check_frequency_entries=0x7f050000;
public static final int account_settings_check_frequency_values=0x7f050001; public static final int account_settings_check_frequency_values=0x7f050001;
public static final int account_settings_display_count_entries=0x7f050002;
public static final int account_settings_display_count_values=0x7f050003;
} }
public static final class attr { public static final class attr {
} }
@ -92,92 +94,95 @@ public final class R {
} }
public static final class id { public static final class id {
public static final int account_always_bcc=0x7f0a000c; public static final int account_always_bcc=0x7f0a000c;
public static final int account_check_frequency=0x7f0a001a; public static final int account_check_frequency=0x7f0a001c;
public static final int account_default=0x7f0a0006; public static final int account_default=0x7f0a0006;
public static final int account_delete_policy=0x7f0a0014; public static final int account_delete_policy=0x7f0a0016;
public static final int account_delete_policy_label=0x7f0a0013; public static final int account_delete_policy_label=0x7f0a0015;
public static final int account_description=0x7f0a0018; public static final int account_deleted_items=0x7f0a000f;
public static final int account_description=0x7f0a001a;
public static final int account_display_count=0x7f0a001d;
public static final int account_email=0x7f0a0003; public static final int account_email=0x7f0a0003;
public static final int account_name=0x7f0a000b; public static final int account_name=0x7f0a000b;
public static final int account_notify=0x7f0a001b; public static final int account_notify=0x7f0a001e;
public static final int account_password=0x7f0a0004; public static final int account_password=0x7f0a0004;
public static final int account_port=0x7f0a0011; public static final int account_port=0x7f0a0013;
public static final int account_require_login=0x7f0a001c; public static final int account_require_login=0x7f0a001f;
public static final int account_require_login_settings=0x7f0a001d; public static final int account_require_login_settings=0x7f0a0020;
public static final int account_security_type=0x7f0a0012; public static final int account_security_type=0x7f0a0014;
public static final int account_server=0x7f0a0010; public static final int account_sent_items=0x7f0a000e;
public static final int account_server_label=0x7f0a000f; public static final int account_server=0x7f0a0012;
public static final int account_settings=0x7f0a0050; public static final int account_server_label=0x7f0a0011;
public static final int account_settings=0x7f0a0053;
public static final int account_signature=0x7f0a000d; public static final int account_signature=0x7f0a000d;
public static final int account_username=0x7f0a000e; public static final int account_username=0x7f0a0010;
public static final int accounts=0x7f0a004f; public static final int accounts=0x7f0a0052;
public static final int add_attachment=0x7f0a0055; public static final int add_attachment=0x7f0a0058;
public static final int add_cc_bcc=0x7f0a0051; public static final int add_cc_bcc=0x7f0a0054;
public static final int add_new_account=0x7f0a001f; public static final int add_new_account=0x7f0a0022;
public static final int attachment=0x7f0a003f; public static final int attachment=0x7f0a0042;
public static final int attachment_delete=0x7f0a0035; public static final int attachment_delete=0x7f0a0038;
public static final int attachment_icon=0x7f0a003b; public static final int attachment_icon=0x7f0a003e;
public static final int attachment_info=0x7f0a003c; public static final int attachment_info=0x7f0a003f;
public static final int attachment_name=0x7f0a0036; public static final int attachment_name=0x7f0a0039;
public static final int attachments=0x7f0a0030; public static final int attachments=0x7f0a0033;
public static final int bcc=0x7f0a002f; public static final int bcc=0x7f0a0032;
public static final int cancel=0x7f0a000a; public static final int cancel=0x7f0a000a;
public static final int cc=0x7f0a002e; public static final int cc=0x7f0a0031;
public static final int check_mail=0x7f0a0049; public static final int check_mail=0x7f0a004c;
public static final int chip=0x7f0a0026; public static final int chip=0x7f0a0029;
public static final int compose=0x7f0a004a; public static final int compose=0x7f0a004d;
public static final int date=0x7f0a0029; public static final int date=0x7f0a002c;
public static final int debug_logging=0x7f0a0024; public static final int debug_logging=0x7f0a0027;
public static final int delete=0x7f0a003a; public static final int delete=0x7f0a003d;
public static final int delete_account=0x7f0a0048; public static final int delete_account=0x7f0a004b;
public static final int description=0x7f0a0020; public static final int description=0x7f0a0023;
public static final int discard=0x7f0a0054; public static final int discard=0x7f0a0057;
public static final int done=0x7f0a0019; public static final int done=0x7f0a001b;
public static final int download=0x7f0a003d; public static final int download=0x7f0a0040;
public static final int dump_settings=0x7f0a004b; public static final int dump_settings=0x7f0a004e;
public static final int edit_account=0x7f0a0047; public static final int edit_account=0x7f0a004a;
public static final int email=0x7f0a0021; public static final int email=0x7f0a0024;
public static final int empty=0x7f0a001e; public static final int empty=0x7f0a0021;
public static final int folder_name=0x7f0a002b; public static final int folder_name=0x7f0a002e;
public static final int folder_status=0x7f0a002c; public static final int folder_status=0x7f0a002f;
public static final int forward=0x7f0a004c; public static final int forward=0x7f0a004f;
public static final int from=0x7f0a0028; public static final int from=0x7f0a002b;
public static final int imap=0x7f0a0001; public static final int imap=0x7f0a0001;
public static final int imap_path_prefix=0x7f0a0016; public static final int imap_path_prefix=0x7f0a0018;
public static final int imap_path_prefix_section=0x7f0a0015; public static final int imap_path_prefix_section=0x7f0a0017;
public static final int main_text=0x7f0a002a; public static final int main_text=0x7f0a002d;
public static final int manual_setup=0x7f0a0007; public static final int manual_setup=0x7f0a0007;
public static final int mark_as_read=0x7f0a004d; public static final int mark_as_read=0x7f0a0050;
public static final int mark_as_unread=0x7f0a0056; public static final int mark_as_unread=0x7f0a0059;
public static final int message=0x7f0a0008; public static final int message=0x7f0a0008;
public static final int message_content=0x7f0a0031; public static final int message_content=0x7f0a0034;
public static final int new_message_count=0x7f0a0022; public static final int new_message_count=0x7f0a0025;
public static final int next=0x7f0a0005; public static final int next=0x7f0a0005;
public static final int open=0x7f0a0046; public static final int open=0x7f0a0049;
public static final int pop=0x7f0a0000; public static final int pop=0x7f0a0000;
public static final int previous=0x7f0a0037; public static final int previous=0x7f0a003a;
public static final int progress=0x7f0a0009; public static final int progress=0x7f0a0009;
public static final int quoted_text=0x7f0a0034; public static final int quoted_text=0x7f0a0037;
public static final int quoted_text_bar=0x7f0a0032; public static final int quoted_text_bar=0x7f0a0035;
public static final int quoted_text_delete=0x7f0a0033; public static final int quoted_text_delete=0x7f0a0036;
public static final int refresh=0x7f0a004e; public static final int refresh=0x7f0a0051;
public static final int reply=0x7f0a0038; public static final int reply=0x7f0a003b;
public static final int reply_all=0x7f0a0039; public static final int reply_all=0x7f0a003c;
public static final int save=0x7f0a0053; public static final int save=0x7f0a0056;
public static final int send=0x7f0a0052; public static final int send=0x7f0a0055;
public static final int sensitive_logging=0x7f0a0025; public static final int sensitive_logging=0x7f0a0028;
public static final int show_pictures=0x7f0a0043; public static final int show_pictures=0x7f0a0046;
public static final int show_pictures_section=0x7f0a0042; public static final int show_pictures_section=0x7f0a0045;
public static final int subject=0x7f0a0027; public static final int subject=0x7f0a002a;
public static final int text1=0x7f0a0044; public static final int text1=0x7f0a0047;
public static final int text2=0x7f0a0045; public static final int text2=0x7f0a0048;
public static final int to=0x7f0a002d; public static final int to=0x7f0a0030;
public static final int to_container=0x7f0a0040; public static final int to_container=0x7f0a0043;
public static final int to_label=0x7f0a0041; public static final int to_label=0x7f0a0044;
public static final int version=0x7f0a0023; public static final int version=0x7f0a0026;
public static final int view=0x7f0a003e; public static final int view=0x7f0a0041;
public static final int webdav=0x7f0a0002; public static final int webdav=0x7f0a0002;
public static final int webdav_path_prefix_section=0x7f0a0017; public static final int webdav_path_prefix_section=0x7f0a0019;
} }
public static final class layout { public static final class layout {
public static final int account_setup_account_type=0x7f030000; public static final int account_setup_account_type=0x7f030000;
@ -211,38 +216,41 @@ public final class R {
public static final int message_view_option=0x7f090006; public static final int message_view_option=0x7f090006;
} }
public static final class string { public static final class string {
public static final int account_delete_dlg_instructions_fmt=0x7f0600cf; public static final int account_delete_dlg_instructions_fmt=0x7f0600d7;
public static final int account_delete_dlg_title=0x7f0600ce; public static final int account_delete_dlg_title=0x7f0600d6;
public static final int account_settings_action=0x7f06001b; public static final int account_settings_action=0x7f06001b;
public static final int account_settings_add_account_label=0x7f0600be; public static final int account_settings_add_account_label=0x7f0600c4;
public static final int account_settings_always_bcc_label=0x7f0600c8; public static final int account_settings_always_bcc_label=0x7f0600ce;
public static final int account_settings_always_bcc_summary=0x7f0600c9; public static final int account_settings_always_bcc_summary=0x7f0600cf;
public static final int account_settings_composition_label=0x7f0600c7; public static final int account_settings_composition_label=0x7f0600cd;
public static final int account_settings_composition_title=0x7f0600c6; public static final int account_settings_composition_title=0x7f0600cc;
public static final int account_settings_default=0x7f0600b2; public static final int account_settings_default=0x7f0600b7;
public static final int account_settings_default_label=0x7f0600b3; public static final int account_settings_default_label=0x7f0600b8;
public static final int account_settings_default_summary=0x7f0600b4; public static final int account_settings_default_summary=0x7f0600b9;
public static final int account_settings_description_label=0x7f0600bf; public static final int account_settings_deleted_items_label=0x7f0600d4;
public static final int account_settings_email_label=0x7f0600b6; public static final int account_settings_deleted_items_summary=0x7f0600d5;
public static final int account_settings_incoming_label=0x7f0600ba; public static final int account_settings_description_label=0x7f0600c5;
public static final int account_settings_incoming_summary=0x7f0600bb; public static final int account_settings_email_label=0x7f0600bb;
public static final int account_settings_mail_check_frequency_label=0x7f0600b9; public static final int account_settings_incoming_label=0x7f0600c0;
public static final int account_settings_name_label=0x7f0600c0; public static final int account_settings_incoming_summary=0x7f0600c1;
public static final int account_settings_notifications=0x7f0600c1; public static final int account_settings_mail_check_frequency_label=0x7f0600be;
public static final int account_settings_notify_label=0x7f0600b5; public static final int account_settings_mail_display_count_label=0x7f0600bf;
public static final int account_settings_notify_summary=0x7f0600b7; public static final int account_settings_name_label=0x7f0600c6;
public static final int account_settings_outgoing_label=0x7f0600bc; public static final int account_settings_notifications=0x7f0600c7;
public static final int account_settings_outgoing_summary=0x7f0600bd; public static final int account_settings_notify_label=0x7f0600ba;
public static final int account_settings_ringtone=0x7f0600c4; public static final int account_settings_notify_summary=0x7f0600bc;
public static final int account_settings_sent_items_label=0x7f0600cc; public static final int account_settings_outgoing_label=0x7f0600c2;
public static final int account_settings_sent_items_summary=0x7f0600cd; public static final int account_settings_outgoing_summary=0x7f0600c3;
public static final int account_settings_servers=0x7f0600c5; public static final int account_settings_ringtone=0x7f0600ca;
public static final int account_settings_show_combined_label=0x7f0600b8; public static final int account_settings_sent_items_label=0x7f0600d2;
public static final int account_settings_signature_label=0x7f0600ca; public static final int account_settings_sent_items_summary=0x7f0600d3;
public static final int account_settings_signature_summary=0x7f0600cb; public static final int account_settings_servers=0x7f0600cb;
public static final int account_settings_title_fmt=0x7f0600b1; public static final int account_settings_show_combined_label=0x7f0600bd;
public static final int account_settings_vibrate_enable=0x7f0600c2; public static final int account_settings_signature_label=0x7f0600d0;
public static final int account_settings_vibrate_summary=0x7f0600c3; public static final int account_settings_signature_summary=0x7f0600d1;
public static final int account_settings_title_fmt=0x7f0600b6;
public static final int account_settings_vibrate_enable=0x7f0600c8;
public static final int account_settings_vibrate_summary=0x7f0600c9;
public static final int account_setup_account_type_imap_action=0x7f060079; public static final int account_setup_account_type_imap_action=0x7f060079;
public static final int account_setup_account_type_instructions=0x7f060077; public static final int account_setup_account_type_instructions=0x7f060077;
public static final int account_setup_account_type_pop_action=0x7f060078; public static final int account_setup_account_type_pop_action=0x7f060078;
@ -263,20 +271,20 @@ public final class R {
public static final int account_setup_check_settings_finishing_msg=0x7f06006f; public static final int account_setup_check_settings_finishing_msg=0x7f06006f;
public static final int account_setup_check_settings_retr_info_msg=0x7f06006c; public static final int account_setup_check_settings_retr_info_msg=0x7f06006c;
public static final int account_setup_check_settings_title=0x7f06006b; public static final int account_setup_check_settings_title=0x7f06006b;
public static final int account_setup_failed_dlg_auth_message_fmt=0x7f0600ad; public static final int account_setup_failed_dlg_auth_message_fmt=0x7f0600b2;
/** Username or password incorrect\n(ERR01 Account does not exist) /** Username or password incorrect\n(ERR01 Account does not exist)
*/ */
public static final int account_setup_failed_dlg_certificate_message_fmt=0x7f0600ae; public static final int account_setup_failed_dlg_certificate_message_fmt=0x7f0600b3;
/** Cannot connect to server\n(Connection timed out) /** Cannot connect to server\n(Connection timed out)
*/ */
public static final int account_setup_failed_dlg_edit_details_action=0x7f0600b0; public static final int account_setup_failed_dlg_edit_details_action=0x7f0600b5;
public static final int account_setup_failed_dlg_invalid_certificate_accept=0x7f0600d3; public static final int account_setup_failed_dlg_invalid_certificate_accept=0x7f0600db;
public static final int account_setup_failed_dlg_invalid_certificate_reject=0x7f0600d4; public static final int account_setup_failed_dlg_invalid_certificate_reject=0x7f0600dc;
public static final int account_setup_failed_dlg_invalid_certificate_title=0x7f0600d2; public static final int account_setup_failed_dlg_invalid_certificate_title=0x7f0600da;
/** Cannot safely connect to server\n(Invalid certificate) /** Cannot safely connect to server\n(Invalid certificate)
*/ */
public static final int account_setup_failed_dlg_server_message_fmt=0x7f0600af; public static final int account_setup_failed_dlg_server_message_fmt=0x7f0600b4;
public static final int account_setup_failed_dlg_title=0x7f0600ac; public static final int account_setup_failed_dlg_title=0x7f0600b1;
public static final int account_setup_finished_toast=0x7f060075; public static final int account_setup_finished_toast=0x7f060075;
public static final int account_setup_incoming_delete_policy_7days_label=0x7f06008a; public static final int account_setup_incoming_delete_policy_7days_label=0x7f06008a;
public static final int account_setup_incoming_delete_policy_delete_label=0x7f06008b; public static final int account_setup_incoming_delete_policy_delete_label=0x7f06008b;
@ -313,6 +321,13 @@ public final class R {
/** Frequency also used in account_settings_* /** Frequency also used in account_settings_*
*/ */
public static final int account_setup_options_mail_check_frequency_never=0x7f0600a4; public static final int account_setup_options_mail_check_frequency_never=0x7f0600a4;
public static final int account_setup_options_mail_display_count_10=0x7f0600ad;
public static final int account_setup_options_mail_display_count_100=0x7f0600b0;
public static final int account_setup_options_mail_display_count_25=0x7f0600ae;
public static final int account_setup_options_mail_display_count_50=0x7f0600af;
/** Number of displayed messages, also used in account_settings_*
*/
public static final int account_setup_options_mail_display_count_label=0x7f0600ac;
public static final int account_setup_options_notify_label=0x7f0600ab; public static final int account_setup_options_notify_label=0x7f0600ab;
public static final int account_setup_options_title=0x7f0600a2; public static final int account_setup_options_title=0x7f0600a2;
public static final int account_setup_outgoing_authentication_basic_label=0x7f06009c; public static final int account_setup_outgoing_authentication_basic_label=0x7f06009c;
@ -420,8 +435,8 @@ public final class R {
public static final int okay_action=0x7f060008; public static final int okay_action=0x7f060008;
public static final int open_action=0x7f06001a; public static final int open_action=0x7f06001a;
public static final int preferences_action=0x7f060019; public static final int preferences_action=0x7f060019;
public static final int provider_note_live=0x7f0600d1; public static final int provider_note_live=0x7f0600d9;
public static final int provider_note_yahoo=0x7f0600d0; public static final int provider_note_yahoo=0x7f0600d8;
public static final int read_action=0x7f06001e; public static final int read_action=0x7f06001e;
public static final int read_attachment_desc=0x7f060003; public static final int read_attachment_desc=0x7f060003;
public static final int read_attachment_label=0x7f060002; public static final int read_attachment_label=0x7f060002;

View File

@ -738,12 +738,12 @@ public class FolderMessageList extends ExpandableListActivity {
if (holder.name.equalsIgnoreCase(k9.INBOX)) { if (holder.name.equalsIgnoreCase(k9.INBOX)) {
holder.displayName = getString(R.string.special_mailbox_name_inbox); holder.displayName = getString(R.string.special_mailbox_name_inbox);
// XXX TOOD nuke when we do this for all folders // XXX TOOD nuke when we do this for all folders
try { try {
holder.unreadMessageCount = folder.getUnreadMessageCount(); holder.unreadMessageCount = folder.getUnreadMessageCount();
} }
catch (MessagingException me) { catch (MessagingException me) {
Log.e(k9.LOG_TAG, "Folder.getUnreadMessageCount() failed", me); Log.e(k9.LOG_TAG, "Folder.getUnreadMessageCount() failed", me);
} }
} }
else { else {
@ -1131,7 +1131,8 @@ public class FolderMessageList extends ExpandableListActivity {
else { else {
if (folder.status == null) { if (folder.status == null) {
// holder.main.setText(getString(R.string.message_list_load_more_messages_action)); // holder.main.setText(getString(R.string.message_list_load_more_messages_action));
holder.main.setText("Load up to " + k9.VISIBLE_LIMIT_INCREMENT + " more"); // holder.main.setText("Load up to " + k9.VISIBLE_LIMIT_INCREMENT + " more");
holder.main.setText("Load up to " + mAccount.getDisplayCount() + " more");
} }
else { else {
holder.main.setText(getString(R.string.status_loading_more_failed)); holder.main.setText(getString(R.string.status_loading_more_failed));

View File

@ -25,6 +25,7 @@ public class AccountSettings extends PreferenceActivity {
private static final String PREFERENCE_DESCRIPTION = "account_description"; private static final String PREFERENCE_DESCRIPTION = "account_description";
private static final String PREFERENCE_COMPOSITION = "composition"; private static final String PREFERENCE_COMPOSITION = "composition";
private static final String PREFERENCE_FREQUENCY = "account_check_frequency"; private static final String PREFERENCE_FREQUENCY = "account_check_frequency";
private static final String PREFERENCE_DISPLAY_COUNT = "account_display_count";
private static final String PREFERENCE_DEFAULT = "account_default"; private static final String PREFERENCE_DEFAULT = "account_default";
private static final String PREFERENCE_NOTIFY = "account_notify"; private static final String PREFERENCE_NOTIFY = "account_notify";
private static final String PREFERENCE_VIBRATE = "account_vibrate"; private static final String PREFERENCE_VIBRATE = "account_vibrate";
@ -36,6 +37,7 @@ public class AccountSettings extends PreferenceActivity {
private EditTextPreference mAccountDescription; private EditTextPreference mAccountDescription;
private ListPreference mCheckFrequency; private ListPreference mCheckFrequency;
private ListPreference mDisplayCount;
private CheckBoxPreference mAccountDefault; private CheckBoxPreference mAccountDefault;
private CheckBoxPreference mAccountNotify; private CheckBoxPreference mAccountNotify;
private CheckBoxPreference mAccountVibrate; private CheckBoxPreference mAccountVibrate;
@ -84,6 +86,19 @@ public class AccountSettings extends PreferenceActivity {
} }
}); });
mDisplayCount = (ListPreference) findPreference(PREFERENCE_DISPLAY_COUNT);
mDisplayCount.setValue(String.valueOf(mAccount.getDisplayCount()));
mDisplayCount.setSummary(mDisplayCount.getEntry());
mDisplayCount.setOnPreferenceChangeListener(new Preference.OnPreferenceChangeListener() {
public boolean onPreferenceChange(Preference preference, Object newValue) {
final String summary = newValue.toString();
int index = mDisplayCount.findIndexOfValue(summary);
mDisplayCount.setSummary(mDisplayCount.getEntries()[index]);
mDisplayCount.setValue(summary);
return false;
}
});
mAccountDefault = (CheckBoxPreference) findPreference(PREFERENCE_DEFAULT); mAccountDefault = (CheckBoxPreference) findPreference(PREFERENCE_DEFAULT);
mAccountDefault.setChecked( mAccountDefault.setChecked(
mAccount.equals(Preferences.getPreferences(this).getDefaultAccount())); mAccount.equals(Preferences.getPreferences(this).getDefaultAccount()));
@ -140,6 +155,7 @@ public class AccountSettings extends PreferenceActivity {
mAccount.setDescription(mAccountDescription.getText()); mAccount.setDescription(mAccountDescription.getText());
mAccount.setNotifyNewMail(mAccountNotify.isChecked()); mAccount.setNotifyNewMail(mAccountNotify.isChecked());
mAccount.setAutomaticCheckIntervalMinutes(Integer.parseInt(mCheckFrequency.getValue())); mAccount.setAutomaticCheckIntervalMinutes(Integer.parseInt(mCheckFrequency.getValue()));
mAccount.setDisplayCount(Integer.parseInt(mDisplayCount.getValue()));
mAccount.setVibrate(mAccountVibrate.isChecked()); mAccount.setVibrate(mAccountVibrate.isChecked());
SharedPreferences prefs = mAccountRingtone.getPreferenceManager().getSharedPreferences(); SharedPreferences prefs = mAccountRingtone.getPreferenceManager().getSharedPreferences();
mAccount.setRingtone(prefs.getString(PREFERENCE_RINGTONE, null)); mAccount.setRingtone(prefs.getString(PREFERENCE_RINGTONE, null));

View File

@ -23,6 +23,8 @@ public class AccountSetupOptions extends Activity implements OnClickListener {
private Spinner mCheckFrequencyView; private Spinner mCheckFrequencyView;
private Spinner mDisplayCountView;
private CheckBox mDefaultView; private CheckBox mDefaultView;
private CheckBox mNotifyView; private CheckBox mNotifyView;
@ -42,6 +44,7 @@ public class AccountSetupOptions extends Activity implements OnClickListener {
setContentView(R.layout.account_setup_options); setContentView(R.layout.account_setup_options);
mCheckFrequencyView = (Spinner)findViewById(R.id.account_check_frequency); mCheckFrequencyView = (Spinner)findViewById(R.id.account_check_frequency);
mDisplayCountView = (Spinner)findViewById(R.id.account_display_count);
mDefaultView = (CheckBox)findViewById(R.id.account_default); mDefaultView = (CheckBox)findViewById(R.id.account_default);
mNotifyView = (CheckBox)findViewById(R.id.account_notify); mNotifyView = (CheckBox)findViewById(R.id.account_notify);
@ -68,6 +71,22 @@ public class AccountSetupOptions extends Activity implements OnClickListener {
.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item); .setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
mCheckFrequencyView.setAdapter(checkFrequenciesAdapter); mCheckFrequencyView.setAdapter(checkFrequenciesAdapter);
SpinnerOption displayCounts[] = {
new SpinnerOption(10,
getString(R.string.account_setup_options_mail_display_count_10)),
new SpinnerOption(25,
getString(R.string.account_setup_options_mail_display_count_25)),
new SpinnerOption(50,
getString(R.string.account_setup_options_mail_display_count_50)),
new SpinnerOption(100,
getString(R.string.account_setup_options_mail_display_count_100)),
};
ArrayAdapter<SpinnerOption> displayCountsAdapter = new ArrayAdapter<SpinnerOption>(this,
android.R.layout.simple_spinner_item, displayCounts);
displayCountsAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
mDisplayCountView.setAdapter(displayCountsAdapter);
mAccount = (Account)getIntent().getSerializableExtra(EXTRA_ACCOUNT); mAccount = (Account)getIntent().getSerializableExtra(EXTRA_ACCOUNT);
boolean makeDefault = getIntent().getBooleanExtra(EXTRA_MAKE_DEFAULT, false); boolean makeDefault = getIntent().getBooleanExtra(EXTRA_MAKE_DEFAULT, false);
@ -77,6 +96,8 @@ public class AccountSetupOptions extends Activity implements OnClickListener {
mNotifyView.setChecked(mAccount.isNotifyNewMail()); mNotifyView.setChecked(mAccount.isNotifyNewMail());
SpinnerOption.setSpinnerOptionValue(mCheckFrequencyView, mAccount SpinnerOption.setSpinnerOptionValue(mCheckFrequencyView, mAccount
.getAutomaticCheckIntervalMinutes()); .getAutomaticCheckIntervalMinutes());
SpinnerOption.setSpinnerOptionValue(mDisplayCountView, mAccount
.getDisplayCount());
} }
private void onDone() { private void onDone() {
@ -84,6 +105,8 @@ public class AccountSetupOptions extends Activity implements OnClickListener {
mAccount.setNotifyNewMail(mNotifyView.isChecked()); mAccount.setNotifyNewMail(mNotifyView.isChecked());
mAccount.setAutomaticCheckIntervalMinutes((Integer)((SpinnerOption)mCheckFrequencyView mAccount.setAutomaticCheckIntervalMinutes((Integer)((SpinnerOption)mCheckFrequencyView
.getSelectedItem()).value); .getSelectedItem()).value);
mAccount.setDisplayCount((Integer)((SpinnerOption)mDisplayCountView
.getSelectedItem()).value);
mAccount.save(Preferences.getPreferences(this)); mAccount.save(Preferences.getPreferences(this));
if (mDefaultView.isChecked()) { if (mDefaultView.isChecked()) {
Preferences.getPreferences(this).setDefaultAccount(mAccount); Preferences.getPreferences(this).setDefaultAccount(mAccount);

View File

@ -85,12 +85,12 @@ public class k9 extends Application {
* on each new folder and can be incremented with "Load more messages..." by the * on each new folder and can be incremented with "Load more messages..." by the
* VISIBLE_LIMIT_INCREMENT * VISIBLE_LIMIT_INCREMENT
*/ */
public static final int DEFAULT_VISIBLE_LIMIT = 100; public static int DEFAULT_VISIBLE_LIMIT = 25;
/** /**
* Number of additioanl messages to load when a user selectes "Load more messages..." * Number of additioanl messages to load when a user selectes "Load more messages..."
*/ */
public static final int VISIBLE_LIMIT_INCREMENT = 100; public static int VISIBLE_LIMIT_INCREMENT = 25;
/** /**
* The maximum size of an attachment we're willing to download (either View or Save) * The maximum size of an attachment we're willing to download (either View or Save)

View File

@ -41,6 +41,14 @@ public abstract class Folder {
public abstract boolean create(FolderType type) throws MessagingException; public abstract boolean create(FolderType type) throws MessagingException;
/**
* Create a new folder with a specified display limit. Not abstract to allow
* remote folders to not override or worry about this call if they don't care to.
*/
public boolean create(FolderType type, int displayLimit) throws MessagingException {
return create(type);
}
public abstract boolean exists() throws MessagingException; public abstract boolean exists() throws MessagingException;
/** /**

View File

@ -242,8 +242,12 @@ public class LocalStore extends Store {
} }
public void resetVisibleLimits() { public void resetVisibleLimits() {
resetVisibleLimits(k9.DEFAULT_VISIBLE_LIMIT);
}
public void resetVisibleLimits(int visibleLimit) {
ContentValues cv = new ContentValues(); ContentValues cv = new ContentValues();
cv.put("visible_limit", Integer.toString(k9.DEFAULT_VISIBLE_LIMIT)); cv.put("visible_limit", Integer.toString(visibleLimit));
mDb.update("folders", cv, null, null); mDb.update("folders", cv, null, null);
} }
@ -405,6 +409,17 @@ public class LocalStore extends Store {
return true; return true;
} }
public boolean create(FolderType type, int visibleLimit) throws MessagingException {
if (exists()) {
throw new MessagingException("Folder " + mName + " already exists.");
}
mDb.execSQL("INSERT INTO folders (name, visible_limit) VALUES (?, ?)", new Object[] {
mName,
visibleLimit
});
return true;
}
@Override @Override
public void close(boolean expunge) throws MessagingException { public void close(boolean expunge) throws MessagingException {
if (expunge) { if (expunge) {

View File

@ -775,24 +775,25 @@ public class WebDavStore extends Store {
ArrayList<Message> messageList = new ArrayList<Message>(); ArrayList<Message> messageList = new ArrayList<Message>();
Message[] messages; Message[] messages;
if (uids == null) { if (uids == null ||
messages = getMessages(0, k9.DEFAULT_VISIBLE_LIMIT, listener); uids.length == 0) {
} else { return messageList.toArray(new Message[] {});
for (int i = 0, count = uids.length; i < count; i++) {
if (listener != null) {
listener.messageStarted(uids[i], i, count);
}
WebDavMessage message = new WebDavMessage(uids[i], this);
messageList.add(message);
if (listener != null) {
listener.messageFinished(message, i, count);
}
}
messages = messageList.toArray(new Message[] {});
} }
for (int i = 0, count = uids.length; i < count; i++) {
if (listener != null) {
listener.messageStarted(uids[i], i, count);
}
WebDavMessage message = new WebDavMessage(uids[i], this);
messageList.add(message);
if (listener != null) {
listener.messageFinished(message, i, count);
}
}
messages = messageList.toArray(new Message[] {});
return messages; return messages;
} }