mirror of
https://github.com/moparisthebest/k-9
synced 2024-11-27 11:42:16 -05:00
Add a "fetch all messages" visible limit
This commit is contained in:
parent
a130f56bf4
commit
af5f78928c
@ -54,6 +54,7 @@
|
||||
<item>@string/account_setup_options_mail_display_count_250</item>
|
||||
<item>@string/account_setup_options_mail_display_count_500</item>
|
||||
<item>@string/account_setup_options_mail_display_count_1000</item>
|
||||
<item>@string/account_setup_options_mail_display_count_all</item>
|
||||
</string-array>
|
||||
|
||||
<string-array name="account_settings_display_count_values">
|
||||
@ -64,6 +65,7 @@
|
||||
<item>250</item>
|
||||
<item>500</item>
|
||||
<item>1000</item>
|
||||
<item>0</item>
|
||||
</string-array>
|
||||
|
||||
<string-array name="account_settings_message_age_entries">
|
||||
|
@ -493,6 +493,7 @@ Welcome to K-9 Mail setup. K-9 is an open source mail client for Android origin
|
||||
<string name="account_setup_options_mail_display_count_250">250 messages</string>
|
||||
<string name="account_setup_options_mail_display_count_500">500 messages</string>
|
||||
<string name="account_setup_options_mail_display_count_1000">1000 messages</string>
|
||||
<string name="account_setup_options_mail_display_count_all">all messages</string>
|
||||
|
||||
|
||||
<string name="move_copy_cannot_copy_unsynced_message">Cannot copy or move a message that is not synchronized with the server</string>
|
||||
|
@ -576,7 +576,7 @@ public class Account implements BaseAccount
|
||||
}
|
||||
|
||||
|
||||
public void resetVisibleLimits()
|
||||
public void resetVisibleLimits()
|
||||
{
|
||||
try
|
||||
{
|
||||
|
@ -2799,7 +2799,14 @@ public class MessageList
|
||||
{
|
||||
if (!mCurrentFolder.lastCheckFailed)
|
||||
{
|
||||
holder.main.setText(String.format(getString(R.string.load_more_messages_fmt), mAccount.getDisplayCount()));
|
||||
if (mAccount.getDisplayCount() == 0 )
|
||||
{
|
||||
holder.main.setText(getString(R.string.message_list_load_more_messages_action));
|
||||
}
|
||||
else
|
||||
{
|
||||
holder.main.setText(String.format(getString(R.string.load_more_messages_fmt), mAccount.getDisplayCount()));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -925,7 +925,9 @@ public class MessagingController implements Runnable
|
||||
{
|
||||
LocalStore localStore = account.getLocalStore();
|
||||
LocalFolder localFolder = localStore.getFolder(folder);
|
||||
localFolder.setVisibleLimit(localFolder.getVisibleLimit() + account.getDisplayCount());
|
||||
if (localFolder.getVisibleLimit() > 0 ) {
|
||||
localFolder.setVisibleLimit(localFolder.getVisibleLimit() + account.getDisplayCount());
|
||||
}
|
||||
synchronizeMailbox(account, folder, listener, null);
|
||||
}
|
||||
catch (MessagingException me)
|
||||
@ -1100,7 +1102,7 @@ public class MessagingController implements Runnable
|
||||
|
||||
int visibleLimit = localFolder.getVisibleLimit();
|
||||
|
||||
if (visibleLimit < 1)
|
||||
if (visibleLimit < 0)
|
||||
{
|
||||
visibleLimit = K9.DEFAULT_VISIBLE_LIMIT;
|
||||
}
|
||||
@ -1118,7 +1120,14 @@ public class MessagingController implements Runnable
|
||||
/*
|
||||
* Message numbers start at 1.
|
||||
*/
|
||||
int remoteStart = Math.max(0, remoteMessageCount - visibleLimit) + 1;
|
||||
int remoteStart;
|
||||
if (visibleLimit > 0 )
|
||||
{
|
||||
remoteStart = Math.max(0, remoteMessageCount - visibleLimit) + 1;
|
||||
}
|
||||
else {
|
||||
remoteStart = 1;
|
||||
}
|
||||
int remoteEnd = remoteMessageCount;
|
||||
|
||||
if (K9.DEBUG)
|
||||
@ -1479,7 +1488,7 @@ public class MessagingController implements Runnable
|
||||
int visibleLimit = localFolder.getVisibleLimit();
|
||||
int listSize = unsyncedMessages.size();
|
||||
|
||||
if (listSize > visibleLimit)
|
||||
if ((visibleLimit > 0) && (listSize > visibleLimit))
|
||||
{
|
||||
unsyncedMessages = unsyncedMessages.subList(listSize - visibleLimit, listSize);
|
||||
}
|
||||
|
@ -1150,6 +1150,10 @@ public class LocalStore extends Store implements Serializable
|
||||
|
||||
public void purgeToVisibleLimit(MessageRemovalListener listener) throws MessagingException
|
||||
{
|
||||
if ( mVisibleLimit == 0)
|
||||
{
|
||||
return ;
|
||||
}
|
||||
open(OpenMode.READ_WRITE);
|
||||
Message[] messages = getMessages(null, false);
|
||||
for (int i = mVisibleLimit; i < messages.length; i++)
|
||||
|
Loading…
Reference in New Issue
Block a user