mirror of
https://github.com/moparisthebest/k-9
synced 2024-11-27 11:42:16 -05:00
Add 2MB, 5MB and "All" message download options
This commit is contained in:
parent
2a698f1ab9
commit
b02b895aaf
@ -112,6 +112,9 @@
|
||||
<item>@string/account_settings_autodownload_message_size_512</item>
|
||||
<item>@string/account_settings_autodownload_message_size_1024</item>
|
||||
<item>@string/account_settings_autodownload_message_size_2048</item>
|
||||
<item>@string/account_settings_autodownload_message_size_5120</item>
|
||||
<item>@string/account_settings_autodownload_message_size_10240</item>
|
||||
<item>@string/account_settings_autodownload_message_size_any</item>
|
||||
</string-array>
|
||||
|
||||
<string-array name="account_settings_autodownload_message_size_values">
|
||||
@ -127,6 +130,9 @@
|
||||
<item>524288</item>
|
||||
<item>1048576</item>
|
||||
<item>2097152</item>
|
||||
<item>5242880</item>
|
||||
<item>10485760</item>
|
||||
<item>0</item>
|
||||
</string-array>
|
||||
|
||||
<string-array name="account_settings_folder_display_mode_entries">
|
||||
|
@ -617,6 +617,8 @@ Welcome to K-9 Mail setup. K-9 is an open source mail client for Android origin
|
||||
<string name="account_settings_autodownload_message_size_512">512Kb</string>
|
||||
<string name="account_settings_autodownload_message_size_1024">1Mb</string>
|
||||
<string name="account_settings_autodownload_message_size_2048">2Mb</string>
|
||||
<string name="account_settings_autodownload_message_size_5120">5Mb</string>
|
||||
<string name="account_settings_autodownload_message_size_10240">10Mb</string>
|
||||
<string name="account_settings_autodownload_message_size_any">any size (no limit)</string>
|
||||
|
||||
<string name="account_settings_message_age_label">Sync messages from</string>
|
||||
|
@ -1441,7 +1441,8 @@ public class MessagingController implements Runnable {
|
||||
return;
|
||||
}
|
||||
|
||||
if (message.getSize() > account.getMaximumAutoDownloadMessageSize()) {
|
||||
if (account.getMaximumAutoDownloadMessageSize() > 0 &&
|
||||
message.getSize() > account.getMaximumAutoDownloadMessageSize()) {
|
||||
largeMessages.add(message);
|
||||
} else {
|
||||
smallMessages.add(message);
|
||||
@ -1674,8 +1675,11 @@ public class MessagingController implements Runnable {
|
||||
* 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 there is no limit on autodownload size, that's the same as the message
|
||||
* being smaller than the max size
|
||||
*/
|
||||
if (message.getSize() < account.getMaximumAutoDownloadMessageSize()) {
|
||||
if (account.getMaximumAutoDownloadMessageSize() == 0 || message.getSize() < account.getMaximumAutoDownloadMessageSize()) {
|
||||
localMessage.setFlag(Flag.X_DOWNLOADED_FULL, true);
|
||||
} else {
|
||||
// Set a flag indicating that the message has been partially downloaded and
|
||||
|
@ -1110,7 +1110,12 @@ public class ImapStore extends Store {
|
||||
fetchFields.add("BODYSTRUCTURE");
|
||||
}
|
||||
if (fp.contains(FetchProfile.Item.BODY_SANE)) {
|
||||
fetchFields.add(String.format("BODY.PEEK[]<0.%d>", mAccount.getMaximumAutoDownloadMessageSize()));
|
||||
// If the user wants to download unlimited-size messages, don't go only for the truncated body
|
||||
if (mAccount.getMaximumAutoDownloadMessageSize() > 0) {
|
||||
fetchFields.add(String.format("BODY.PEEK[]<0.%d>", mAccount.getMaximumAutoDownloadMessageSize()));
|
||||
} else {
|
||||
fetchFields.add("BODY.PEEK[]");
|
||||
}
|
||||
}
|
||||
if (fp.contains(FetchProfile.Item.BODY)) {
|
||||
fetchFields.add("BODY.PEEK[]");
|
||||
|
@ -582,8 +582,12 @@ public class Pop3Store extends Store {
|
||||
* To convert the suggested download size we take the size
|
||||
* divided by the maximum line size (76).
|
||||
*/
|
||||
fetchBody(pop3Message,
|
||||
(mAccount.getMaximumAutoDownloadMessageSize() / 76));
|
||||
if (mAccount.getMaximumAutoDownloadMessageSize() > 0) {
|
||||
fetchBody(pop3Message,
|
||||
(mAccount.getMaximumAutoDownloadMessageSize() / 76));
|
||||
} else {
|
||||
fetchBody(pop3Message, -1);
|
||||
}
|
||||
} else if (fp.contains(FetchProfile.Item.STRUCTURE)) {
|
||||
/*
|
||||
* If the user is requesting STRUCTURE we are required to set the body
|
||||
|
@ -1411,7 +1411,11 @@ public class WebDavStore extends Store {
|
||||
}
|
||||
|
||||
if (fp.contains(FetchProfile.Item.BODY_SANE)) {
|
||||
fetchMessages(messages, listener, (mAccount.getMaximumAutoDownloadMessageSize() / 76));
|
||||
if (mAccount.getMaximumAutoDownloadMessageSize() > 0) {
|
||||
fetchMessages(messages, listener, (mAccount.getMaximumAutoDownloadMessageSize() / 76));
|
||||
} else {
|
||||
fetchMessages(messages, listener, -1);
|
||||
}
|
||||
}
|
||||
if (fp.contains(FetchProfile.Item.BODY)) {
|
||||
fetchMessages(messages, listener, -1);
|
||||
|
Loading…
Reference in New Issue
Block a user