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_512</item>
|
||||||
<item>@string/account_settings_autodownload_message_size_1024</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_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>
|
||||||
|
|
||||||
<string-array name="account_settings_autodownload_message_size_values">
|
<string-array name="account_settings_autodownload_message_size_values">
|
||||||
@ -127,6 +130,9 @@
|
|||||||
<item>524288</item>
|
<item>524288</item>
|
||||||
<item>1048576</item>
|
<item>1048576</item>
|
||||||
<item>2097152</item>
|
<item>2097152</item>
|
||||||
|
<item>5242880</item>
|
||||||
|
<item>10485760</item>
|
||||||
|
<item>0</item>
|
||||||
</string-array>
|
</string-array>
|
||||||
|
|
||||||
<string-array name="account_settings_folder_display_mode_entries">
|
<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_512">512Kb</string>
|
||||||
<string name="account_settings_autodownload_message_size_1024">1Mb</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_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_autodownload_message_size_any">any size (no limit)</string>
|
||||||
|
|
||||||
<string name="account_settings_message_age_label">Sync messages from</string>
|
<string name="account_settings_message_age_label">Sync messages from</string>
|
||||||
|
@ -1441,7 +1441,8 @@ public class MessagingController implements Runnable {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (message.getSize() > account.getMaximumAutoDownloadMessageSize()) {
|
if (account.getMaximumAutoDownloadMessageSize() > 0 &&
|
||||||
|
message.getSize() > account.getMaximumAutoDownloadMessageSize()) {
|
||||||
largeMessages.add(message);
|
largeMessages.add(message);
|
||||||
} else {
|
} else {
|
||||||
smallMessages.add(message);
|
smallMessages.add(message);
|
||||||
@ -1674,8 +1675,11 @@ public class MessagingController implements Runnable {
|
|||||||
* the account's autodownload size limit, 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
|
* download. This will prevent the system from downloading the same message
|
||||||
* twice.
|
* 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);
|
localMessage.setFlag(Flag.X_DOWNLOADED_FULL, true);
|
||||||
} else {
|
} else {
|
||||||
// Set a flag indicating that the message has been partially downloaded and
|
// Set a flag indicating that the message has been partially downloaded and
|
||||||
|
@ -1110,7 +1110,12 @@ public class ImapStore extends Store {
|
|||||||
fetchFields.add("BODYSTRUCTURE");
|
fetchFields.add("BODYSTRUCTURE");
|
||||||
}
|
}
|
||||||
if (fp.contains(FetchProfile.Item.BODY_SANE)) {
|
if (fp.contains(FetchProfile.Item.BODY_SANE)) {
|
||||||
|
// 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()));
|
fetchFields.add(String.format("BODY.PEEK[]<0.%d>", mAccount.getMaximumAutoDownloadMessageSize()));
|
||||||
|
} else {
|
||||||
|
fetchFields.add("BODY.PEEK[]");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (fp.contains(FetchProfile.Item.BODY)) {
|
if (fp.contains(FetchProfile.Item.BODY)) {
|
||||||
fetchFields.add("BODY.PEEK[]");
|
fetchFields.add("BODY.PEEK[]");
|
||||||
|
@ -582,8 +582,12 @@ public class Pop3Store extends Store {
|
|||||||
* To convert the suggested download size we take the size
|
* To convert the suggested download size we take the size
|
||||||
* divided by the maximum line size (76).
|
* divided by the maximum line size (76).
|
||||||
*/
|
*/
|
||||||
|
if (mAccount.getMaximumAutoDownloadMessageSize() > 0) {
|
||||||
fetchBody(pop3Message,
|
fetchBody(pop3Message,
|
||||||
(mAccount.getMaximumAutoDownloadMessageSize() / 76));
|
(mAccount.getMaximumAutoDownloadMessageSize() / 76));
|
||||||
|
} else {
|
||||||
|
fetchBody(pop3Message, -1);
|
||||||
|
}
|
||||||
} else if (fp.contains(FetchProfile.Item.STRUCTURE)) {
|
} else if (fp.contains(FetchProfile.Item.STRUCTURE)) {
|
||||||
/*
|
/*
|
||||||
* If the user is requesting STRUCTURE we are required to set the body
|
* 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)) {
|
if (fp.contains(FetchProfile.Item.BODY_SANE)) {
|
||||||
|
if (mAccount.getMaximumAutoDownloadMessageSize() > 0) {
|
||||||
fetchMessages(messages, listener, (mAccount.getMaximumAutoDownloadMessageSize() / 76));
|
fetchMessages(messages, listener, (mAccount.getMaximumAutoDownloadMessageSize() / 76));
|
||||||
|
} else {
|
||||||
|
fetchMessages(messages, listener, -1);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (fp.contains(FetchProfile.Item.BODY)) {
|
if (fp.contains(FetchProfile.Item.BODY)) {
|
||||||
fetchMessages(messages, listener, -1);
|
fetchMessages(messages, listener, -1);
|
||||||
|
Loading…
Reference in New Issue
Block a user