diff --git a/res/values/arrays.xml b/res/values/arrays.xml
index 1fbf935cd..b347b220b 100644
--- a/res/values/arrays.xml
+++ b/res/values/arrays.xml
@@ -96,6 +96,39 @@
- 365
+
+
+ - @string/account_settings_autodownload_message_size_1
+ - @string/account_settings_autodownload_message_size_2
+ - @string/account_settings_autodownload_message_size_4
+ - @string/account_settings_autodownload_message_size_8
+ - @string/account_settings_autodownload_message_size_16
+ - @string/account_settings_autodownload_message_size_32
+ - @string/account_settings_autodownload_message_size_64
+ - @string/account_settings_autodownload_message_size_128
+ - @string/account_settings_autodownload_message_size_256
+ - @string/account_settings_autodownload_message_size_512
+ - @string/account_settings_autodownload_message_size_1024
+ - @string/account_settings_autodownload_message_size_2048
+ - @string/account_settings_autodownload_message_size_0
+
+
+
+ - 1024
+ - 2048
+ - 4096
+ - 8192
+ - 16384
+ - 32768
+ - 65536
+ - 131072
+ - 262144
+ - 524288
+ - 1048576
+ - 2097152
+ - 0
+
+
- @string/account_settings_folder_display_mode_all
- @string/account_settings_folder_display_mode_first_class
diff --git a/res/values/strings.xml b/res/values/strings.xml
index 39a4087ff..525f4bc02 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -519,6 +519,22 @@ Welcome to K-9 Mail setup. K-9 is an open source mail client for Android origin
Number of messages to display
+ Automatically download message content up to
+ 1Kb
+ 2Kb
+ 4Kb
+ 8Kb
+ 16Kb
+ 32Kb
+ 64Kb
+ 128Kb
+ 256Kb
+ 512Kb
+ 1Mb
+ 2Mb
+ any size
+ only download headers
+
Sync messages newer than
the Big Bang
one day
diff --git a/res/xml/account_settings_preferences.xml b/res/xml/account_settings_preferences.xml
index f3e09e040..d9ae8eba4 100644
--- a/res/xml/account_settings_preferences.xml
+++ b/res/xml/account_settings_preferences.xml
@@ -95,6 +95,13 @@
android:entryValues="@array/account_settings_message_age_values"
android:dialogTitle="@string/account_settings_message_age_label" />
+
+
* So 25k gives good performance and a reasonable data footprint. Sounds good to me.
*/
- private static final int MAX_SMALL_MESSAGE_SIZE = Store.FETCH_BODY_SANE_SUGGESTED_SIZE;
private static final String PENDING_COMMAND_MOVE_OR_COPY = "com.fsck.k9.MessagingController.moveOrCopy";
private static final String PENDING_COMMAND_MOVE_OR_COPY_BULK = "com.fsck.k9.MessagingController.moveOrCopyBulk";
@@ -1621,7 +1620,7 @@ public class MessagingController implements Runnable
return;
}
- if (message.getSize() > (MAX_SMALL_MESSAGE_SIZE))
+ if (message.getSize() > account.getMaximumAutoDownloadMessageSize())
{
largeMessages.add(message);
}
@@ -1841,11 +1840,11 @@ public class MessagingController implements Runnable
{
/*
* Mark the message as fully downloaded if the message size is smaller than
- * the FETCH_BODY_SANE_SUGGESTED_SIZE, otherwise mark as only a partial
+ * the account's autodownload size limit, otherwise mark as only a partial
* download. This will prevent the system from downloading the same message
* twice.
*/
- if (message.getSize() < Store.FETCH_BODY_SANE_SUGGESTED_SIZE)
+ if (message.getSize() < account.getMaximumAutoDownloadMessageSize())
{
localMessage.setFlag(Flag.X_DOWNLOADED_FULL, true);
}
diff --git a/src/com/fsck/k9/mail/Store.java b/src/com/fsck/k9/mail/Store.java
index e89fb4f79..3dae092d0 100644
--- a/src/com/fsck/k9/mail/Store.java
+++ b/src/com/fsck/k9/mail/Store.java
@@ -22,13 +22,6 @@ import java.util.List;
*/
public abstract class Store
{
- /**
- * A global suggestion to Store implementors on how much of the body
- * should be returned on FetchProfile.Item.BODY_SANE requests.
- */
- //Matching MessagingController.MAX_SMALL_MESSAGE_SIZE
- public static final int FETCH_BODY_SANE_SUGGESTED_SIZE = (50 * 1024);
-
protected static final int SOCKET_CONNECT_TIMEOUT = 30000;
protected static final int SOCKET_READ_TIMEOUT = 60000;
diff --git a/src/com/fsck/k9/mail/store/ImapStore.java b/src/com/fsck/k9/mail/store/ImapStore.java
index 13a2dc968..46fbd0934 100644
--- a/src/com/fsck/k9/mail/store/ImapStore.java
+++ b/src/com/fsck/k9/mail/store/ImapStore.java
@@ -1205,7 +1205,7 @@ public class ImapStore extends Store
}
if (fp.contains(FetchProfile.Item.BODY_SANE))
{
- fetchFields.add(String.format("BODY.PEEK[]<0.%d>", FETCH_BODY_SANE_SUGGESTED_SIZE));
+ fetchFields.add(String.format("BODY.PEEK[]<0.%d>", mAccount.getMaximumAutoDownloadMessageSize()));
}
if (fp.contains(FetchProfile.Item.BODY))
{
@@ -1327,7 +1327,7 @@ public class ImapStore extends Store
String partId = parts[0];
if ("TEXT".equalsIgnoreCase(partId))
{
- fetch = String.format("BODY.PEEK[TEXT]<0.%d>", FETCH_BODY_SANE_SUGGESTED_SIZE);
+ fetch = String.format("BODY.PEEK[TEXT]<0.%d>", mAccount.getMaximumAutoDownloadMessageSize());
}
else
{
diff --git a/src/com/fsck/k9/mail/store/Pop3Store.java b/src/com/fsck/k9/mail/store/Pop3Store.java
index 170fc3b40..d70928ec5 100644
--- a/src/com/fsck/k9/mail/store/Pop3Store.java
+++ b/src/com/fsck/k9/mail/store/Pop3Store.java
@@ -697,7 +697,7 @@ public class Pop3Store extends Store
* divided by the maximum line size (76).
*/
fetchBody(pop3Message,
- FETCH_BODY_SANE_SUGGESTED_SIZE / 76);
+ (mAccount.getMaximumAutoDownloadMessageSize() / 76));
}
else if (fp.contains(FetchProfile.Item.STRUCTURE))
{
diff --git a/src/com/fsck/k9/mail/store/WebDavStore.java b/src/com/fsck/k9/mail/store/WebDavStore.java
index a7b81f329..b0fb03331 100644
--- a/src/com/fsck/k9/mail/store/WebDavStore.java
+++ b/src/com/fsck/k9/mail/store/WebDavStore.java
@@ -1537,9 +1537,8 @@ public class WebDavStore extends Store
if (fp.contains(FetchProfile.Item.BODY_SANE))
{
- fetchMessages(messages, listener, FETCH_BODY_SANE_SUGGESTED_SIZE / 76);
+ fetchMessages(messages, listener, (mAccount.getMaximumAutoDownloadMessageSize() / 76));
}
-
if (fp.contains(FetchProfile.Item.BODY))
{
fetchMessages(messages, listener, -1);